|
@@ -163,8 +163,8 @@ func (this *YanxuanSpecialNoLoginController) Detail() {
|
|
|
this.Data["json"] = br
|
|
|
this.ServeJSON()
|
|
|
}()
|
|
|
- sysUser := this.User
|
|
|
- if sysUser == nil {
|
|
|
+ user := this.User
|
|
|
+ if user == nil {
|
|
|
br.Msg = "请登录"
|
|
|
br.ErrMsg = "请登录,SysUser Is Empty"
|
|
|
br.Ret = 408
|
|
@@ -179,7 +179,7 @@ func (this *YanxuanSpecialNoLoginController) Detail() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- item, tmpErr := models.GetYanxuanSpecialById(specialId, sysUser.UserId)
|
|
|
+ item, tmpErr := models.GetYanxuanSpecialById(specialId, user.UserId)
|
|
|
if tmpErr != nil {
|
|
|
br.Msg = "获取失败"
|
|
|
br.ErrMsg = "获取失败, Err:" + tmpErr.Error()
|
|
@@ -188,15 +188,16 @@ func (this *YanxuanSpecialNoLoginController) Detail() {
|
|
|
|
|
|
//记录分享来源
|
|
|
if inviteShareCode != "" {
|
|
|
- go services.AddCygxUserAdminShareHistory(sysUser, utils.CYGX_OBJ_YANXUANSPECIAL, item.Title, inviteShareCode, specialId)
|
|
|
+ go services.AddCygxUserAdminShareHistory(user, utils.CYGX_OBJ_YANXUANSPECIAL, item.Title, inviteShareCode, specialId)
|
|
|
}
|
|
|
if item.MyCollectNum > 0 {
|
|
|
item.IsCollect = 1
|
|
|
}
|
|
|
|
|
|
- var resp models.CygxYanxuanSpecialResp
|
|
|
- resp.HasPermission = 1
|
|
|
- resp.CygxYanxuanSpecialItem = *item
|
|
|
+ var resp models.CygxYanxuanSpecialDetailResp
|
|
|
+ var yanxuanDetail *models.CygxYanxuanSpecialResp
|
|
|
+ yanxuanDetail.HasPermission = 1
|
|
|
+ yanxuanDetail.CygxYanxuanSpecialItem = *item
|
|
|
if item.DocUrl != "" {
|
|
|
var docs []models.Doc
|
|
|
err := json.Unmarshal([]byte(item.DocUrl), &docs)
|
|
@@ -205,31 +206,31 @@ func (this *YanxuanSpecialNoLoginController) Detail() {
|
|
|
br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- resp.Docs = docs
|
|
|
+ yanxuanDetail.Docs = docs
|
|
|
}
|
|
|
if item.ImgUrl != "" {
|
|
|
imgList := strings.Split(item.ImgUrl, ",")
|
|
|
for _, s := range imgList {
|
|
|
- resp.ImgUrlList = append(resp.ImgUrlList, s)
|
|
|
+ yanxuanDetail.ImgUrlList = append(yanxuanDetail.ImgUrlList, s)
|
|
|
}
|
|
|
} else {
|
|
|
- resp.ImgUrlList = []string{}
|
|
|
+ yanxuanDetail.ImgUrlList = []string{}
|
|
|
}
|
|
|
if item.CompanyTags != "" {
|
|
|
cTagList := strings.Split(item.CompanyTags, ",")
|
|
|
for _, s := range cTagList {
|
|
|
- resp.CompanyTags = append(resp.CompanyTags, s)
|
|
|
+ yanxuanDetail.CompanyTags = append(yanxuanDetail.CompanyTags, s)
|
|
|
}
|
|
|
} else {
|
|
|
- resp.CompanyTags = []string{}
|
|
|
+ yanxuanDetail.CompanyTags = []string{}
|
|
|
}
|
|
|
if item.IndustryTags != "" {
|
|
|
iTagList := strings.Split(item.IndustryTags, ",")
|
|
|
for _, s := range iTagList {
|
|
|
- resp.IndustryTags = append(resp.IndustryTags, s)
|
|
|
+ yanxuanDetail.IndustryTags = append(yanxuanDetail.IndustryTags, s)
|
|
|
}
|
|
|
} else {
|
|
|
- resp.IndustryTags = []string{}
|
|
|
+ yanxuanDetail.IndustryTags = []string{}
|
|
|
}
|
|
|
|
|
|
var configCode string
|
|
@@ -241,9 +242,9 @@ func (this *YanxuanSpecialNoLoginController) Detail() {
|
|
|
br.ErrMsg = "获取失败, Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- if item.UserId != sysUser.UserId && item.Status != 3 && !strings.Contains(cnf.ConfigValue, sysUser.Mobile) {
|
|
|
- resp.CygxYanxuanSpecialItem = *new(models.CygxYanxuanSpecialItem) // 如果内容不可见,就把内容置空
|
|
|
- resp.CygxYanxuanSpecialItem.Status = item.Status
|
|
|
+ if item.UserId != user.UserId && item.Status != 3 && !strings.Contains(cnf.ConfigValue, user.Mobile) {
|
|
|
+ yanxuanDetail.CygxYanxuanSpecialItem = *new(models.CygxYanxuanSpecialItem) // 如果内容不可见,就把内容置空
|
|
|
+ yanxuanDetail.CygxYanxuanSpecialItem.Status = item.Status
|
|
|
//resp.HasPermission = 2
|
|
|
}
|
|
|
|
|
@@ -263,26 +264,54 @@ func (this *YanxuanSpecialNoLoginController) Detail() {
|
|
|
//判断是否属于审核人员
|
|
|
mobileSlice := strings.Split(cnf.ConfigValue, ",")
|
|
|
for _, v := range mobileSlice {
|
|
|
- if v == sysUser.Mobile {
|
|
|
- resp.IsApprovalAdmin = true
|
|
|
+ if v == user.Mobile {
|
|
|
+ yanxuanDetail.IsApprovalAdmin = true
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- fllowNum, err := models.GetCygxYanxuanSpecialFollowCountByUserId(sysUser.UserId, item.UserId)
|
|
|
+ fllowNum, err := models.GetCygxYanxuanSpecialFollowCountByUserId(user.UserId, item.UserId)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取失败"
|
|
|
br.ErrMsg = "获取是否关注作者失败, Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
if fllowNum == 1 {
|
|
|
- resp.IsFollowAuthor = true
|
|
|
+ yanxuanDetail.IsFollowAuthor = true
|
|
|
+ }
|
|
|
+
|
|
|
+ havePower, err := services.GetArticleDetailUserPower(user)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "校验用户权限失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
}
|
|
|
- //
|
|
|
+ var hasPermission int
|
|
|
+ if havePower {
|
|
|
+ hasPermission = 1
|
|
|
+ } else {
|
|
|
+ hasPermission, err = services.GetUserDetailPermissionCode(user.UserId, user.CompanyId)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取信息失败,GetUserDetailPermissionCode Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ yanxuanDetail.HasPermission = hasPermission
|
|
|
+ resp.HasPermission = hasPermission
|
|
|
+
|
|
|
//if resp.HasPermission != 1 || sysUser.UserId == 0 {
|
|
|
// resp.Content = utils.InterceptHtmlLength(resp.Content, 240)
|
|
|
//}
|
|
|
//resp.ShareImg = utils.YANXUAN_SPECIAL_SHARE_IMG
|
|
|
- resp.ShareImg = resp.HeadImg
|
|
|
+ yanxuanDetail.ShareImg = yanxuanDetail.HeadImg
|
|
|
+ resp.IsShowWxPay = utils.IS_SHOW_WX_PAY //是否展示微信支付按钮
|
|
|
+ resp.IsCompanyApply = services.GetUserApplyRecordCountByCompanyIdPay(user.CompanyId) //获取客户是否有过历史申请记录
|
|
|
+ resp.IsNeedBusinessCard = services.GetCygxUserBusinessCardCount(user.UserId, user.CompanyId) //是否需要上传名片
|
|
|
+ resp.GoodsList = services.GetUserGoodsCardList() //日卡月卡商品信息
|
|
|
+ for _, v := range resp.GoodsList {
|
|
|
+ resp.PopupPriceMsg += v.PopupPriceMsg //价格弹窗信息
|
|
|
+ }
|
|
|
+ resp.Detail = yanxuanDetail
|
|
|
br.Data = resp
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|