|
@@ -148,7 +148,7 @@ func (this *BaseAuthMobileController) Detail() {
|
|
|
this.Data["json"] = br
|
|
|
this.ServeJSON()
|
|
|
}()
|
|
|
- sysUser := this.User
|
|
|
+ user := this.User
|
|
|
//if sysUser == nil {
|
|
|
// br.Msg = "请登录"
|
|
|
// br.ErrMsg = "请登录1,SysUser Is Empty"
|
|
@@ -164,8 +164,8 @@ func (this *BaseAuthMobileController) Detail() {
|
|
|
br.ErrMsg = "参数错误"
|
|
|
return
|
|
|
}
|
|
|
- userId := sysUser.UserId
|
|
|
- item, tmpErr := models.GetYanxuanSpecialById(specialId, sysUser.UserId)
|
|
|
+ userId := user.UserId
|
|
|
+ item, tmpErr := models.GetYanxuanSpecialById(specialId, user.UserId)
|
|
|
if tmpErr != nil {
|
|
|
br.Msg = "获取失败"
|
|
|
br.ErrMsg = "获取失败, Err:" + tmpErr.Error()
|
|
@@ -177,7 +177,6 @@ func (this *BaseAuthMobileController) Detail() {
|
|
|
|
|
|
var resp models.CygxYanxuanSpecialResp
|
|
|
|
|
|
- resp.HasPermission = 1
|
|
|
resp.CygxYanxuanSpecialItem = *item
|
|
|
if item.DocUrl != "" {
|
|
|
var docs []models.Doc
|
|
@@ -211,12 +210,12 @@ func (this *BaseAuthMobileController) Detail() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- if isSendWx == 1 && strings.Contains(cnf.ConfigValue, sysUser.Mobile) {
|
|
|
+ if isSendWx == 1 && strings.Contains(cnf.ConfigValue, user.Mobile) {
|
|
|
resp.IsShowExamine = true
|
|
|
resp.ExamineStatus = item.Status
|
|
|
}
|
|
|
resp.ExamineStatus = item.Status
|
|
|
- if item.UserId != sysUser.UserId && item.Status != 3 && !strings.Contains(cnf.ConfigValue, sysUser.Mobile) {
|
|
|
+ if item.UserId != user.UserId && item.Status != 3 && !strings.Contains(cnf.ConfigValue, user.Mobile) {
|
|
|
resp.CygxYanxuanSpecialItem = *new(models.CygxYanxuanSpecialItem) // 如果内容不可见,就把内容置空
|
|
|
resp.HasPermission = 2
|
|
|
}
|
|
@@ -234,6 +233,48 @@ func (this *BaseAuthMobileController) Detail() {
|
|
|
resp.ContentHasStyle = true
|
|
|
}
|
|
|
|
|
|
+ var hasPermission int
|
|
|
+ if user.CompanyId > 1 {
|
|
|
+ companyItem, err := models.GetCompanyDetailById(user.CompanyId)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if companyItem != nil && companyItem.CompanyId > 0 {
|
|
|
+
|
|
|
+ //查询研选的权限状态
|
|
|
+ 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 = 1
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ hasPermission = 1
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //判断是否已经申请过
|
|
|
+ applyCount, err := models.GetApplyRecordCount(userId)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if applyCount > 0 {
|
|
|
+ hasPermission = 3
|
|
|
+ } else {
|
|
|
+ hasPermission = 2
|
|
|
+ }
|
|
|
+ }
|
|
|
+ resp.HasPermission = hasPermission
|
|
|
if userId == 0 {
|
|
|
resp.Content = utils.InterceptHtmlLength(resp.Content, 240) // 截取前80个字
|
|
|
}
|