Browse Source

Merge branch 'CRM_14.5' into debug

zwxi 1 year ago
parent
commit
77ab0047a4
2 changed files with 9 additions and 4 deletions
  1. 3 3
      models/wx_user.go
  2. 6 1
      services/task.go

+ 3 - 3
models/wx_user.go

@@ -488,11 +488,11 @@ func UserSubscribe(subscribeType int, openId string) (err error) {
 func UpdateWxUserViewData(userId, productId int, lastViewTime string) (err error) {
 	sql := ``
 	if productId == 2 {
-		sql = ` update wx_user set rai_view_total=rai_view_total+1,rai_last_view_time=? WHERE user_id=? `
+		sql = ` update wx_user set rai_view_total=rai_view_total+1,rai_last_view_time=?,report_last_view_time = ? WHERE user_id=? `
 	} else {
-		sql = ` update wx_user set ficc_view_total=ficc_view_total+1,ficc_last_view_time=? WHERE user_id=? `
+		sql = ` update wx_user set ficc_view_total=ficc_view_total+1,ficc_last_view_time=?,report_last_view_time = ? WHERE user_id=? `
 	}
 	o := orm.NewOrm()
-	_, err = o.Raw(sql, lastViewTime, userId).Exec()
+	_, err = o.Raw(sql, lastViewTime, lastViewTime, userId).Exec()
 	return
 }

+ 6 - 1
services/task.go

@@ -31,6 +31,7 @@ func AutoUpdateUserView() {
 		go_redis.BRPop2Func(utils.CACHE_KEY_USER_VIEW, func(b []byte) {
 			var userViewRedisData cache.UserViewRedisData
 			if err := json.Unmarshal(b, &userViewRedisData); err != nil {
+				//fmt.Println(utils.APPNAME + " " + utils.RunMode + " 失败提醒:" + fmt.Sprint("AutoUpdateUserView ERR:", err, ";response data:", string(b)))
 				go alarm_msg.SendAlarmMsg(utils.APPNAME+" "+utils.RunMode+" 失败提醒:"+fmt.Sprint("AutoUpdateUserView ERR:", err, ";response data:", string(b)), 2)
 				//}
 				//if _, err := models.AddLogs(&log); err != nil {
@@ -39,6 +40,7 @@ func AutoUpdateUserView() {
 				// 客户的阅读时间
 				err = models.UpdateCompanyProductViewData(userViewRedisData.CompanyId, userViewRedisData.ProductId, userViewRedisData.ViewTime)
 				if err != nil {
+					//fmt.Println(utils.APPNAME + " " + utils.RunMode + " 失败提醒:" + fmt.Sprint("AutoUpdateUserView Update UpdateCompanyProductViewData ERR:", err, ";response data:", string(b)))
 					go alarm_msg.SendAlarmMsg(utils.APPNAME+" "+utils.RunMode+" 失败提醒:"+fmt.Sprint("AutoUpdateUserView Update UpdateCompanyProductViewData ERR:", err, ";response data:", string(b)), 2)
 				}
 
@@ -68,10 +70,12 @@ func AutoUpdateUserView() {
 					}
 					viewTime, tmpErr := time.ParseInLocation(utils.FormatDateTime, userViewRedisData.ViewTime, time.Local)
 					if tmpErr != nil {
-						go utils.SendEmail(utils.APPNAME+" "+utils.RunMode+" 失败提醒", fmt.Sprint("AutoUpdateUserView ADD UserReportViewRecord ERR:", err, ";response data:", string(b)), utils.EmailSendToUsers)
+						//fmt.Println(utils.APPNAME+" "+utils.RunMode+" 失败提醒", fmt.Sprint("AutoUpdateUserView ADD UserReportViewRecord ERR:", tmpErr, ";response data:", string(b)))
+						go utils.SendEmail(utils.APPNAME+" "+utils.RunMode+" 失败提醒", fmt.Sprint("AutoUpdateUserView ADD UserReportViewRecord ERR:", tmpErr, ";response data:", string(b)), utils.EmailSendToUsers)
 					} else {
 						err = item.Insert(viewTime.Year(), item)
 						if err != nil {
+							//fmt.Println(utils.APPNAME+" "+utils.RunMode+" 失败提醒", fmt.Sprint("AutoUpdateUserView ADD UserReportViewRecord ERR:", err, ";response data:", string(b)))
 							go utils.SendEmail(utils.APPNAME+" "+utils.RunMode+" 失败提醒", fmt.Sprint("AutoUpdateUserView ADD UserReportViewRecord ERR:", err, ";response data:", string(b)), utils.EmailSendToUsers)
 						}
 					}
@@ -80,6 +84,7 @@ func AutoUpdateUserView() {
 				// 联系人的阅读时间
 				err = models.UpdateWxUserViewData(userViewRedisData.UserId, userViewRedisData.ProductId, userViewRedisData.ViewTime)
 				if err != nil {
+					//fmt.Println(utils.APPNAME + " " + utils.RunMode + " 失败提醒:" + fmt.Sprint("AutoUpdateUserView Update UpdateWxUserViewData ERR:", err, ";response data:", string(b)))
 					go alarm_msg.SendAlarmMsg(utils.APPNAME+" "+utils.RunMode+" 失败提醒:"+fmt.Sprint("AutoUpdateUserView Update UpdateWxUserViewData ERR:", err, ";response data:", string(b)), 2)
 				}
 			}