|
@@ -5,18 +5,21 @@ import (
|
|
|
"fmt"
|
|
|
"log"
|
|
|
"net/rpc"
|
|
|
+ "strconv"
|
|
|
"strings"
|
|
|
"time"
|
|
|
|
|
|
- "app.yhyue.com/moapp/message/config"
|
|
|
-
|
|
|
+ "app.yhyue.com/moapp/MessageCenter/rpc/type/message"
|
|
|
"app.yhyue.com/moapp/jybase/common"
|
|
|
"app.yhyue.com/moapp/jybase/date"
|
|
|
"app.yhyue.com/moapp/jybase/go-logger/logger"
|
|
|
jrpc "app.yhyue.com/moapp/jybase/rpc"
|
|
|
+ "app.yhyue.com/moapp/message/config"
|
|
|
"app.yhyue.com/moapp/message/db"
|
|
|
"app.yhyue.com/moapp/message/model"
|
|
|
+ . "app.yhyue.com/moapp/message/rpc"
|
|
|
mrpc "app.yhyue.com/moapp/message/rpc"
|
|
|
+ . "bp.jydev.jianyu360.cn/BaseService/pushpkg/p"
|
|
|
"github.com/gogf/gf/v2/os/gcfg"
|
|
|
"github.com/gogf/gf/v2/os/gctx"
|
|
|
"github.com/gogf/gf/v2/util/gconv"
|
|
@@ -43,7 +46,7 @@ func Task(msg *model.Message) {
|
|
|
"user_id": baseUserId,
|
|
|
}
|
|
|
//判断用户是否有任务
|
|
|
- data, ok := db.Mgo.FindOne("user", map[string]interface{}{"base_user_id": baseUserId})
|
|
|
+ data, ok := db.Mgo.FindById("user", msg.E_userId, `{"l_registedate":1}`)
|
|
|
if data == nil || len(*data) == 0 || !ok {
|
|
|
logger.Info(fmt.Sprintf("未找到用户%s,无法增加积分%v。", msg.E_userId, code))
|
|
|
return
|
|
@@ -160,10 +163,27 @@ func Task(msg *model.Message) {
|
|
|
endtime, _ := time.Parse(date.Date_Full_Layout, end_time)
|
|
|
if finishStatus && success_status == 0 && time.Now().Before(endtime) {
|
|
|
//判断是否完成所有任务且开启确认挑战
|
|
|
- mrpc.SubVipHarvest(msg.E_userId, 7, "")
|
|
|
- db.Tidb.Update("integral_task", map[string]interface{}{"id": gconv.Int64(taskId)}, map[string]interface{}{
|
|
|
- "success_status": 1,
|
|
|
- })
|
|
|
+ if mrpc.SubVipHarvest(msg.E_userId, 7, "") == nil {
|
|
|
+ if db.Tidb.Update("integral_task", map[string]interface{}{"id": gconv.Int64(taskId)}, map[string]interface{}{
|
|
|
+ "success_status": 1,
|
|
|
+ }) {
|
|
|
+ go func() {
|
|
|
+ wxUrl := "/front/sess/" + Se.EncodeString(msg.E_userId+",_id,"+strconv.Itoa(int(time.Now().Unix()))+",") + "__" + Se.EncodeString(config.PushConfig.Messages.GetVip.MobileUrl)
|
|
|
+ appUrl := "/jyapp/free/sess/" + Se.EncodeString(msg.E_userId+",_id,"+strconv.Itoa(int(time.Now().Unix()))+",") + "__" + Se.EncodeString(config.PushConfig.Messages.GetVip.MobileUrl)
|
|
|
+ SendMsg("获赠七天超级订阅服务", &message.MultipleSaveMsgReq{
|
|
|
+ UserIds: msg.E_userId,
|
|
|
+ Title: config.PushConfig.Messages.GetVip.Title,
|
|
|
+ Content: config.PushConfig.Messages.GetVip.Content,
|
|
|
+ MsgType: config.PushConfig.Messages.GetVip.MsgType,
|
|
|
+ Link: config.PushConfig.Messages.GetVip.PcUrl + "," + config.PushConfig.Messages.GetVip.MobileUrl + "," + config.PushConfig.Messages.GetVip.MobileUrl,
|
|
|
+ Appid: config.PushConfig.Messages.GetVip.Appid,
|
|
|
+ AppPushUrl: appUrl,
|
|
|
+ WxPushUrl: config.PushConfig.Webdomain + wxUrl,
|
|
|
+ IosPushUrl: appUrl,
|
|
|
+ })
|
|
|
+ }()
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|