|
@@ -2,7 +2,9 @@ package services
|
|
|
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
+ "errors"
|
|
|
"fmt"
|
|
|
+ "hongze/hongze_cygx/models"
|
|
|
"hongze/hongze_cygx/models/company"
|
|
|
"hongze/hongze_cygx/models/rai_serve"
|
|
|
"hongze/hongze_cygx/utils"
|
|
@@ -41,9 +43,9 @@ func CygxRaiServeBillRedisAdd(content, source string, userId, comapnyId, sourceI
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-func init() {
|
|
|
- CygxRaiServeBillRedisAddReduce()
|
|
|
-}
|
|
|
+//func init() {
|
|
|
+// CygxRaiServeBillRedisAddReduce()
|
|
|
+//}
|
|
|
|
|
|
// CygxRaiServeBillRedisAddReduce 处理权益服务统计
|
|
|
func CygxRaiServeBillRedisAddReduce() (err error) {
|
|
@@ -94,35 +96,35 @@ func RaiServeBillRedisAddReduceByYanxuanspecial(log rai_serve.RaiServeBillRedis)
|
|
|
sourceId := log.SourceId
|
|
|
defer func() {
|
|
|
if err != nil {
|
|
|
- fmt.Println(err)
|
|
|
go utils.SendAlarmMsg("用户报名活动扣点,处理Redis队列消息失败:"+err.Error()+fmt.Sprint("source:", source, "userId:", userId, "sourceId", sourceId), 2)
|
|
|
}
|
|
|
}()
|
|
|
-
|
|
|
+ wxUser, e := models.GetWxUserItemByUserId(userId)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("GetWxUserItemByUserId, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
item := new(rai_serve.CygxRaiServeBill)
|
|
|
-
|
|
|
item.Content = log.Content
|
|
|
item.ServeTypeId = 5
|
|
|
item.ServeTypeName = "阅读uv"
|
|
|
+ item.UserId = wxUser.UserId
|
|
|
+ item.Mobile = wxUser.Mobile
|
|
|
+ item.Email = wxUser.Email
|
|
|
+ item.CompanyId = wxUser.CompanyId
|
|
|
+ item.CompanyName = wxUser.CompanyName
|
|
|
+ item.RealName = wxUser.RealName
|
|
|
+ item.RegisterPlatform = log.RegisterPlatform
|
|
|
+ item.ServeCount = 0.5
|
|
|
|
|
|
- // BillId int `comment:"服务明细主键ID"`
|
|
|
- // Content string `comment:"服务内容说明"`
|
|
|
- // ServeTypeId int `comment:"服务类型ID"`
|
|
|
- // ServeTypeName string `comment:"服务类型"`
|
|
|
- // UserId int `comment:"用户ID"`
|
|
|
- // Mobile string `comment:"手机号"`
|
|
|
- // Email string `comment:"邮箱"`
|
|
|
- // CompanyId int `comment:"公司ID"`
|
|
|
- // CompanyName string `comment:"公司名称"`
|
|
|
- // RealName string `comment:"用户实际名称"`
|
|
|
- // RegisterPlatform int `comment:"来源 1小程序,2:网页"`
|
|
|
- // ServeCount float64 `comment:"服务量小计"`
|
|
|
- // IsKp int `comment:"是否是KP,1:是、0:否"`
|
|
|
- // SourceId int `comment:"来源ID"`
|
|
|
- // Source string `comment:"来源 "`
|
|
|
- // CreateTime time.Time `comment:"创建时间"`
|
|
|
- // ViewTime time.Time `comment:"浏览时间"`
|
|
|
- //}
|
|
|
-
|
|
|
+ if wxUser.IsMaker == 1 {
|
|
|
+ item.IsKp = wxUser.IsMaker
|
|
|
+ item.ServeCount = item.ServeCount * 3
|
|
|
+ }
|
|
|
+ item.SourceId = log.SourceId
|
|
|
+ item.Source = log.Source
|
|
|
+ item.CreateTime = time.Now()
|
|
|
+ item.ViewTime = log.ViewTime
|
|
|
+ err = rai_serve.AddCygxRaiServeBill(item)
|
|
|
return
|
|
|
}
|