浏览代码

Merge remote-tracking branch 'origin/master'

zwxi 1 年之前
父节点
当前提交
85e48917a9
共有 5 个文件被更改,包括 43 次插入22 次删除
  1. 28 17
      controllers/yanxuan_special.go
  2. 5 1
      models/report.go
  3. 1 0
      models/report_mapping.go
  4. 1 0
      services/article_history.go
  5. 8 4
      services/sms.go

+ 28 - 17
controllers/yanxuan_special.go

@@ -539,6 +539,9 @@ func (this *YanxuanSpecialNoLoginController) AuthorDetail() {
 		br.ErrMsg = "获取失败, Err:" + tmpErr.Error()
 		return
 	}
+	if item.IsFollow > 0 {
+		item.IsFollow = 1
+	}
 
 	br.Data = item
 	br.Ret = 200
@@ -846,26 +849,34 @@ func (this *YanxuanSpecialController) Follow() {
 	}
 
 	if req.Status == 1 {
-		item := models.CygxYanxuanSpecialFollow{
-			UserId:           user.UserId,
-			FollowUserId:     authorItem.UserId,
-			Mobile:           user.Mobile,
-			Email:            user.Email,
-			CompanyId:        user.CompanyId,
-			CompanyName:      user.CompanyName,
-			RealName:         user.RealName,
-			SellerName:       sellerName,
-			CreateTime:       time.Now(),
-			ModifyTime:       time.Now(),
-			RegisterPlatform: utils.REGISTER_PLATFORM,
-			YanxuanSpecialId: req.SpecialId,
-		}
-		err = models.AddCygxYanxuanSpecialFollow(&item)
+		followCount, err := models.GetCygxYanxuanSpecialFollowCountByUser(user.UserId, authorItem.UserId)
 		if err != nil {
-			br.Msg = "新增失败"
-			br.ErrMsg = "新增失败,Err:" + err.Error()
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取失败, Err:" + err.Error()
 			return
 		}
+		if followCount == 0 {
+			item := models.CygxYanxuanSpecialFollow{
+				UserId:           user.UserId,
+				FollowUserId:     authorItem.UserId,
+				Mobile:           user.Mobile,
+				Email:            user.Email,
+				CompanyId:        user.CompanyId,
+				CompanyName:      user.CompanyName,
+				RealName:         user.RealName,
+				SellerName:       sellerName,
+				CreateTime:       time.Now(),
+				ModifyTime:       time.Now(),
+				RegisterPlatform: utils.REGISTER_PLATFORM,
+				YanxuanSpecialId: req.SpecialId,
+			}
+			err = models.AddCygxYanxuanSpecialFollow(&item)
+			if err != nil {
+				br.Msg = "新增失败"
+				br.ErrMsg = "新增失败,Err:" + err.Error()
+				return
+			}
+		}
 		br.Msg = "关注成功"
 	} else {
 		err = models.DelCygxYanxuanSpecialFollow(user.UserId, authorItem.UserId)

+ 5 - 1
models/report.go

@@ -301,6 +301,8 @@ func IndustrialToArticleAndProductInteriorCategoryNew(industrialManagementId int
 	o := orm.NewOrm()
 	sql := `SELECT
 			map.match_type_name,
+			map.sort,
+			map.id,
 			map.id AS category_id 
 		FROM
 			cygx_report_mapping_cygx AS map
@@ -319,6 +321,8 @@ func IndustrialToArticleAndProductInteriorCategoryNew(industrialManagementId int
 			map.match_type_name UNION ALL
 		SELECT
 			map.match_type_name,
+			map.sort,
+			map.id,
 			map.id AS category_id 
 		FROM
 			cygx_report_mapping_cygx AS map
@@ -331,7 +335,7 @@ func IndustrialToArticleAndProductInteriorCategoryNew(industrialManagementId int
 			AND art.visible_range = 1 
 			AND man_g.industrial_management_id = ? 
 		GROUP BY
-			map.match_type_name`
+			map.match_type_name  	ORDER BY  id ASC ,  sort DESC   `
 	_, err = o.Raw(sql, industrialManagementId, industrialManagementId).QueryRows(&items)
 	return
 }

+ 1 - 0
models/report_mapping.go

@@ -94,6 +94,7 @@ func GetReportMappingStrategyHomeAllByCygx(userId, chartPermissionId int) (items
 			1 = 1 
 			AND re.chart_permission_id = ? 
 			AND re.report_type = 1 
+			AND re.list_group > 0 
 		GROUP BY
 			re.match_type_name 
 		ORDER BY

+ 1 - 0
services/article_history.go

@@ -71,6 +71,7 @@ func ArticleHistoryStopTime(articleId, stopTime, outType int, user *models.WxUse
 		record.CompanyName = user.CompanyName
 		record.StopTime = stopTime
 		record.OutType = outType
+		record.RegisterPlatform = utils.REGISTER_PLATFORM
 		record.Source = "WEB"
 		newId, e := models.AddCygxArticleViewRecordNewpv(record)
 		if e != nil {

+ 8 - 4
services/sms.go

@@ -21,14 +21,16 @@ func SendSmsCode(mobile, vcode string) bool {
 	var netReturn map[string]interface{}
 	err = json.Unmarshal(result, &netReturn)
 	if err != nil {
-		go utils.SendEmail("短信验证码发送失败", "err:"+err.Error()+" result"+string(result), utils.EmailSendToUsers)
+		go utils.SendAlarmMsg("短信验证码发送失败err:"+err.Error()+" result"+string(result)+"mobile:"+mobile, 1)
+		//go utils.SendEmail("短信验证码发送失败", "err:"+err.Error()+" result"+string(result), utils.EmailSendToUsers)
 		flag = false
 	}
 	if netReturn["error_code"].(float64) == 0 {
 		fmt.Printf("接口返回result字段是:\r\n%v", netReturn["result"])
 		flag = true
 	} else {
-		go utils.SendEmail("短信验证码发送失败", " result"+string(result), utils.EmailSendToUsers)
+		go utils.SendAlarmMsg("短信验证码发送失败err:"+err.Error()+" result"+string(result)+"mobile:"+mobile, 1)
+		//go utils.SendEmail("短信验证码发送失败", " result"+string(result), utils.EmailSendToUsers)
 		flag = false
 	}
 	return flag
@@ -72,14 +74,16 @@ func SendSmsCodeGj(mobile, vcode, areaNum string) bool {
 	var netReturn map[string]interface{}
 	err = json.Unmarshal(result, &netReturn)
 	if err != nil {
-		go utils.SendEmail("短信验证码发送失败", "err:"+err.Error()+" result"+string(result), utils.EmailSendToUsers)
+		go utils.SendAlarmMsg("国际短信验证码发送失败err:"+err.Error()+" result"+string(result)+"mobile:"+mobile, 1)
+		//go utils.SendEmail("短信验证码发送失败", "err:"+err.Error()+" result"+string(result), utils.EmailSendToUsers)
 		flag = false
 	}
 	if netReturn["error_code"].(float64) == 0 {
 		fmt.Printf("接口返回result字段是:\r\n%v", netReturn["result"])
 		flag = true
 	} else {
-		go utils.SendEmail("短信验证码发送失败", " result"+string(result), utils.EmailSendToUsers)
+		go utils.SendAlarmMsg("国际短信验证码发送失败err:"+err.Error()+" result"+string(result)+"mobile:"+mobile, 1)
+		//go utils.SendEmail("短信验证码发送失败", " result"+string(result), utils.EmailSendToUsers)
 		flag = false
 	}
 	return flag