|
@@ -1,4 +1,4 @@
|
|
-//未支付订单提醒
|
|
|
|
|
|
+// 未支付订单提醒
|
|
package util
|
|
package util
|
|
|
|
|
|
import (
|
|
import (
|
|
@@ -260,6 +260,72 @@ func (m *msgRemind) DistributionSuccess(orderId int, userId string, price int, p
|
|
log.Println("分销消息", value)
|
|
log.Println("分销消息", value)
|
|
}()
|
|
}()
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ *文库会员订单支付成功以后,消息通知处理
|
|
|
|
+ *@param orderId 订单id
|
|
|
|
+ *@param orderCode 订单编号
|
|
|
|
+ *@param userId 用户id
|
|
|
|
+ *@param createTime 购买时间
|
|
|
|
+ *@param vipType 1:购买 2:续费
|
|
|
|
+ */
|
|
|
|
+func (m *msgRemind) DocPaySuccess(orderId int, orderCode, userId, createTime string, vipType int) {
|
|
|
|
+ go func() {
|
|
|
|
+ defer util.Catch()
|
|
|
|
+ log.Println("文库会员支付成功以后,消息提醒处理", orderId, orderCode, userId, createTime)
|
|
|
|
+ m.unpaidOrders.Delete(orderId)
|
|
|
|
+ user := Compatible.Select(userId, `{"s_m_openid":1,"s_jpushid":1,"s_opushid":1,"s_appponetype":1,"i_ispush":1,"l_doc_endtime":1}`)
|
|
|
|
+ if user == nil || len(*user) == 0 {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ isPushWx := util.IntAllDef((*user)["i_ispush"], 1)
|
|
|
|
+ s_m_openid, _ := (*user)["s_m_openid"].(string)
|
|
|
|
+ s_jpushid, _ := (*user)["s_jpushid"].(string)
|
|
|
|
+ s_opushid, _ := (*user)["s_opushid"].(string)
|
|
|
|
+ s_appponetype, _ := (*user)["s_appponetype"].(string)
|
|
|
|
+ log.Println("文库会员支付成功,推送消息", userId, "s_m_openid", s_m_openid, "s_jpushid", s_jpushid, "s_opushid", s_opushid, "s_appponetype", s_appponetype)
|
|
|
|
+ wxPushOk := false
|
|
|
|
+ if isPushWx == 1 && s_m_openid != "" {
|
|
|
|
+ l_doc_endtime := (*user)["l_doc_endtime"]
|
|
|
|
+ expireTime := FormatDateWithObj(&l_doc_endtime, Date_Short_Layout)
|
|
|
|
+ wxPushOk, _ = qrpc.WxSendTmplMsg(Config.Weixinrpc, &qrpc.WxTmplMsg{
|
|
|
|
+ OpenId: s_m_openid,
|
|
|
|
+ TplId: MessageConfig.WxTpl_PaySuccess.Id,
|
|
|
|
+ TmplData: map[string]*qrpc.TmplItem{
|
|
|
|
+ "keyword1": &qrpc.TmplItem{
|
|
|
|
+ Value: fmt.Sprintf(MessageConfig.WxTpl_PaySuccess.Keyword1.Value, "剑鱼文库会员"+m.getDocMemberType(vipType)),
|
|
|
|
+ },
|
|
|
|
+ "keyword2": &qrpc.TmplItem{
|
|
|
|
+ Value: orderCode,
|
|
|
|
+ },
|
|
|
|
+ "keyword3": &qrpc.TmplItem{
|
|
|
|
+ Value: strings.Split(createTime, " ")[0],
|
|
|
|
+ },
|
|
|
|
+ "keyword4": &qrpc.TmplItem{
|
|
|
|
+ Value: expireTime,
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ //Url: Config.WebDomain + "/front/sess/" + Se_Topnet.EncodeString(userId+util.If(IsObjectIdHex(userId), ",_id,", ",positionId,").(string)+strconv.Itoa(int(time.Now().Unix()))+",msgremind") + "__" + hex.EncodeToString([]byte("type=paid")),
|
|
|
|
+ })
|
|
|
|
+ log.Println("剑鱼文库会员支付成功,微信推送", userId, wxPushOk)
|
|
|
|
+ }
|
|
|
|
+ if !wxPushOk && (s_opushid != "" || s_jpushid != "") {
|
|
|
|
+ appPushOk := qrpc.AppPush(Config.AppPushServiceRpc, map[string]interface{}{
|
|
|
|
+ "phoneType": s_appponetype,
|
|
|
|
+ "otherPushId": s_opushid,
|
|
|
|
+ "jgPushId": s_jpushid,
|
|
|
|
+ //"url": "/jyapp/free/sess/" + Se_Topnet.EncodeString(userId+util.If(IsObjectIdHex(userId), ",_id,", ",positionId,").(string)+strconv.Itoa(int(time.Now().Unix()))+",msgremind") + "__" + hex.EncodeToString([]byte(fmt.Sprintf("type=paid"))),
|
|
|
|
+ "userId": userId,
|
|
|
|
+ "type": "vipNotice",
|
|
|
|
+ "descript": fmt.Sprintf(MessageConfig.App_PaySuccess, orderCode),
|
|
|
|
+ "title": "剑鱼提醒",
|
|
|
|
+ "category": "服务通知_订单",
|
|
|
|
+ })
|
|
|
|
+ log.Println("剑鱼文库会员支付成功,app推送", userId, appPushOk)
|
|
|
|
+ }
|
|
|
|
+ }()
|
|
|
|
+}
|
|
|
|
+
|
|
func (m *msgRemind) getExpireTime() int64 {
|
|
func (m *msgRemind) getExpireTime() int64 {
|
|
order_countdown := Config.OrderCountdown //配置文件读取
|
|
order_countdown := Config.OrderCountdown //配置文件读取
|
|
if strings.Contains(util.ObjToString(order_countdown), "h") {
|
|
if strings.Contains(util.ObjToString(order_countdown), "h") {
|
|
@@ -282,6 +348,15 @@ func (m *msgRemind) getVipType(vipType int) string {
|
|
return ""
|
|
return ""
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+func (m *msgRemind) getDocMemberType(vipType int) string {
|
|
|
|
+ switch vipType {
|
|
|
|
+ case 1:
|
|
|
|
+ return ""
|
|
|
|
+ case 2:
|
|
|
|
+ return "(续费)"
|
|
|
|
+ }
|
|
|
|
+ return ""
|
|
|
|
+}
|
|
func (m *msgRemind) run() {
|
|
func (m *msgRemind) run() {
|
|
duration := TimeTaskConfig.UnpaidRemind.RemindDuration
|
|
duration := TimeTaskConfig.UnpaidRemind.RemindDuration
|
|
if duration == 0 {
|
|
if duration == 0 {
|