Browse Source

产业关注,与取消关注

xingzai 3 years ago
parent
commit
b581b12903
1 changed files with 8 additions and 20 deletions
  1. 8 20
      controllers/report.go

+ 8 - 20
controllers/report.go

@@ -539,18 +539,7 @@ func (this *ReportController) Fllow() {
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
 	}
-	//
-	//
-	//IndustrialManagementId int       `description:"产业D"`
-	//UserId                 int       `description:"用户ID"`
-	//CreateTime             time.Time `description:"创建时间"`
-	//Mobile                 string    `description:"手机号"`
-	//Email                  string    `description:"邮箱"`
-	//CompanyId              int       `description:"公司id"`
-	//CompanyName            string    `description:"公司名称"`
-	//Type                   int       `description:"操作方式,1报名,2取消报名"`
-	//ModifyTime             time.Time `description:"更新时间"`
-	resp := new(models.ArticleCollectResp)
+	resp := new(models.CygxIndustryFllowResp)
 	if count == 0 {
 		item := new(models.CygxIndustryFllow)
 		item.IndustrialManagementId = industrialManagementId
@@ -564,37 +553,36 @@ func (this *ReportController) Fllow() {
 		item.ModifyTime = time.Now()
 		_, err = models.AddCygxIndustryFllow(item)
 		if err != nil {
-			br.Msg = "置顶失败"
-			br.ErrMsg = "置顶失败,Err:" + err.Error()
+			br.Msg = "操作失败"
+			br.ErrMsg = "操作失败,Err:" + err.Error()
 			return
 		}
-		br.Msg = "置顶成功"
+		resp.GoFllow = true
 		resp.Status = 1
 	} else {
 		var doType int
 		condition = ` AND type = 1`
 		count, err = models.GetCountCygxIndustryFllow(uid, industrialManagementId, condition)
 		if err != nil {
-			br.Msg = "获取数据失败!"
+			br.Msg = "操作失败!"
 			br.ErrMsg = "获取数据失败,Err:" + err.Error()
 			return
 		}
 		if count == 1 {
-			br.Msg = "已取消关注"
 			resp.Status = 2
 			doType = 2
 		} else {
-			br.Msg = "已关注"
 			resp.Status = 1
 			doType = 1
 		}
 		err = models.RemoveCygxIndustryFllow(uid, industrialManagementId, doType)
 		if err != nil {
-			br.Msg = "取消关注失败"
-			br.ErrMsg = "取消置顶失败,Err:" + err.Error()
+			br.Msg = "操作失败"
+			br.ErrMsg = "取消关注失败,Err:" + err.Error()
 			return
 		}
 	}
+	br.Msg = "操作成功"
 	br.Ret = 200
 	br.Success = true
 	br.Data = resp