|
@@ -22,6 +22,7 @@ type Custom struct {
|
|
|
OverseasStatus string `description:"海外客户状态:'正式','试用','关闭'"`
|
|
|
Source int `description:"来源:1,英文客户,2:客户列表"`
|
|
|
OverseasLabel int `description:"海外客户试用子标签:1未分类、2 推进、3 跟踪、4 预备、"`
|
|
|
+ ResetBtn int `description:"转正式和重置按钮:同步过来默认为0:显示转正式为1:显示重置为2"`
|
|
|
}
|
|
|
|
|
|
type CustomTotal struct {
|
|
@@ -41,11 +42,6 @@ func (obj *Custom) GetCustomTotal(condition string, pars []interface{}) (list []
|
|
|
|
|
|
sql = `SELECT company_status,COUNT(1) AS total,is_hide 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,a.is_hide,a.overseas_status,b.overseas_label
|
|
|
FROM company AS a
|
|
|
INNER JOIN company_product AS b ON a.company_id=b.company_id
|
|
@@ -53,9 +49,6 @@ func (obj *Custom) GetCustomTotal(condition string, pars []interface{}) (list []
|
|
|
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.is_hide,t.overseas_status,t.overseas_label
|
|
|
FROM %s.english_company AS t
|
|
|
INNER JOIN overseas_custom_seller AS n ON t.seller_id=n.seller_id
|
|
@@ -88,11 +81,6 @@ func (obj *Custom) GetCustomOverseasStatusTotal(condition string, pars []interfa
|
|
|
|
|
|
sql = `SELECT 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,a.is_hide,a.overseas_status,b.overseas_label
|
|
|
FROM company AS a
|
|
|
INNER JOIN company_product AS b ON a.company_id=b.company_id
|
|
@@ -100,9 +88,6 @@ func (obj *Custom) GetCustomOverseasStatusTotal(condition string, pars []interfa
|
|
|
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.is_hide,t.overseas_status,t.overseas_label
|
|
|
FROM %s.english_company AS t
|
|
|
INNER JOIN overseas_custom_seller AS n ON t.seller_id=n.seller_id
|
|
@@ -146,11 +131,6 @@ func (obj *Custom) GetCustomListCount(condition string, pars []interface{}, comp
|
|
|
|
|
|
sql = `SELECT COUNT(1) AS count 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,a.is_hide,a.overseas_status,b.overseas_label
|
|
|
FROM company AS a
|
|
|
INNER JOIN company_product AS b ON a.company_id=b.company_id
|
|
@@ -166,9 +146,6 @@ func (obj *Custom) GetCustomListCount(condition string, pars []interface{}, comp
|
|
|
sql += `
|
|
|
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.is_hide,t.overseas_status,t.overseas_label
|
|
|
FROM %s.english_company AS t
|
|
|
INNER JOIN overseas_custom_seller AS n ON t.seller_id=n.seller_id
|
|
@@ -202,13 +179,8 @@ func (obj *Custom) GetCustomList(condition string, pars []interface{}, companySt
|
|
|
|
|
|
sql = `SELECT * 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,a.is_hide,a.overseas_status,
|
|
|
- 2 AS source,b.overseas_label
|
|
|
+ 2 AS source,b.overseas_label,a.reset_btn
|
|
|
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
|
|
@@ -223,11 +195,8 @@ func (obj *Custom) GetCustomList(condition string, pars []interface{}, companySt
|
|
|
sql += `
|
|
|
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,t.road_show_total,t.create_time,t.last_view_time,t.is_hide,t.overseas_status,
|
|
|
- 1 AS source,t.overseas_label
|
|
|
+ 1 AS source,t.overseas_label,t.reset_btn
|
|
|
FROM %s.english_company AS t
|
|
|
INNER JOIN overseas_custom_seller AS n ON t.seller_id=n.seller_id
|
|
|
WHERE 1=1 AND t.is_deleted=0 `
|
|
@@ -294,11 +263,6 @@ func (obj *Custom) GetCustomByCompanyId(companyId int) (item *Custom, err error)
|
|
|
|
|
|
sql = `SELECT * 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,a.is_hide,a.overseas_status
|
|
|
FROM company AS a
|
|
|
INNER JOIN company_product AS b ON a.company_id=b.company_id
|
|
@@ -306,9 +270,6 @@ func (obj *Custom) GetCustomByCompanyId(companyId int) (item *Custom, err error)
|
|
|
WHERE b.is_overseas = 0`
|
|
|
sql += ` 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.is_hide,t.overseas_status
|
|
|
FROM %s.english_company AS t
|
|
|
INNER JOIN overseas_custom_seller AS n ON t.seller_id=n.seller_id
|
|
@@ -339,11 +300,6 @@ func (obj *Custom) GetCustomOverseasLabelTotal(condition string, pars []interfac
|
|
|
|
|
|
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,a.is_hide,a.overseas_status,b.overseas_label
|
|
|
FROM company AS a
|
|
|
INNER JOIN company_product AS b ON a.company_id=b.company_id
|
|
@@ -351,9 +307,6 @@ func (obj *Custom) GetCustomOverseasLabelTotal(condition string, pars []interfac
|
|
|
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.is_hide,t.overseas_status,t.overseas_label
|
|
|
FROM %s.english_company AS t
|
|
|
INNER JOIN overseas_custom_seller AS n ON t.seller_id=n.seller_id
|
|
@@ -378,3 +331,11 @@ type CustomOverseasLabelSetReq struct {
|
|
|
CompanyId int `description:"客户ID"`
|
|
|
OverseasLabel int `description:"海外客户试用子标签:1未分类、2 推进、3 跟踪、4 预备、"`
|
|
|
}
|
|
|
+
|
|
|
+// 更新客户产品信息
|
|
|
+func (obj *Custom) UpdateCompanyProductOverseasLabel(overseasLabel, companyId int) (err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := ` UPDATE company_product SET overseas_label=? WHERE company_id=? AND product_id=1 `
|
|
|
+ _, err = o.Raw(sql, overseasLabel, companyId).Exec()
|
|
|
+ return
|
|
|
+}
|