12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- package services
- import (
- "context"
- "errors"
- "fmt"
- "hongze/hongze_cygx/models"
- "hongze/hongze_cygx/utils"
- )
- // 判断用户是否开通了个人研选权限
- func GetMfyxUserPermissionTotal(userId int) (toatal int) {
- var err error
- defer func() {
- if err != nil {
- fmt.Println(err)
- go utils.SendAlarmMsg(fmt.Sprint("判断用户是否开通了个人研选权限失败 GetMfyxUserPermissionTotal userId", userId, ",err:", err.Error()), 2)
- }
- }()
- //判断用户是否开通了个人研选权限,如果有权限后缀拼接权限名称
- toatal, e := models.GetCygxUserYanxuanPermissionCountByUserId(userId)
- if e != nil {
- err = errors.New("GetCygxUserYanxuanPermissionCountByUserId, Err: " + e.Error())
- return
- }
- return
- }
- // UpdateCygxUserYanxuanPermissionToClose 关闭到期个人用户研选权限
- func UpdateCygxUserYanxuanPermissionToClose(cont context.Context) (err error) {
- defer func() {
- if err != nil {
- fmt.Println(err)
- go utils.SendAlarmMsg(fmt.Sprint("关闭个人用户研选权限失败 UpdateCygxUserYanxuanPermissionToClose ,err:", err.Error()), 2)
- }
- }()
- e := models.UpdateCygxUserYanxuanPermissionToClose()
- if e != nil {
- err = errors.New("UpdateCygxUserYanxuanPermissionToClose, Err: " + e.Error())
- return
- }
- return
- }
|