|
@@ -8,16 +8,18 @@ import (
|
|
|
)
|
|
|
|
|
|
type Custom struct {
|
|
|
- CompanyId int `description:"客户id"`
|
|
|
- CompanyName string `description:"客户名称"`
|
|
|
- Nation string `description:"国家"`
|
|
|
- SellerId int `description:"销售id"`
|
|
|
- SellerName string `description:"销售名称"`
|
|
|
- CompanyStatus string `description:"状态"`
|
|
|
- ViewTotal int `description:"累计点击量"`
|
|
|
- RoadShowTotal int `description:"路演数量"`
|
|
|
- LastViewTime string `description:"最近阅读时间"`
|
|
|
- CreateTime string `description:"创建时间"`
|
|
|
+ CompanyId int `description:"客户id"`
|
|
|
+ CompanyName string `description:"客户名称"`
|
|
|
+ Nation string `description:"国家"`
|
|
|
+ SellerId int `description:"销售id"`
|
|
|
+ SellerName string `description:"销售名称"`
|
|
|
+ CompanyStatus string `description:"状态"`
|
|
|
+ ViewTotal int `description:"累计点击量"`
|
|
|
+ RoadShowTotal int `description:"路演数量"`
|
|
|
+ LastViewTime string `description:"最近阅读时间"`
|
|
|
+ CreateTime string `description:"创建时间"`
|
|
|
+ IsHide int `description:"是否隐藏:0:不隐藏,1:隐藏"`
|
|
|
+ OverseasStatus int `description:"海外客户状态:'正式','试用','关闭'"`
|
|
|
}
|
|
|
|
|
|
type CustomTotal struct {
|
|
@@ -154,7 +156,7 @@ func (obj *Custom) GetCustomList(condition string, pars []interface{}, companySt
|
|
|
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.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
|
|
|
INNER JOIN overseas_custom_seller AS c ON b.seller_id=c.seller_id
|
|
@@ -172,7 +174,7 @@ func (obj *Custom) GetCustomList(condition string, pars []interface{}, companySt
|
|
|
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.view_total,0 AS road_show_total,t.create_time,'' AS last_view_time,a.is_hide,a.overseas_status
|
|
|
FROM %s.english_company AS t
|
|
|
INNER JOIN overseas_custom_seller AS n ON t.seller_id=n.seller_id
|
|
|
WHERE 1=1 `
|
|
@@ -217,3 +219,48 @@ type CustomListResp struct {
|
|
|
Paging *paging.PagingItem
|
|
|
List []*Custom
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+type CustomHideReq struct {
|
|
|
+ CompanyId int `description:"客户ID"`
|
|
|
+}
|
|
|
+
|
|
|
+func (obj *Custom) GetCustomByCompanyId(companyId int) (list *Custom, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := ``
|
|
|
+ var databaseName string
|
|
|
+ if utils.RunMode == "debug" {
|
|
|
+ databaseName = "test_v2_hongze_rddp"
|
|
|
+ } else {
|
|
|
+ databaseName = "hongze_rddp"
|
|
|
+ }
|
|
|
+
|
|
|
+ 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
|
|
|
+ INNER JOIN overseas_custom_seller AS c ON b.seller_id=c.seller_id
|
|
|
+ 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,a.is_hide,a.overseas_status
|
|
|
+ FROM %s.english_company AS t
|
|
|
+ INNER JOIN overseas_custom_seller AS n ON t.seller_id=n.seller_id
|
|
|
+ WHERE 1=1 `
|
|
|
+
|
|
|
+ sql += ` )AS m WHERE 1=1 `
|
|
|
+
|
|
|
+ sql += ` AND m.company_id=? `
|
|
|
+ sql = fmt.Sprintf(sql, databaseName)
|
|
|
+ _, err = o.Raw(sql, companyId).QueryRows(&list)
|
|
|
+ return
|
|
|
+}
|