|
@@ -0,0 +1,65 @@
|
|
|
+package overseas_custom
|
|
|
+
|
|
|
+import (
|
|
|
+ "github.com/beego/beego/v2/client/orm"
|
|
|
+ "time"
|
|
|
+)
|
|
|
+
|
|
|
+type Custom struct {
|
|
|
+}
|
|
|
+
|
|
|
+type RsCompany struct {
|
|
|
+ CompanyId int
|
|
|
+ Total int
|
|
|
+}
|
|
|
+
|
|
|
+// EnglishCompany 英文客户
|
|
|
+type EnglishCompany struct {
|
|
|
+ CompanyId int `orm:"column(company_id);pk" description:"英文客户ID"`
|
|
|
+ CompanyName string `description:"客户名称"`
|
|
|
+ CountryCode string `description:"国家Code"`
|
|
|
+ Country string `description:"国家"`
|
|
|
+ SellerId int `description:"销售ID"`
|
|
|
+ SellerName string `description:"销售姓名"`
|
|
|
+ ViewTotal int `description:"累计点击量/阅读量"`
|
|
|
+ IsDeleted int `description:"删除状态:0-正常;1-已删除"`
|
|
|
+ CreateTime time.Time `description:"创建时间"`
|
|
|
+ ModifyTime time.Time `description:"更新时间"`
|
|
|
+ Enabled int `description:"0-禁用; 1-启用; 2-部分禁用"`
|
|
|
+ Status int `description:"1:正式,2:临时,3:终止"`
|
|
|
+ Nation string `description:"所属国家"`
|
|
|
+ IsHide int `description:"是否隐藏:0:不隐藏,1:隐藏"`
|
|
|
+ OverseasStatus string `description:"海外客户状态:'正式','试用','关闭'"`
|
|
|
+ OverseasLabel int `description:"海外客户试用子标签:1未分类、2 推进、3 跟踪、4 预备、"`
|
|
|
+ RoadShowTotal int `description:"累计路演次数"`
|
|
|
+}
|
|
|
+
|
|
|
+// 获取客户路演数据
|
|
|
+func (obj *Custom) GetRsCompanyTotal() (list []*RsCompany, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := `SELECT a.company_id,COUNT(1) AS total
|
|
|
+ FROM rs_calendar AS a
|
|
|
+ INNER JOIN rs_calendar_researcher AS b ON a.rs_calendar_id = b.rs_calendar_id
|
|
|
+ WHERE
|
|
|
+ a.source = 0
|
|
|
+ AND b.status = 2
|
|
|
+ AND a.english_company=1
|
|
|
+ GROUP BY a.company_id`
|
|
|
+ _, err = o.Raw(sql).QueryRows(&list)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// 获取所有英文客户
|
|
|
+func (obj *Custom) GetEnglishCompanyAll() (list []*EnglishCompany, err error) {
|
|
|
+ o := orm.NewOrmUsingDB("rddp")
|
|
|
+ sql := `SELECT * FROM english_company WHERE is_deleted = 0 `
|
|
|
+ _, err = o.Raw(sql).QueryRows(&list)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+func (obj *Custom) UpdateRoadShowTotal(companyId, total int) (err error) {
|
|
|
+ o := orm.NewOrmUsingDB("rddp")
|
|
|
+ sql := ` UPDATE english_company SET road_show_total=? WHERE company_id=? `
|
|
|
+ _, err = o.Raw(sql, total, companyId).Exec()
|
|
|
+ return
|
|
|
+}
|