|
@@ -5,7 +5,6 @@ import (
|
|
|
"app.yhyue.com/moapp/jybase/redis"
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
|
- "go.mongodb.org/mongo-driver/bson/primitive"
|
|
|
"leadGeneration/public"
|
|
|
"leadGeneration/vars"
|
|
|
)
|
|
@@ -52,8 +51,8 @@ func HasPower(userId string) bool {
|
|
|
return public.MainMysql.CountBySql("SELECT count(id) FROM bigmember_service_user WHERE s_userid=? AND s_serviceid =10 AND i_status =0", userId) > 0
|
|
|
}
|
|
|
|
|
|
-// HasPower 是否有超前订阅权限
|
|
|
-// bigMember.power=10
|
|
|
+// HasAheadPower 是否有超前订阅权限
|
|
|
+// 大会员、商机管理及老的超级订阅
|
|
|
func HasAheadPower(userId string) bool {
|
|
|
if userId == "" {
|
|
|
return false
|
|
@@ -70,31 +69,41 @@ func HasAheadPower(userId string) bool {
|
|
|
}
|
|
|
return nil
|
|
|
}()
|
|
|
- if vipStatus != nil && vipStatus.Status > 0 {
|
|
|
- return true
|
|
|
+ if vipStatus != nil {
|
|
|
+ //大会员、商机管理有权限
|
|
|
+ if vipStatus.Status > 0 || vipStatus.EntnicheStatus > 0 {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ //非超级订阅无权限
|
|
|
+ if vipStatus.VipStatus <= 0 {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ //判断超级订阅时间
|
|
|
+ res, _ := public.MQFW.FindById("user", userId, `{"l_vip_starttime":1}`)
|
|
|
+ if res != nil && len(*res) > 0 {
|
|
|
+ if common.Int64All((*res)["l_vip_starttime"]) < vars.Config.ContextOldVipLimit {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false
|
|
|
}
|
|
|
- id, _ := primitive.ObjectIDFromHex(userId)
|
|
|
- //查询权益
|
|
|
- query := map[string]interface{}{
|
|
|
- "$or": []map[string]interface{}{
|
|
|
- {
|
|
|
- "_id": id,
|
|
|
- "i_member_status": map[string]interface{}{
|
|
|
- "$gt": 0,
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- "_id": id,
|
|
|
- "i_vip_status": map[string]interface{}{
|
|
|
- "$gt": 0,
|
|
|
- },
|
|
|
- "l_vip_starttime": map[string]interface{}{
|
|
|
- "$lte": vars.Config.ContextOldVipLimit,
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
+ //无缓存
|
|
|
+ res, _ := public.MQFW.FindById("user", userId, `{"l_vip_starttime":1,"i_vip_status":1,"i_member_status":1,"s_phone":1,"s_m_phone":1}`)
|
|
|
+ if res != nil && len(*res) > 0 {
|
|
|
+ if common.IntAll("i_member_status") > 0 {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ if common.IntAll("l_vip_starttime") > 0 && common.Int64All((*res)["l_vip_starttime"]) < vars.Config.ContextOldVipLimit {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ //查询是否是商机管理付费用户
|
|
|
+ if phone, _ := common.If((*res)["s_phone"] != nil, (*res)["s_phone"], (*res)["s_m_phone"]).(string); phone != "" {
|
|
|
+ if count := public.MainMysql.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 {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- return public.MQFW.Count("user", query) > 0
|
|
|
+ return false
|
|
|
}
|
|
|
|
|
|
// HasSubscribe 是否有订阅词
|