Browse Source

no message

xingzai 1 year ago
parent
commit
ca17010171
2 changed files with 6 additions and 26 deletions
  1. 0 26
      models/user_yanxuan_permission.go
  2. 6 0
      services/user_permission.go

+ 0 - 26
models/user_yanxuan_permission.go

@@ -42,20 +42,6 @@ type CygxUserYanxuanPermissionLog struct {
 	ModifyTime              time.Time `description:"修改时间"`
 }
 
-// 添加
-func AddCygxUserYanxuanPermission(item *CygxUserYanxuanPermission) (lastId int64, err error) {
-	o := orm.NewOrm()
-	lastId, err = o.Insert(item)
-	return
-}
-
-// 添加日志记录
-func AddCygxUserYanxuanPermissionLog(item *CygxUserYanxuanPermissionLog) (lastId int64, err error) {
-	o := orm.NewOrm()
-	lastId, err = o.Insert(item)
-	return
-}
-
 // 根据用户ID获取是否开通过研选权限
 func GetCygxUserYanxuanPermissionCountByUserId(userId int) (count int, err error) {
 	o := orm.NewOrm()
@@ -64,18 +50,6 @@ func GetCygxUserYanxuanPermissionCountByUserId(userId int) (count int, err error
 	return
 }
 
-// 将研选权限状态改为未开通
-func UpdateCygxUserYanxuanPermissionClose(userId int) (err error) {
-	o := orm.NewOrm()
-	sql := ` UPDATE cygx_user_yanxuan_permission
-			SET
-			  status ='未开通',
-			  modify_time = ?
-			WHERE user_id = ? `
-	_, err = o.Raw(sql, time.Now(), userId).Exec()
-	return
-}
-
 // 列表
 func GetCygxUserYanxuanPermissionList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxUserYanxuanPermission, err error) {
 	o := orm.NewOrm()

+ 6 - 0
services/user_permission.go

@@ -88,6 +88,12 @@ func GetUserRaiPermissionInfo(userId, companyId int) (authInfo models.UserPermis
 
 // 查询研选的权限状态
 func GetUserRaiPermissionYanXuanInfo(user *models.WxUserItem) (hasPermission int, err error) {
+	//判断用户是否开通了个人研选权限
+	mfyxUserPermissionTotal := GetMfyxUserPermissionTotal(user.UserId)
+	if mfyxUserPermissionTotal == 1 {
+		hasPermission = 1
+		return
+	}
 	var condition string
 	var pars []interface{}
 	condition = " AND company_id = ?  AND status  IN ('正式','试用')  AND chart_permission_id = ?   ORDER BY company_report_permission_id DESC LIMIT 1  "