Эх сурвалжийг харах

feat:p618 subscrbepay 超级订阅支付后发送提醒默认地区用户设置订阅地区消息

fuwencai 7 сар өмнө
parent
commit
a37a9c82a2

+ 2 - 1
src/config.json

@@ -63,7 +63,8 @@
     "weChatUrlEnt": "/jy_mobile/project/joined/list?identity=ent",
     "weChatUrl": "/jy_mobile/project/joined/list",
     "agencyInfo": "/jy_mobile/message/todoList?msgType=11",
-    "report_analysis": "/jyapp/big/page/report_analysis?id=%s"
+    "report_analysis": "/jyapp/big/page/report_analysis?id=%s",
+    "subVipSetPage": "/front/vipsubscribe/toSubVipSetPage?vSwitch=v"
   },
   "jy_activeset": {
     "activitystartcode": "3201000000",

+ 13 - 3
src/jfw/modules/subscribepay/src/config.json

@@ -176,9 +176,6 @@
       "weChatUrl": ""
     },
     "saleDep": {
-      "040000": true,
-      "040100": true,
-      "040200": true
     }
   },
   "payRaffle": {
@@ -218,5 +215,18 @@
   "orderEmailReminder": {
     "qmx": "duxin@topnet.net.cn",
     "jianyu": "duxin@topnet.net.cn"
+  },
+  "remindSubMsg": {
+    "open": true,
+    "siteMsg": {
+      "callPlatform": "subscribepay",
+      "msgType": 2,
+      "title": "订阅区域设置提醒",
+      "content": "您可点击前往设置订阅区域、关键词等条件,精准接收更多商机",
+      "link": "/page_workDesktop/work-bench/app/big/big_subscribe?vt=v",
+      "androidUrl": "/jyapp/vipsubscribe/toSubVipSetPage?vSwitch=v",
+      "iosUrl": "/jyapp/vipsubscribe/toSubVipSetPage?vSwitch=v",
+      "weChatUrl": "/front/sess/%s"
+    }
   }
 }

+ 16 - 0
src/jfw/modules/subscribepay/src/config/config.go

@@ -151,7 +151,23 @@ type config struct {
 	} `json:"payRaffle"`
 	NewOrderTime       int64             `json:"newOrderTime"`
 	OrderEmailReminder map[string]string `json:"orderEmailReminder"`
+	RemindSubMsg       SiteMsgStruct     `json:"remindSubMsg"` // p618 提醒超级订阅新购用户无免费设置被默认为北京的用户设置地区
 }
+
+type SiteMsgStruct struct {
+	Open    bool `json:"open"`
+	SiteMsg struct {
+		CallPlatform string `json:"callPlatform"`
+		MsgType      int    `json:"msgType"`
+		Title        string `json:"title"`
+		Content      string `json:"content"`
+		Link         string `json:"link"`
+		AndroidUrl   string `json:"androidUrl"`
+		IosUrl       string `json:"iosUrl"`
+		WeChatUrl    string `json:"weChatUrl"`
+	} `json:"siteMsg"`
+}
+
 type mgoConf struct {
 	Address           string
 	Size              int

+ 41 - 2
src/jfw/modules/subscribepay/src/entity/subscribeVip.go

@@ -218,8 +218,9 @@ func (this *vipSubscribeStruct) PayCallBack(param *CallBackParam) bool {
 	//A.购买超级订阅前是免费用户:则区域默认为免费订阅区域,免费区域为空则默认为北京;
 	//B.购买超级订阅前是省份订阅包用户:则区域默认为省份订阅包区域,如超级订阅可订阅省份<省份订阅包可用省份,则随机展示省份订阅包的部分区域;
 	//C.购买超级订阅后,按照默认区域进行推送。
+	var isDefaultArea bool
 	if vmsg.OrderType == 1 { //新订单
-		vmsg.Area = getUserArea(userId, vmsg.NewBuyset.AreaCount) // 处理订阅区域
+		vmsg.Area, isDefaultArea = getUserArea(userId, vmsg.NewBuyset.AreaCount) // 处理订阅区域
 		flag = JyVipSubStruct.StartSubVip(userid, vmsg, startTime, endTime, false, positionType, entId, entUserId)
 	} else if vmsg.OrderType == 2 { //仅续费
 		flag = JyVipSubStruct.RenewSubVip(userid, qutil.ObjToString((*orderdata)["vip_endtime"]))
@@ -307,6 +308,41 @@ func (this *vipSubscribeStruct) PayCallBack(param *CallBackParam) bool {
 			}
 			equityActive.SendPayRaffleMsg()
 		}
+		if config.Config.RemindSubMsg.Open && isDefaultArea { // p618
+			// 取mgoid 判断订单里的id是不是mgo 不是的话,取缓存中的信息  如果取到mgoid再发消息
+			mgoUid := ""
+			if mgo.IsObjectIdHex(userId) {
+				mgoUid = userId
+			} else {
+				orderKey := fmt.Sprintf("order_%s", orderCode)
+				rs := redis.Get("other", orderKey)
+				info := qutil.ObjToMap(rs)
+				if info != nil && len(*info) > 0 {
+					log.Println("RemindSubMsg 获取到redis保存的用户身份信息:", orderKey, info)
+					mgoUid = qutil.ObjToString((*info)["mgoId"])
+				}
+			}
+			if mgoUid != "" {
+				siteMsg := config.Config.RemindSubMsg.SiteMsg
+				sessData := fmt.Sprintf("%s,_id,%s,subVipSetPage", mgoUid, now)
+
+				weChatUrl := fmt.Sprintf(siteMsg.WeChatUrl, util.Se_Topnet.EncodeString(sessData))
+				// 发送站内信
+				p := util.MessageParam{
+					UserIds:    mgoUid,
+					Title:      siteMsg.Title,
+					Content:    siteMsg.Content,
+					MsgType:    siteMsg.MsgType,
+					SendMode:   2,
+					Link:       siteMsg.Link,
+					IosUrl:     siteMsg.IosUrl,
+					AndroidUrl: siteMsg.AndroidUrl,
+					WeChatUrl:  weChatUrl,
+				}
+
+				util.EquityActiveSend.SendStationMessages(p)
+			}
+		}
 
 	}
 	return flag
@@ -315,7 +351,8 @@ func (this *vipSubscribeStruct) PayCallBack(param *CallBackParam) bool {
 // 获取用户设置的区域
 // A.购买超级订阅前是免费用户:则区域默认为免费订阅区域,免费区域为空则默认为北京;
 // B.购买超级订阅前是省份订阅包用户:则区域默认为省份订阅包区域,如超级订阅可订阅省份<省份订阅包可用省份,则随机展示省份订阅包的部分区域;
-func getUserArea(userId string, areaCount int) (area *map[string]interface{}) {
+// isDefaultArea 是否是默认的区域  true:是
+func getUserArea(userId string, areaCount int) (area *map[string]interface{}, isDefaultArea bool) {
 	if areaCount == -1 {
 		area = &map[string]interface{}{}
 		return
@@ -347,7 +384,9 @@ func getUserArea(userId string, areaCount int) (area *map[string]interface{}) {
 	o_area := qutil.ObjToMap((*ojy)["o_area"])
 	if o_area != nil && len(*o_area) > 0 {
 		area = o_area
+		return
 	}
+	isDefaultArea = true // 默认的区域
 	return
 }