Pārlūkot izejas kodu

wip:增加免费用户省份订阅包

wangkaiyue 1 gadu atpakaļ
vecāks
revīzija
7c51697db4
2 mainītis faili ar 27 papildinājumiem un 21 dzēšanām
  1. 8 5
      entity/power.go
  2. 19 16
      service/power.go

+ 8 - 5
entity/power.go

@@ -17,7 +17,7 @@ const (
 
 )
 
-//免费权益相关
+// 免费权益相关
 type Free struct {
 	IsFree                bool  //是否是免费用户
 	FreeHasKey            bool  //免费用户是否有关键词
@@ -34,9 +34,12 @@ type Free struct {
 	Apppushunread         int64 //已读未读
 	OjyLength             int64 //ojy的长度
 	Original              int64 //查看原文次数/每月
+	ProvincePackageStatus int   //省份订阅包状态
+	ProvinceStartTime     int64 //省份订阅开始时间
+	ProvinceEndTime       int64 //省份订阅到期时间
 }
 
-//超级订阅相关
+// 超级订阅相关
 type Vip struct {
 	Status          int64   //超级订阅状态
 	StartTime       int64   //超级订阅开始时间戳
@@ -53,7 +56,7 @@ type Vip struct {
 	Original        int64   //查看原文次数/每月
 }
 
-//大会员相关
+// 大会员相关
 type Member struct {
 	Status          int64   //大会员状态
 	StartTime       int64   //开始时间戳
@@ -75,7 +78,7 @@ type Member struct {
 	Original        int64   //查看原文次数/每月
 }
 
-//商机管理相关
+// 商机管理相关
 type Entniche struct {
 	Status      int64 //商机管理相关
 	StartTime   int64 //开始时间戳
@@ -88,7 +91,7 @@ type Entniche struct {
 	Original    int64 //查看原文次数/每月
 }
 
-//企业相关
+// 企业相关
 type Ent struct {
 	Name                string //企业名称
 	EntRoleId           int64  //商机管理角色:1:企业管理员;2:部门管理员

+ 19 - 16
service/power.go

@@ -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