|
@@ -83,7 +83,7 @@ func (this *MobileReportController) TradeList() {
|
|
|
return
|
|
|
}
|
|
|
for _, v := range categoryList {
|
|
|
- mapCategory[v.CategoryId] = v.CategoryId
|
|
|
+ mapCategory[v.IdCygx] = v.IdCygx
|
|
|
}
|
|
|
}
|
|
|
//for k, v := range list {
|
|
@@ -833,18 +833,34 @@ func (this *ReportController) CategoryFllow() {
|
|
|
}
|
|
|
categoryId := req.CategoryId
|
|
|
var condition string
|
|
|
- countCategory, err := models.GetCategoryCount(categoryId)
|
|
|
+ //countCategory, err := models.GetCategoryCount(categoryId)
|
|
|
+ //if err != nil {
|
|
|
+ // br.Msg = "获取数据失败!"
|
|
|
+ // br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
+ // return
|
|
|
+ //}
|
|
|
+ //if countCategory == 0 {
|
|
|
+ // br.Msg = "产业不存在!"
|
|
|
+ // br.ErrMsg = "产业ID不存在:" + strconv.Itoa(categoryId)
|
|
|
+ // return
|
|
|
+ //}
|
|
|
+ listMap, err := models.GetCygxXzsChooseCategoryMapList()
|
|
|
if err != nil {
|
|
|
- br.Msg = "获取数据失败!"
|
|
|
+ br.Msg = "操作失败!"
|
|
|
br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- if countCategory == 0 {
|
|
|
- br.Msg = "产业不存在!"
|
|
|
- br.ErrMsg = "产业ID不存在:" + strconv.Itoa(categoryId)
|
|
|
+ mapReport := make(map[int]int)
|
|
|
+ for _, v := range listMap {
|
|
|
+ mapReport[v.Id] = v.CategoryId
|
|
|
+ }
|
|
|
+ if mapReport[categoryId] == 0 {
|
|
|
+ br.Msg = "操作失败!"
|
|
|
+ br.ErrMsg = "分类ID不存在,ID:" + strconv.Itoa(categoryId)
|
|
|
return
|
|
|
}
|
|
|
- count, err := models.GetCountCategoryFllow(categoryId, user.Mobile, condition)
|
|
|
+
|
|
|
+ count, err := models.GetCountCategoryFllow(mapReport[categoryId], user.Mobile, condition)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取数据失败!"
|
|
|
br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
@@ -853,7 +869,8 @@ func (this *ReportController) CategoryFllow() {
|
|
|
resp := new(models.CygxIndustryFllowResp)
|
|
|
if count == 0 {
|
|
|
item := new(models.CygxXzsChooseCategory)
|
|
|
- item.CategoryId = categoryId
|
|
|
+ item.CategoryId = mapReport[categoryId]
|
|
|
+ item.IdCygx = categoryId
|
|
|
item.UserId = uid
|
|
|
item.Email = user.Email
|
|
|
item.Mobile = user.Mobile
|
|
@@ -871,7 +888,7 @@ func (this *ReportController) CategoryFllow() {
|
|
|
resp.Status = 1
|
|
|
br.Msg = "关注成功"
|
|
|
} else {
|
|
|
- err = models.RemoveCygxCategoryFllow(user.Mobile, categoryId)
|
|
|
+ err = models.RemoveCygxCategoryFllow(user.Mobile, mapReport[categoryId])
|
|
|
if err != nil {
|
|
|
br.Msg = "操作失败"
|
|
|
br.ErrMsg = "取消关注失败,Err:" + err.Error()
|