|
@@ -21,6 +21,7 @@ type Custom struct {
|
|
|
IsHide int `description:"是否隐藏:0:不隐藏,1:隐藏"`
|
|
|
OverseasStatus string `description:"海外客户状态:'正式','试用','关闭'"`
|
|
|
Source int `description:"来源:1,英文客户,2:客户列表"`
|
|
|
+ OverseasLabel int `description:"海外客户试用子标签:1未分类、2 推进、3 跟踪、4 预备、"`
|
|
|
}
|
|
|
|
|
|
type CustomTotal struct {
|
|
@@ -158,7 +159,7 @@ func (obj *Custom) GetCustomList(condition string, pars []interface{}, companySt
|
|
|
WHEN '试用' THEN '试用'
|
|
|
ELSE '关闭' END AS company_status,
|
|
|
b.view_total,b.road_show_total,a.created_time AS create_time,b.last_view_time,a.is_hide,a.overseas_status,
|
|
|
- 2 AS source
|
|
|
+ 2 AS source,b.overseas_label
|
|
|
FROM company AS a
|
|
|
INNER JOIN company_product AS b ON a.company_id=b.company_id
|
|
|
INNER JOIN overseas_custom_seller AS c ON b.seller_id=c.seller_id
|
|
@@ -177,7 +178,7 @@ func (obj *Custom) GetCustomList(condition string, pars []interface{}, companySt
|
|
|
WHEN 0 THEN '关闭'
|
|
|
ELSE '试用' END AS company_status,
|
|
|
t.view_total,0 AS road_show_total,t.create_time,'' AS last_view_time,t.is_hide,t.overseas_status,
|
|
|
- 1 AS source
|
|
|
+ 1 AS source,t.overseas_label
|
|
|
FROM %s.english_company AS t
|
|
|
INNER JOIN overseas_custom_seller AS n ON t.seller_id=n.seller_id
|
|
|
WHERE 1=1 `
|
|
@@ -218,9 +219,10 @@ func (obj *Custom) GetCustomList(condition string, pars []interface{}, companySt
|
|
|
}
|
|
|
|
|
|
type CustomListResp struct {
|
|
|
- Paging *paging.PagingItem
|
|
|
- List []*Custom
|
|
|
- StatisticsData []*CustomTotal
|
|
|
+ Paging *paging.PagingItem
|
|
|
+ List []*Custom
|
|
|
+ StatisticsData []*CustomTotal
|
|
|
+ OverseasLabelData []*OverseasLabelTotal
|
|
|
}
|
|
|
|
|
|
// EnglishCompanySaveReq 英文客户-保存请求体
|
|
@@ -267,3 +269,54 @@ func (obj *Custom) GetCustomByCompanyId(companyId int) (list *Custom, err error)
|
|
|
_, err = o.Raw(sql, companyId).QueryRows(&list)
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+type OverseasLabelTotal struct {
|
|
|
+ OverseasLabel int `description:"海外客户试用子标签:1未分类、2 推进、3 跟踪、4 预备、"`
|
|
|
+ Total int `description:"总数"`
|
|
|
+}
|
|
|
+
|
|
|
+func (obj *Custom) GetCustomOverseasLabelTotal(condition string, pars []interface{}) (list []*OverseasLabelTotal, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := ``
|
|
|
+ var databaseName string
|
|
|
+ if utils.RunMode == "debug" {
|
|
|
+ databaseName = "test_v2_hongze_rddp"
|
|
|
+ } else {
|
|
|
+ databaseName = "hongze_rddp"
|
|
|
+ }
|
|
|
+
|
|
|
+ sql = `SELECT overseas_label,COUNT(1) AS total FROM (
|
|
|
+ SELECT a.company_id,a.company_name,a.nation,b.seller_id,b.seller_name,
|
|
|
+ CASE b.status
|
|
|
+ WHEN '正式' THEN '正式'
|
|
|
+ WHEN '永续' THEN '正式'
|
|
|
+ WHEN '试用' THEN '试用'
|
|
|
+ ELSE '关闭' END AS company_status,
|
|
|
+ b.view_total,b.road_show_total,a.created_time AS create_time,b.last_view_time,b.overseas_label
|
|
|
+ FROM company AS a
|
|
|
+ INNER JOIN company_product AS b ON a.company_id=b.company_id
|
|
|
+ INNER JOIN overseas_custom_seller AS c ON b.seller_id=c.seller_id
|
|
|
+ WHERE b.is_overseas = 0
|
|
|
+ UNION ALL
|
|
|
+ SELECT t.company_id+10000000,t.company_name,t.nation,t.seller_id,t.seller_name,
|
|
|
+ CASE t.enabled
|
|
|
+ WHEN 0 THEN '关闭'
|
|
|
+ ELSE '试用' END AS company_status,
|
|
|
+ t.view_total,0 AS road_show_total,t.create_time,'' AS last_view_time,t.overseas_label
|
|
|
+ FROM %s.english_company AS t
|
|
|
+ INNER JOIN overseas_custom_seller AS n ON t.seller_id=n.seller_id
|
|
|
+ )AS m
|
|
|
+ WHERE 1=1
|
|
|
+`
|
|
|
+
|
|
|
+ if condition != "" {
|
|
|
+ sql += condition
|
|
|
+ }
|
|
|
+
|
|
|
+ sql += ` GROUP BY m.overseas_label `
|
|
|
+
|
|
|
+ sql = fmt.Sprintf(sql, databaseName)
|
|
|
+
|
|
|
+ _, err = o.Raw(sql, pars).QueryRows(&list)
|
|
|
+ return
|
|
|
+}
|