日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

日历签到 java_微信小程序签到 日历 每日签到积分加1

發布時間:2023/12/20 编程问答 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 日历签到 java_微信小程序签到 日历 每日签到积分加1 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

signIn.json

{

"navigationBarTitleText": "簽到",

"usingComponents": {

}

}

signIn.wxss

/* 簽到頂部背景信息 */

.signBkImg{

width: 100%;

height: 241rpx;

position: relative;

}

.signBkImg>image{

width: 100%;

height: 100%;

}

.sign-con{

width: 92%;

height: 213rpx;

padding: 0 30rpx;

display: flex;

justify-content: space-between;

align-items: center;

position: absolute;

top: 0;

}

.sign-con>navigator{

width: 167rpx;

height: 67rpx;

line-height: 67rpx;

text-align: center;

border-radius: 34rpx;

color: #33998C;

background-color: #fff;

font-size: 30rpx;

}

.headNews-left{

display: flex;

align-items: center;

flex-wrap: nowrap;

}

.headNews-left>image{

width: 133rpx;

height: 133rpx;

border: 6rpx solid rgb(255,255,255);

border-radius: 50%;

}

.nikeNme{

color: rgb(254,254,254);

margin-left: 26rpx;

}

.nikeNme>view:nth-child(1){

font-size: 40rpx;

font-weight: bold;

}

.nikeNme>view:nth-child(2){

font-size: 26rpx;

margin-top: 12rpx;

}

/* 積分,積分明細 */

.points-con{

margin: 50rpx 0;

display: flex;

}

.points-con>view,.points-con>navigator{

width: 50%;

height: 61rpx;

line-height: 61rpx;

text-align: center;

color: rgb(119,119,119);

font-size: 30rpx;

}

.points-con>view{

border-right: 2rpx solid rgb(235,235,235);

}

.points-num{

font-size: 38rpx;

color: #33998C;

}

/* 日歷簽到 */

/**index.wxss**/

.t_red{

color: red;

}

.t_blue{

color: royalblue;

}

.calendar{

background-color: white;

box-shadow: 2px 2px 5px 2px #e6e6e6;

padding:30rpx;

width: 85%;

margin-left: 4%;

border-radius: 50rpx;

display: block

}

.time{

padding: 16rpx 20rpx;

background-color: wheat;

display: flex;

}

.time{

font-family: '黑體';

font-size: 40rpx;

color: white;

text-align: center;

padding: 16rpx 20rpx;

height:80rpx;

line-height:80rpx;

border-radius:12rpx;

background-color: #f9634b;

display: flex;

margin-bottom: 29rpx;

}

.time view{

flex: 1;

font-size: 30rpx;

}

.time view text{

font-size: 38rpx;

}

.weekName{

font-size: 36rpx;

color: #333;

width: 100%;

display: flex;

padding: 16rpx 0;

}

.weekName view{

flex: 1;

text-align: center;

}

.sunday,.saturday{

color: #33998C;

}

.week{

width: 100%;

}

.week view{

width: 14.2%;

height: 90rpx;

line-height: 80rpx;

display: inline-block;

margin: 10rpx 0;

font-size: 34rpx;

text-align: center;

}

.week view text{

width: 100%;

height: 100%;

display: inline-block;

}

.calendarSign{

margin: 40rpx auto;

}

.selDate{

font-size: 28rpx;

border-bottom: 1px solid #33998C;

}

.selDateItem{

color:#33998C;

font-weight: bold;

font-size:22rpx;

border-radius: 50%;

}

/* 前后時間 */

.preNext-path{

margin: 28rpx 0;

display: flex;

align-items: center;

justify-content: center;

}

.preNext-path>image{

width: 11rpx;

height: 21rpx;

}

.preNext-path>text{

color: #33998C;

font-size: 28rpx;

margin: 0 54rpx;

}

/* 簽到按鈕 */

.signInBtn{

width: 235rpx;

height: 77rpx;

line-height: 77rpx;

text-align: center;

border-radius: 10rpx;

font-size: 34rpx;

color: #fff;

background:#33998C;

}

signIn.wxml

{{userInfo.nickname}}

本月已簽到 {{calendarSignDay}} 天

兌換商品

我的積分:

{{userInfo.integral}}

積分明細 >

{{year}}年{{month}}月

\n

已簽到

{{item+1}}

已簽到

{{date}}

{{item+date+1}}

簽到

今日已簽到

signIn.js

js中導入了requestUtil 為請求工具類,改為自己的就行

import requestUtil from '../../../utils/requestUtil';

//獲取應用實例

var calendarSignData = [];

var date;

Page({

data: {

calendarSignData: [],

calendarSignDay:'',

month: "",

year: "",

userInfo: '',

show: false

},

onShow: function () {

this.a();

this.getUserByOpenid();

},

//獲取用戶

getUserByOpenid: function () {

var that = this;

var openId = wx.getStorageSync("openId");

if (openId) {

var url = "integral/getUserByOpenid";

requestUtil._get_param(url, {

openid: openId

}, function (res) {

console.log(res);

if (res.data.status == 200) {

var d = res.data.data;

var currentDate = new Date();

if (d.calendarSignDay > 0) {

var a = new Date(d.calendarSignTime);

var day = a.getDate();

if (currentDate.getDate() == day) {

calendarSignData[day] = day;

}

}

that.setData({

userInfo: d

// calendarSignData: calendarSignData

})

}

})

} else {

this.setData({

show: true

})

}

},

a(){

var openId = wx.getStorageSync("openId");

//過去簽到過的天數

var that = this;

var url = "integral/queryUserMonthSign";

requestUtil._get_param(url, {

openid:openId

}, function (res) {

console.log(res);

if (res.data.status == 200) {

that.setData({

calendarSignData: res.data.data.calendarSignData,

calendarSignDay:res.data.data.calendarSignDay,

})

}else{

wx.showToast({

title: '查詢本月簽到的數據失敗',

icon: 'none',

})

}

})

},

//事件處理函數

calendarSign: function () {

var openId = wx.getStorageSync("openId");

console.log(openId)

if (openId) {

var that = this;

var id = this.data.userInfo.id

var url = "integral/sign";

requestUtil._get_param(url, {

openid:openId

}, function (res) {

console.log(res);

if (res.data.status == 200) {

wx.showToast({

title: '簽到成功',

icon: 'success',

duration: 2000

})

that.onShow();

}else{

wx.showToast({

title: '今日已簽到,請勿重復簽到',

icon: 'none',

})

}

})

} else {

this.setData({

show: true

})

}

},

sign_prev: function () {

var year = this.data.year;

var month = this.data.month;

if (month == "1") {

var month = "12";

var year = parseInt(this.data.year) - 1;

} else {

var month = parseInt(this.data.month) - 1;

var showYear = this.data.year;

}

this.setData({

month: month,

year: year

})

},

sign_next: function () {

var year = this.data.year;

var month = this.data.month;

if (month == "12") {

var month = "1";

var year = parseInt(this.data.year) + 1;

} else {

var month = parseInt(this.data.month) + 1;

var showYear = this.data.year;

}

this.setData({

month: month,

year: year

})

},

onLoad: function () {

var mydate = new Date();

var year = mydate.getFullYear();

var month = mydate.getMonth() + 1;

date = mydate.getDate();

console.log("date", date)

var day = mydate.getDay();

var nbsp;

if ((date - day) <= 0) {

nbsp = day - date + 1;

} else {

nbsp = 7 - ((date - day) % 7) + 1;

}

console.log("nbsp" + nbsp);

console.log(day)

var monthDaySize;

if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) {

monthDaySize = 31;

} else if (month == 4 || month == 6 || month == 9 || month == 11) {

monthDaySize = 30;

} else if (month == 2) {

// 計算是否是閏年,如果是二月份則是29天

if ((year - 2000) % 4 == 0) {

monthDaySize = 29;

} else {

monthDaySize = 28;

}

};

this.setData({

year: year,

month: month,

nbsp: nbsp,

monthDaySize: monthDaySize,

date: date,

calendarSignData: calendarSignData

})

}

})

后臺 Java代碼

/**

* 根據用戶openid獲取用戶簽到信息(月簽到信息)

* @param openid

* @return

*/

@RequestMapping("queryUserMonthSign")

public ShopResult queryUserMonthSign(String openid,String data) {

MapretMap = new ConcurrentHashMap<>();

ListintegralDetails = shopIntegralDetailService.queryUserMonthSign(openid,data);

//獲取本月的天數

int monthDay = DateUtils.getCurrentMonthDay();

int[] i = new int[monthDay+1];

int calendarSignDay = 0;

for (int j = 0; j < monthDay; j++) {

for (ShopIntegralDetail shopIntegralDetail:

integralDetails) {

int day = Integer.valueOf(DateUtils.formatDate(shopIntegralDetail.getCreateDate(),"dd"));

if(j==day){

i[j] = day;

calendarSignDay += 1 ;

}

}

}

retMap.put("calendarSignData", i);//本月簽到天數

retMap.put("calendarSignDay", calendarSignDay);//本月簽到數據 為數組【0,1,2,3】

System.out.println(i);

return ShopResult.ok(retMap);

}

我這邊是每次積分簽到成功之后在積分記錄表中添加一條信息,所以在積分詳情表中查用戶簽到信息

SELECT

FROM shop_integral_detail a

where

a.openid = #{openid}

AND

DATE_FORMAT(a.create_date,'%Y-%m') = DATE_FORMAT(NOW(),'%Y-%m')

AND

a.integral_type=4

shop_integral_detail表 字段

idvarchar32

integralvarchar20積分

integral_typechar 類型0:系統贈送,1:購物送,2:邀請好友送,3:消費 4簽到

openidvarchar64 微信openid

create_datedatetime時間

總結

以上是生活随笔為你收集整理的日历签到 java_微信小程序签到 日历 每日签到积分加1的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。