Jelajahi Sumber

wip:订阅信息

WH01243 3 tahun lalu
induk
melakukan
aa203e60d0

+ 17 - 0
src/jfw/modules/common/src/qfw/util/jy/bigVipPower.go

@@ -88,6 +88,23 @@ func ClearBigVipUserPower(userId string) bool {
 	cacheKey := fmt.Sprintf(PowerCacheKey, userId)
 	return redis.Del(PowerCacheDb, cacheKey)
 }
+//获取商机管理个人基本信息
+func GetEntnicheState(userId string, mysql *mysql.Mysql, mg MongodbSim) *BigVipBaseMsg {
+    userPower := BigVipBaseMsg{}
+    userPower.EntnicheStatus = 0
+    //手机号
+    data, ok := mg.FindById("user", userId, `{"s_phone":1,"s_m_phone":1,i_member_status":1,"i_member_give":1,"s_member_mainid":1,"i_member_sub_status":1,"i_member_trial":1,"i_vip_status":1,"o_vipjy":1,"o_jy":1,"l_registedate":1}`)
+    if ok && *data != nil && len(*data) > 0 {
+        //查询是否是商机管理付费用户
+        phone, _ := qutil.If((*data)["s_phone"] != nil, (*data)["s_phone"], (*data)["s_m_phone"]).(string)
+        if phone != "" {
+            if count := mysql.CountBySql(`SELECT count(1) FROM entniche_user u LEFT JOIN entniche_info i ON u.ent_id=i.id WHERE u.phone=? and u.power=1 and i.status=1`, phone); count > 0 {
+                userPower.EntnicheStatus = 1
+            }
+        }
+    }
+    return &userPower
+}
 
 //获取大会员个人基本信息
 func GetBigVipUserBaseMsg(userId string, mysql *mysql.Mysql, mg MongodbSim) *BigVipBaseMsg {

+ 1 - 1
src/jfw/modules/publicapply/src/subscribePush/service/pushList.go

@@ -57,7 +57,7 @@ func (sp *SubscribePush) VipSwitch() {
 			sp.SetSession(jy.SwitchService.SessionKey, jy.SwitchService.Member)
 			switchOk = true
 		} else if vt == jy.EntnicheFlag {
-			vipMsg := jy.GetBigVipUserBaseMsg(userId, db.Mysql, db.Mgo)
+			vipMsg := jy.GetEntnicheState(userId, db.Mysql, db.Mgo)
 			if vipMsg.EntnicheStatus <= 0 {
 				return nil, fmt.Errorf("未购买商机管理")
 			}