xingzai vor 7 Monaten
Ursprung
Commit
2b62dbc109

+ 45 - 0
models/rai_serve/rai_serve_bill.go

@@ -0,0 +1,45 @@
+package rai_serve
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+// 权益服务明细表
+type CygxRaiServeBill struct {
+	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:"浏览时间"`
+}
+
+// Redis对列消息中的结构体
+type RaiServeBillRedis struct {
+	Content          string    `comment:"服务内容说明"`
+	UserId           int       `comment:"用户ID"`
+	ComapnyId        int       `comment:"公司ID"`
+	SourceId         int       `comment:"来源ID"`
+	Source           string    `comment:"来源"`
+	RegisterPlatform int       `comment:"来源 1小程序,2:网页"`
+	ViewTime         time.Time `comment:"浏览时间"`
+}
+
+// 添加
+func AddCygxRaiServeBill(item *CygxRaiServeBill) (err error) {
+	o := orm.NewOrm()
+	_, err = o.Insert(item)
+	return
+}

+ 2 - 0
services/cygx_yanxuan_special_company.go

@@ -118,6 +118,8 @@ func AddSpecialRecord(user *models.WxUserItem, specialId, stopTime int) (err err
 		item.YanxuanSpecialId = specialId
 		item.StopTime = stopTime
 		item.PermissionCode = permissionCode
+		go CygxRaiServeBillRedisAdd(detail.Title, utils.CYGX_OBJ_YANXUANSPECIAL, user.UserId, user.CompanyId, specialId, utils.REGISTER_PLATFORM, item.CreateTime) // 权益服务统计添加到Redis队列中
+
 		_, e = models.AddCygxYanxuanSpecialRecord(item) // 添加历史记录
 		if e != nil {
 			err = errors.New("AddCygxYanxuanSpecialRecord, Err: " + e.Error())

+ 40 - 0
services/rai_serve_count.go

@@ -0,0 +1,40 @@
+package services
+
+import (
+	"fmt"
+	"hongze/hongze_cygx/models/rai_serve"
+	"hongze/hongze_cygx/utils"
+	"time"
+)
+
+//权益服务统计
+
+// Redis对列消息中的结构体
+type RaiServeBillRedis struct {
+	Content          string    `comment:"服务内容说明"`
+	UserId           int       `comment:"用户ID"`
+	ComapnyId        int       `comment:"公司ID"`
+	SourceId         int       `comment:"来源ID"`
+	Source           string    `comment:"来源"`
+	RegisterPlatform int       `comment:"来源 1小程序,2:网页"`
+	ViewTime         time.Time `comment:"浏览时间"`
+}
+
+// 权益服务统计添加到Redis队列中
+func CygxRaiServeBillRedisAdd(content, source string, userId, comapnyId, sourceId, registerPlatform int, viewTime time.Time) (err error) {
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			msg := fmt.Sprint("source:", source, "userId:", userId, "sourceId", sourceId)
+			go utils.SendAlarmMsg("权益服务统计添加到Redis队列中,写入Redis队列消息失败 CygxRaiServeBillRedisAdd:"+err.Error()+msg, 2)
+		}
+	}()
+	log := &rai_serve.RaiServeBillRedis{Content: content, UserId: userId, ComapnyId: comapnyId, SourceId: sourceId, RegisterPlatform: registerPlatform, ViewTime: viewTime}
+	if utils.Re == nil {
+		err := utils.Rc.LPush(utils.CYGX_RAI_SERVE_BILL_KEY, log)
+		if err != nil {
+			fmt.Println("RaiServeBillRedis LPush Err:" + err.Error())
+		}
+	}
+	return
+}

+ 3 - 0
utils/config.go

@@ -60,6 +60,7 @@ var (
 	RAI_MOBILE_DONG_HENG  string // 权益董衡手机号
 	RAI_MOBILE_WU_ANG_DI  string // 权益吴昂迪手机号
 	RAI_MOBILE_GE_LIN     string // 权益葛琳手机号
+	RAI_SERVE_GROUP_ID    int    // 权益服务组,所属组的ID
 )
 
 // 微信公众号配置信息
@@ -203,6 +204,7 @@ func init() {
 		//ActSendMsgMobile = "15618524605"
 		ActSendMsgMobile = "15557270714" // 汪洋手机号
 		ArticleTaskClassMobile = "15557270714,18767183922,15216736473,15000123056,18701809782,17706316791,18652179672"
+		RAI_SERVE_GROUP_ID = 68
 
 		ShangHaiCrmApiLink = "https://crm.hzinsights.com/"
 		SendWxTemplateMsgUrl = "http://127.0.0.1:8086/v1/wechat/send_template_msg"
@@ -240,6 +242,7 @@ func init() {
 		WxMsgTemplateIdAskMsgMobile = "15557270714,17634786714,18767183922,17516315016"
 		ActSendMsgMobile = "15557270714"
 		ArticleTaskClassMobile = "15557270714,18767183922,17706316791"
+		RAI_SERVE_GROUP_ID = 132
 
 		ShangHaiCrmApiLink = "http://106.15.192.100:8100/"
 		SendWxTemplateMsgUrl = "http://127.0.0.1:8086/v1/wechat/send_template_msg"

+ 1 - 0
utils/constants.go

@@ -133,6 +133,7 @@ const (
 	CYGX_USER_KEY_LABEL              = "CYGX_USER_KEY_LABEL"              //查研观向用户标签
 	CYGX_YANXUAN_POINTS_KEY          = "CYGX_YANXUAN_POINTS_KEY"          //查研观向研选活动扣点KEY
 	CYGX_ARTICLE_UPDATE_KEY          = "CYGX_ARTICLE_UPDATE_KEY"          //策略平台更新文章key
+	CYGX_RAI_SERVE_BILL_KEY          = "CYGX_RAI_SERVE_BILL_KEY"          //权益服务记录明细key
 )
 
 const (