|
@@ -242,42 +242,49 @@ func (this *BaseAuthMobileController) Detail() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if userId == 0 {
|
|
|
|
- hasPermission = 1
|
|
|
|
- resp.Content = utils.InterceptHtmlLength(resp.Content, 240) // 截取前80个字
|
|
|
|
|
|
+ //if userId == 0 {
|
|
|
|
+ // hasPermission = 1
|
|
|
|
+ // resp.Content = utils.InterceptHtmlLength(resp.Content, 240) // 截取前80个字
|
|
|
|
+ //} else {
|
|
|
|
+ // //查询研选的权限状态
|
|
|
|
+ // 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 "
|
|
|
|
+ // pars = append(pars, user.CompanyId, utils.CHART_PERMISSION_ID_YANXUAN)
|
|
|
|
+ // companyReportPermissionDetail, err := models.GetCompanyReportPermissionDetailByCondition(condition, pars)
|
|
|
|
+ // if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
|
+ // br.Msg = "获取信息失败"
|
|
|
|
+ // br.ErrMsg = "获取用户所在公司剩余的点失败,Err:" + err.Error()
|
|
|
|
+ // return
|
|
|
|
+ // }
|
|
|
|
+ // if companyReportPermissionDetail == nil {
|
|
|
|
+ // hasPermission, _, _, _, err = services.GetUserHasPermissionArticle(user)
|
|
|
|
+ // if err != nil {
|
|
|
|
+ // br.Msg = "获取信息失败"
|
|
|
|
+ // br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
|
|
|
|
+ // return
|
|
|
|
+ // }
|
|
|
|
+ // } else {
|
|
|
|
+ // hasPermission = 1
|
|
|
|
+ // }
|
|
|
|
+ //
|
|
|
|
+ //}
|
|
|
|
+ //
|
|
|
|
+ //resp.HasPermission = hasPermission
|
|
|
|
+
|
|
|
|
+ //如果是用户本人写的专栏,那么就不做校验
|
|
|
|
+ if item.UserId == user.UserId || user.UserId == 0 {
|
|
|
|
+ resp.HasPermission = 1
|
|
} else {
|
|
} else {
|
|
- //查询研选的权限状态
|
|
|
|
- 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 "
|
|
|
|
- pars = append(pars, user.CompanyId, utils.CHART_PERMISSION_ID_YANXUAN)
|
|
|
|
- companyReportPermissionDetail, err := models.GetCompanyReportPermissionDetailByCondition(condition, pars)
|
|
|
|
- if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
|
- br.Msg = "获取信息失败"
|
|
|
|
- br.ErrMsg = "获取用户所在公司剩余的点失败,Err:" + err.Error()
|
|
|
|
|
|
+ hasPermission, err = services.GetUserRaiPermissionYanXuanInfo(user)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取失败"
|
|
|
|
+ br.ErrMsg = "获取失败, Err:" + err.Error()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- if companyReportPermissionDetail == nil {
|
|
|
|
- hasPermission, _, _, _, err = services.GetUserHasPermissionArticle(user)
|
|
|
|
- if err != nil {
|
|
|
|
- br.Msg = "获取信息失败"
|
|
|
|
- br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- hasPermission = 1
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ resp.HasPermission = hasPermission
|
|
}
|
|
}
|
|
|
|
|
|
- resp.HasPermission = hasPermission
|
|
|
|
- //if userId == 0 {
|
|
|
|
-
|
|
|
|
- //}
|
|
|
|
- //if hasPermission != 0 && hasPermission != 1 {
|
|
|
|
- // //resp.Content = utils.InterceptHtmlLength(resp.Content, 240) // 截取前80个字
|
|
|
|
- // resp.Content = ""
|
|
|
|
- //}
|
|
|
|
br.Data = resp
|
|
br.Data = resp
|
|
br.Ret = 200
|
|
br.Ret = 200
|
|
br.Success = true
|
|
br.Success = true
|