|
@@ -16,12 +16,11 @@ import (
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
|
)
|
|
|
|
|
|
-//权益
|
|
|
+// 权益
|
|
|
type PowerService struct {
|
|
|
*entity.Conn
|
|
|
}
|
|
|
|
|
|
-//
|
|
|
func NewPower(conn *entity.Conn) *PowerService {
|
|
|
return &PowerService{
|
|
|
conn,
|
|
@@ -39,14 +38,14 @@ var level_map = map[int64]string{
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
- 权益相关
|
|
|
- userid //mongodb用户id
|
|
|
- baseUserId //base_user用户id
|
|
|
- accountId //账户id
|
|
|
- entId =5; //企业id
|
|
|
- positionType //职位类型 0个人 1企业
|
|
|
- positionId //职位id
|
|
|
- 切换到企业身份后,session中userId存的是企业雇员的职位id,个人身份,userId还是原来mgo库里的_id
|
|
|
+权益相关
|
|
|
+userid //mongodb用户id
|
|
|
+baseUserId //base_user用户id
|
|
|
+accountId //账户id
|
|
|
+entId =5; //企业id
|
|
|
+positionType //职位类型 0个人 1企业
|
|
|
+positionId //职位id
|
|
|
+切换到企业身份后,session中userId存的是企业雇员的职位id,个人身份,userId还是原来mgo库里的_id
|
|
|
*/
|
|
|
func (this *PowerService) Power(userid string, baseUserId, accountId, entId, positionType, positionId int64) *entity.Power {
|
|
|
logx.Info("-----req------", userid, baseUserId, accountId, entId, positionType, positionId)
|
|
@@ -151,6 +150,10 @@ func (this *PowerService) Power(userid string, baseUserId, accountId, entId, pos
|
|
|
//IsNewFreeTimeCell dev3.6.4版本之前发了个紧急版本处理老用户订阅问题,i_newfree字段必须用户选择地区才能生成,不能作为判断是否是新用户得唯一标识,在此版本添加了常量:IsNewFreeTimeCell作为判断标准;--ws
|
|
|
free.IsUpgrade = true //新免费用户
|
|
|
}
|
|
|
+ //省份订阅包
|
|
|
+ free.ProvincePackageStatus = common.IntAll((*data)["i_ppstatus"])
|
|
|
+ free.ProvinceStartTime = common.Int64All((*data)["l_areaStart_p"])
|
|
|
+ free.ProvinceEndTime = common.Int64All((*data)["l_areaEnd_p"])
|
|
|
//超级订阅
|
|
|
vipStatus := common.Int64All((*data)["i_vip_status"])
|
|
|
vipStartTime := common.Int64All((*data)["l_vip_starttime"])
|
|
@@ -433,8 +436,8 @@ func (this *PowerService) Power(userid string, baseUserId, accountId, entId, pos
|
|
|
return &userPower
|
|
|
}
|
|
|
|
|
|
-//免费用户体验会员功能权限
|
|
|
-//免费用户在企业画像/采购单位画像/附件下载留资 留资成功后用户才有功能使用次数
|
|
|
+// 免费用户体验会员功能权限
|
|
|
+// 免费用户在企业画像/采购单位画像/附件下载留资 留资成功后用户才有功能使用次数
|
|
|
func FreeExperience(userId string, positionId, positionType int64) (int64, int64, int64) {
|
|
|
if positionType == 1 {
|
|
|
userId = strconv.Itoa(int(positionId))
|
|
@@ -445,7 +448,7 @@ func FreeExperience(userId string, positionId, positionType int64) (int64, int64
|
|
|
return entPortKey, buyerPortKey, fileKey
|
|
|
}
|
|
|
|
|
|
-//获取附件下载次数
|
|
|
+// 获取附件下载次数
|
|
|
func FileNum(uk, userid string, positionId, positionType int64) int64 {
|
|
|
if positionType == 1 {
|
|
|
userid = strconv.Itoa(int(positionId))
|
|
@@ -478,7 +481,7 @@ func (this *PowerService) GetEntnicheUserId(entId int64, phone string) int64 {
|
|
|
return -1
|
|
|
}
|
|
|
|
|
|
-//是否有关键词
|
|
|
+// 是否有关键词
|
|
|
func HasKey(a_items []map[string]interface{}) bool {
|
|
|
for _, v := range a_items {
|
|
|
akey, _ := v["a_key"].([]interface{})
|
|
@@ -489,7 +492,7 @@ func HasKey(a_items []map[string]interface{}) bool {
|
|
|
return false
|
|
|
}
|
|
|
|
|
|
-//获取redis key
|
|
|
+// 获取redis key
|
|
|
func GetRedisName(positionId int64) string {
|
|
|
if positionId == 0 {
|
|
|
return ""
|
|
@@ -497,7 +500,7 @@ func GetRedisName(positionId int64) string {
|
|
|
return fmt.Sprintf("user_power_info_%v", positionId)
|
|
|
}
|
|
|
|
|
|
-//清除redis缓存
|
|
|
+// 清除redis缓存
|
|
|
func (this *PowerService) DelRedisPower(positionId int64) bool {
|
|
|
if positionId == 0 {
|
|
|
return false
|