|
@@ -93,7 +93,6 @@ func (this *ReportController) IndustryList() {
|
|
|
return
|
|
|
}
|
|
|
uid := user.UserId
|
|
|
-
|
|
|
ChartPermissionId, _ := this.GetInt("ChartPermissionId")
|
|
|
orderColumn := this.GetString("OrderColumn")
|
|
|
isNewLabel := this.GetString("IsNewLabel")
|
|
@@ -223,13 +222,12 @@ func (this *ReportController) IndustryList() {
|
|
|
// list = append(listTop, listNoTop...)
|
|
|
//}
|
|
|
|
|
|
- listNoTop, err := models.GetIndustrialManagementAll(uid, condition, orderSrt, startSize, pageSize)
|
|
|
+ list, err := models.GetIndustrialManagementAll(uid, condition, orderSrt, startSize, pageSize)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取信息失败"
|
|
|
br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- list = listNoTop
|
|
|
for k, v := range list {
|
|
|
//var analystStr string
|
|
|
//analystList, err := models.GetIndustrialAnalystAll(v.IndustrialManagementId)
|
|
@@ -496,3 +494,108 @@ func (this *ReportController) ArticleCollect() {
|
|
|
br.Success = true
|
|
|
br.Data = resp
|
|
|
}
|
|
|
+
|
|
|
+// @Title 关注/取消关注
|
|
|
+// @Description 关注/取消关注 接口
|
|
|
+// @Param request body models.CygxIndustryFllowRep true "type json string"
|
|
|
+// @Success 200
|
|
|
+// @router /fllow [post]
|
|
|
+func (this *ReportController) Fllow() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+ user := this.User
|
|
|
+ if user == nil {
|
|
|
+ br.Msg = "请重新登录"
|
|
|
+ br.Ret = 408
|
|
|
+ return
|
|
|
+ }
|
|
|
+ uid := user.UserId
|
|
|
+ var req models.CygxIndustryFllowRep
|
|
|
+ err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "参数解析异常!"
|
|
|
+ br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ industrialManagementId := req.IndustrialManagementId
|
|
|
+ var condition string
|
|
|
+ countIndustrial, err := models.GetIndustrialManagementCount(industrialManagementId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取数据失败!"
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if countIndustrial == 0 {
|
|
|
+ br.Msg = "产业不存在!"
|
|
|
+ br.ErrMsg = "产业ID不存在:" + strconv.Itoa(industrialManagementId)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ count, err := models.GetCountCygxIndustryFllow(uid, industrialManagementId, condition)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取数据失败!"
|
|
|
+ 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)
|
|
|
+ if count == 0 {
|
|
|
+ item := new(models.CygxIndustryFllow)
|
|
|
+ item.IndustrialManagementId = industrialManagementId
|
|
|
+ item.UserId = uid
|
|
|
+ item.Email = user.Email
|
|
|
+ item.Mobile = user.Mobile
|
|
|
+ item.CompanyId = user.CompanyId
|
|
|
+ item.CompanyName = user.CompanyName
|
|
|
+ item.Type = 1
|
|
|
+ item.CreateTime = time.Now()
|
|
|
+ item.ModifyTime = time.Now()
|
|
|
+ _, err = models.AddCygxIndustryFllow(item)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "置顶失败"
|
|
|
+ br.ErrMsg = "置顶失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ br.Msg = "置顶成功"
|
|
|
+ resp.Status = 1
|
|
|
+ } else {
|
|
|
+ var doType int
|
|
|
+ condition = ` AND type = 1`
|
|
|
+ count, err = models.GetCountCygxIndustryFllow(uid, industrialManagementId, condition)
|
|
|
+ if err != nil {
|
|
|
+ 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()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Data = resp
|
|
|
+}
|