|
@@ -159,12 +159,12 @@ func TimerSwordFish() {
|
|
sub64 := (endDate - next64) / (24 * 3600)
|
|
sub64 := (endDate - next64) / (24 * 3600)
|
|
if sub64 == 0 {
|
|
if sub64 == 0 {
|
|
//自动扣费
|
|
//自动扣费
|
|
- doSubCredit(tmp["s_userid"].(string), tmp["s_uid"].(string), typeName, code, &next)
|
|
|
|
|
|
+ doSubCredit(tmp["s_uid"].(string), tmp["s_umid"].(string), typeName, code, &next)
|
|
} else {
|
|
} else {
|
|
//提示
|
|
//提示
|
|
for _, v := range swordfish_tipBeforeDays {
|
|
for _, v := range swordfish_tipBeforeDays {
|
|
if int64(v) == sub64 {
|
|
if int64(v) == sub64 {
|
|
- SendMsgWebAndWx(swordfish_dueTitle, fmt.Sprintf(swordfish_due, v), tmp["s_userid"].(string), tmp["s_uid"].(string))
|
|
|
|
|
|
+ SendMsgWebAndWx(swordfish_dueTitle, fmt.Sprintf(swordfish_due, v), tmp["s_uid"].(string), tmp["s_umid"].(string))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -182,8 +182,8 @@ func TimerSwordFish() {
|
|
}
|
|
}
|
|
|
|
|
|
//自动扣费
|
|
//自动扣费
|
|
-func doSubCredit(userId, uid, typeName, code string, next *time.Time) {
|
|
|
|
- user := mongodb.FindById("user", uid, `{"i_credit":1,"o_msgset."`+typeName+`.i_status":1,"_id":0}`)
|
|
|
|
|
|
+func doSubCredit(userId, umid, typeName, code string, next *time.Time) {
|
|
|
|
+ user := mongodb.FindById("user", userId, `{"i_credit":1,"o_msgset."`+typeName+`.i_status":1,"_id":0}`)
|
|
if *user != nil {
|
|
if *user != nil {
|
|
util.Try(func() {
|
|
util.Try(func() {
|
|
i_status := util.IntAllDef((*user)["o_msgset"].(map[string]interface{})[typeName].(map[string]interface{})["i_status"], -1)
|
|
i_status := util.IntAllDef((*user)["o_msgset"].(map[string]interface{})[typeName].(map[string]interface{})["i_status"], -1)
|
|
@@ -198,8 +198,8 @@ func doSubCredit(userId, uid, typeName, code string, next *time.Time) {
|
|
if bsub { //扣分操作
|
|
if bsub { //扣分操作
|
|
newDate := next.AddDate(0, 1, 0)
|
|
newDate := next.AddDate(0, 1, 0)
|
|
creditDoc := map[string]interface{}{
|
|
creditDoc := map[string]interface{}{
|
|
- "s_uid": uid,
|
|
|
|
- "s_userid": userId,
|
|
|
|
|
|
+ "s_uid": userId,
|
|
|
|
+ "s_umid": umid,
|
|
"s_code": code,
|
|
"s_code": code,
|
|
"i_type": 0,
|
|
"i_type": 0,
|
|
"l_date": next.Unix(),
|
|
"l_date": next.Unix(),
|
|
@@ -208,13 +208,13 @@ func doSubCredit(userId, uid, typeName, code string, next *time.Time) {
|
|
}
|
|
}
|
|
if creditlog.Save(creditDoc) {
|
|
if creditlog.Save(creditDoc) {
|
|
//发送微信通知扣积分成功
|
|
//发送微信通知扣积分成功
|
|
- SendMsgWebAndWx(swordfish_payTitle, fmt.Sprintf(swordfish_pay, -codeNum, restNum, util.FormatDate(&newDate, util.Date_Full_Layout)), userId, uid)
|
|
|
|
|
|
+ SendMsgWebAndWx(swordfish_payTitle, fmt.Sprintf(swordfish_pay, -codeNum, restNum, util.FormatDate(&newDate, util.Date_Full_Layout)), userId, umid)
|
|
}
|
|
}
|
|
} else { //暂停操作
|
|
} else { //暂停操作
|
|
//更新操作
|
|
//更新操作
|
|
if mongodb.Update("user", `{"_id":"`+userId+`"}`, `{"$set":{"o_msgset.`+typeName+`.i_status":0}}`, false, false) {
|
|
if mongodb.Update("user", `{"_id":"`+userId+`"}`, `{"$set":{"o_msgset.`+typeName+`.i_status":0}}`, false, false) {
|
|
//暂停通知,因积分不够
|
|
//暂停通知,因积分不够
|
|
- SendMsgWebAndWx(swordfish_closeTitle, swordfish_close, userId, uid)
|
|
|
|
|
|
+ SendMsgWebAndWx(swordfish_closeTitle, swordfish_close, userId, umid)
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
@@ -227,7 +227,7 @@ func doSubCredit(userId, uid, typeName, code string, next *time.Time) {
|
|
}
|
|
}
|
|
|
|
|
|
//发送微信和站内信通知
|
|
//发送微信和站内信通知
|
|
-func SendMsgWebAndWx(title, content, userId, uid string) {
|
|
|
|
|
|
+func SendMsgWebAndWx(title, content, userId, umid string) {
|
|
m := &msg.Msg{
|
|
m := &msg.Msg{
|
|
Msgtype: 1,
|
|
Msgtype: 1,
|
|
Title: title,
|
|
Title: title,
|
|
@@ -235,6 +235,6 @@ func SendMsgWebAndWx(title, content, userId, uid string) {
|
|
ReceiveId: userId,
|
|
ReceiveId: userId,
|
|
}
|
|
}
|
|
go m.SaveMsg()
|
|
go m.SaveMsg()
|
|
- go creditrpc.SendManagerNotifyMsg(&qrpc.NotifyMsg{Openid: uid, Title: title, Detail: "管理员", Remark: content})
|
|
|
|
|
|
+ go creditrpc.SendManagerNotifyMsg(&qrpc.NotifyMsg{Openid: umid, Title: title, Detail: "管理员", Remark: content})
|
|
|
|
|
|
}
|
|
}
|