|
@@ -1,6 +1,7 @@
|
|
|
package cygx
|
|
|
|
|
|
import (
|
|
|
+ "fmt"
|
|
|
"github.com/beego/beego/v2/client/orm"
|
|
|
"hongze/hz_crm_api/utils"
|
|
|
"time"
|
|
@@ -24,6 +25,26 @@ type WxUserRaiLabel struct {
|
|
|
TableName string `description:"数据来源的表名"`
|
|
|
}
|
|
|
|
|
|
+// 标签记录表,所有内容都不删除
|
|
|
+type WxUserRaiLabelLog struct {
|
|
|
+ RaiLabelId int `orm:"column(rai_label_id);pk"`
|
|
|
+ UserId int `description:"用户ID"`
|
|
|
+ RealName string `description:"用户实际名称"`
|
|
|
+ Mobile string `description:"手机号"`
|
|
|
+ Email string `description:"邮箱"`
|
|
|
+ CompanyId int `description:"公司id"`
|
|
|
+ CompanyName string `description:"公司名称"`
|
|
|
+ Label string `description:"标签内容"`
|
|
|
+ SourceId int `description:"来源ID"`
|
|
|
+ SourceType int `description:"来源1:搜索关键字标签、2:产业/个股标签(线下活动)、3:产业/个股标签(线下路演)、4:产业/个股标签(线上活动)、5:产业/个股标签(线上路演)、6:销售输入标签、7:产业/个股标签(报告)、8:报告类型标签"`
|
|
|
+ SysUserId int `description:"创建人id"`
|
|
|
+ SysUserRealName string `description:"创建人名称"`
|
|
|
+ CreateTime time.Time `description:"创建时间"`
|
|
|
+ ModifyTime time.Time `description:"更新时间"`
|
|
|
+ RegisterPlatform int `description:"来源 1小程序,2:网页"`
|
|
|
+ TableName string `description:"数据来源的表名"`
|
|
|
+}
|
|
|
+
|
|
|
type WxUserRaiLabelList struct {
|
|
|
List []*WxUserRaiLabelListResp
|
|
|
}
|
|
@@ -45,9 +66,56 @@ type WxUserRaiLabelIdReq struct {
|
|
|
}
|
|
|
|
|
|
// 添加
|
|
|
+//func AddWxUserRaiLabel(item *WxUserRaiLabel) (err error) {
|
|
|
+// o := orm.NewOrmUsingDB("hz_cygx")
|
|
|
+// _, err = o.Insert(item)
|
|
|
+// return
|
|
|
+//}
|
|
|
+
|
|
|
func AddWxUserRaiLabel(item *WxUserRaiLabel) (err error) {
|
|
|
- o := orm.NewOrmUsingDB("hz_cygx")
|
|
|
+ o, err := orm.NewOrmUsingDB("hz_cygx").Begin()
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ defer func() {
|
|
|
+ fmt.Println(err)
|
|
|
+ if err == nil {
|
|
|
+ o.Commit()
|
|
|
+ } else {
|
|
|
+ o.Rollback()
|
|
|
+ }
|
|
|
+ }()
|
|
|
+
|
|
|
+ //删除原有数据
|
|
|
+ sql := ` DELETE FROM wx_user_rai_label WHERE user_id = ? AND label = ? `
|
|
|
+ _, err = o.Raw(sql, item.UserId, item.Label).Exec()
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
_, err = o.Insert(item)
|
|
|
+
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ itemLog := new(WxUserRaiLabelLog)
|
|
|
+ itemLog.UserId = item.UserId
|
|
|
+ itemLog.RealName = item.RealName
|
|
|
+ itemLog.Mobile = item.Mobile
|
|
|
+ itemLog.Email = item.Email
|
|
|
+ itemLog.CompanyId = item.CompanyId
|
|
|
+ itemLog.CompanyName = item.CompanyName
|
|
|
+ itemLog.Label = item.Label
|
|
|
+ itemLog.SourceId = item.SourceId
|
|
|
+ itemLog.SourceType = item.SourceType
|
|
|
+ itemLog.SysUserId = item.SysUserId
|
|
|
+ itemLog.SysUserRealName = item.SysUserRealName
|
|
|
+ itemLog.CreateTime = item.CreateTime
|
|
|
+ itemLog.ModifyTime = item.ModifyTime
|
|
|
+ //itemLog.RegisterPlatform = item.RegisterPlatform
|
|
|
+ itemLog.TableName = item.TableName
|
|
|
+ _, err = o.Insert(itemLog)
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -131,12 +199,13 @@ func GetWxUserRaiLabelDetailById(raiLabelId int) (item *WxUserRaiLabel, err erro
|
|
|
}
|
|
|
|
|
|
type WxUserRaiLabelDetailResp struct {
|
|
|
- SourceType int `description:"来源1:搜索关键字标签、2:产业/个股标签(线下活动)、3:产业/个股标签(线下路演)、4:产业/个股标签(线上活动)、5:产业/个股标签(线上路演)、6:销售输入标签、7:产业/个股标签(报告)、8:报告类型标签"`
|
|
|
- KeyWord *WxUserRaiLabelKeyWordResp
|
|
|
- Activity *WxUserRaiLabelActivityResp
|
|
|
- RoadShow *WxUserRaiLabelRoadShowResp
|
|
|
- Seller *WxUserRaiLabelSellerResp
|
|
|
- Article *WxUserRaiLabelArticleResp
|
|
|
+ SourceType int `description:"来源1:搜索关键字标签、2:产业/个股标签(线下活动)、3:产业/个股标签(线下路演)、4:产业/个股标签(线上活动)、5:产业/个股标签(线上路演)、6:销售输入标签、7:产业/个股标签(报告)、8:报告类型标签"`
|
|
|
+ KeyWord *WxUserRaiLabelKeyWordResp
|
|
|
+ Activity *WxUserRaiLabelActivityResp
|
|
|
+ RoadShow *WxUserRaiLabelRoadShowResp
|
|
|
+ Seller *WxUserRaiLabelSellerResp
|
|
|
+ Article *WxUserRaiLabelArticleResp
|
|
|
+ ActivityVivo *WxUserRaiLabelActivityVivoResp
|
|
|
}
|
|
|
|
|
|
type WxUserRaiLabelKeyWordResp struct {
|
|
@@ -152,6 +221,13 @@ type WxUserRaiLabelActivityResp struct {
|
|
|
Label string `description:"标签内容"`
|
|
|
}
|
|
|
|
|
|
+type WxUserRaiLabelActivityVivoResp struct {
|
|
|
+ Title string `description:"活动名称"`
|
|
|
+ ActivityTime string `description:"活动时间"`
|
|
|
+ Label string `description:"标签内容"`
|
|
|
+ CreateTime string `description:"查看时间"`
|
|
|
+}
|
|
|
+
|
|
|
type WxUserRaiLabelRoadShowResp struct {
|
|
|
Theme string `description:"会议主题"`
|
|
|
ResearcherName string `description:"研究员名称"`
|