浏览代码

Merge branch 'cygx_need_962' of http://8.136.199.33:3000/cxzhang/hongze_clpt into debug

xingzai 9 月之前
父节点
当前提交
5daad47c4e
共有 2 个文件被更改,包括 15 次插入1 次删除
  1. 2 0
      models/cygx_yanxuan_special_record.go
  2. 13 1
      services/cygx_yanxuan_special_company.go

+ 2 - 0
models/cygx_yanxuan_special_record.go

@@ -19,6 +19,7 @@ type CygxYanxuanSpecialRecord struct {
 	RegisterPlatform           int       // 来源 1小程序,2:网页
 	YanxuanSpecialId           int       // cygx_yanxuan_special 表主键ID
 	StopTime                   int       // 停留时间
+	PermissionCode             int       // 权限状态,1:有权限,0:无权限
 }
 
 func AddCygxYanxuanSpecialRecord(item *CygxYanxuanSpecialRecord) (lastId int64, err error) {
@@ -55,6 +56,7 @@ type CygxYanxuanSpecialRecordLog struct {
 	RegisterPlatform           int       // 来源 1小程序,2:网页
 	YanxuanSpecialId           int       // cygx_yanxuan_special 表主键ID
 	StopTime                   int       // 停留时间
+	PermissionCode             int       // 权限状态,1:有权限,0:无权限
 }
 
 func AddCygxYanxuanSpecialRecordLog(item *CygxYanxuanSpecialRecordLog) (lastId int64, err error) {

+ 13 - 1
services/cygx_yanxuan_special_company.go

@@ -75,6 +75,16 @@ func AddSpecialRecord(user *models.WxUserItem, specialId, stopTime int) (err err
 			go utils.SendAlarmMsg(fmt.Sprint("记录用户阅读时长 失败 AddSpecialRecord Err:"+err.Error(), "userId:", user.UserId, "specialId:", specialId), 2)
 		}
 	}()
+	//校验研选专栏权限,以及无权限的时候的对应状态码
+	havePower, e := GetYanxuanSpecialDetailUserPower(user)
+	if e != nil {
+		err = errors.New("GetYanxuanSpecialDetailUserPower, Err: " + e.Error())
+		return
+	}
+	var permissionCode int
+	if havePower {
+		permissionCode = 1
+	}
 	var sellerName string
 	//获取销售信息
 	sellerName, _ = GetSellerName(user)
@@ -106,6 +116,7 @@ func AddSpecialRecord(user *models.WxUserItem, specialId, stopTime int) (err err
 		item.RegisterPlatform = utils.REGISTER_PLATFORM
 		item.YanxuanSpecialId = specialId
 		item.StopTime = stopTime
+		item.PermissionCode = permissionCode
 		_, e = models.AddCygxYanxuanSpecialRecord(item) // 添加历史记录
 		if e != nil {
 			err = errors.New("AddCygxYanxuanSpecialRecord, Err: " + e.Error())
@@ -159,7 +170,8 @@ func AddSpecialRecord(user *models.WxUserItem, specialId, stopTime int) (err err
 	itemLog.RegisterPlatform = utils.REGISTER_PLATFORM
 	itemLog.YanxuanSpecialId = specialId
 	itemLog.StopTime = stopTime
-	_, e := models.AddCygxYanxuanSpecialRecordLog(itemLog) // 添加历史记录
+	itemLog.PermissionCode = permissionCode
+	_, e = models.AddCygxYanxuanSpecialRecordLog(itemLog) // 添加历史记录
 	if e != nil {
 		err = errors.New("AddCygxYanxuanSpecialRecordLog, Err: " + e.Error())
 		return