rdluck 4 年之前
父節點
當前提交
1f9cba311b
共有 3 個文件被更改,包括 13 次插入6 次删除
  1. 11 6
      controllers/article.go
  2. 1 0
      controllers/user.go
  3. 1 0
      models/article.go

+ 11 - 6
controllers/article.go

@@ -73,6 +73,7 @@ func (this *ArticleController) Detail() {
 	}
 
 	hasPermission := 2
+	hasFree := 2
 	articlePermission, err := models.GetArticlePermission(detail.SubCategoryName)
 	if err != nil {
 		br.Msg = "获取信息失败"
@@ -91,6 +92,9 @@ func (this *ArticleController) Detail() {
 		br.ErrMsg = "判断是否已申请访谈失败,Err:" + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
 		return
 	}
+	if companyPermission != "" {
+		hasFree = 1
+	}
 	if strings.Contains(companyPermission, articlePermission.PermissionName) {
 		hasPermission = 1
 	}
@@ -120,6 +124,7 @@ func (this *ArticleController) Detail() {
 	}
 	resp := new(models.ArticleDetailResp)
 	resp.HasPermission = hasPermission
+	resp.HasFree = hasFree
 	resp.Detail = detail
 	br.Ret = 200
 	br.Success = true
@@ -281,22 +286,22 @@ func (this *ArticleCommonController) Detail() {
 		this.ServeJSON()
 	}()
 
-	articleIdMd5:= this.GetString("ArticleIdMd5")
-	if articleIdMd5 =="" {
+	articleIdMd5 := this.GetString("ArticleIdMd5")
+	if articleIdMd5 == "" {
 		br.Msg = "参数错误"
 		br.ErrMsg = "参数错误"
 		return
 	}
 	resp := new(models.ArticleDetailResp)
 	detail, err := models.GetArticleDetailByIdMd5(articleIdMd5)
-	if err != nil && err.Error()!=utils.ErrNoRow() {
+	if err != nil && err.Error() != utils.ErrNoRow() {
 		br.Msg = "获取信息失败"
-		br.ErrMsg = "获取信息失败,Err:"+err.Error()
+		br.ErrMsg = "获取信息失败,Err:" + err.Error()
 		return
 	}
-	if detail==nil {
+	if detail == nil {
 		resp.HasPermission = 2
-	}else{
+	} else {
 		resp.HasPermission = 1
 	}
 	resp.Detail = detail

+ 1 - 0
controllers/user.go

@@ -542,6 +542,7 @@ func (this *UserController) ApplyTryOut() {
 		br.ErrMsg = "参数解析失败,Err:" + err.Error()
 		return
 	}
+	//判断是否存在申请
 	var sellerMobile string
 	if req.ApplyMethod == 2 {
 		if req.BusinessCardUrl == "" {

+ 1 - 0
models/article.go

@@ -91,6 +91,7 @@ func GetArticlePermission(categoryName string) (item *ChartPermission, err error
 type ArticleDetailResp struct {
 	Detail        *ArticleDetail
 	HasPermission int `description:"1:有权限,2:无权限"`
+	HasFree       int `description:"1:已付费,2:未付费"`
 }
 
 func ModifyArticleExpert(articleId int, expertNumStr, expertContentStr, interviewDateStr string) (err error) {