Pārlūkot izejas kodu

新增标签和状态

hongze 1 gadu atpakaļ
vecāks
revīzija
d664d907a8

+ 37 - 2
controllers/overseas_custom/custom.go

@@ -130,6 +130,23 @@ func (this *OverseasCustomController) CustomList() {
 		return
 	}
 
+	statisticsDataStatusList := make([]*overseas_custom.CustomTotal, 0)
+	statisticsDataMap := make(map[string]int)
+	for _, v := range statisticsDataList {
+		statisticsDataMap[v.CompanyStatus] = v.Total
+	}
+
+	var statusArr = [3]string{"试用", "正式", "关闭"}
+
+	for _, v := range statusArr {
+		item := new(overseas_custom.CustomTotal)
+		item.CompanyStatus = v
+		if val, ok := statisticsDataMap[v]; ok {
+			item.Total = val
+		}
+		statisticsDataStatusList = append(statisticsDataStatusList, item)
+	}
+
 	overseasLabelDataList, err := obj.GetCustomOverseasLabelTotal(condition, pars)
 	if err != nil {
 		br.Msg = "获取失败"
@@ -137,13 +154,31 @@ func (this *OverseasCustomController) CustomList() {
 		return
 	}
 
+	labelDataMap := make(map[int]int)
+	for _, v := range overseasLabelDataList {
+		labelDataMap[v.OverseasLabel] = v.Total
+	}
+
+	var labelArr = [4]int{1, 2, 3, 4}
+
+	labelList := make([]*overseas_custom.OverseasLabelTotal, 0)
+
+	for _, v := range labelArr {
+		item := new(overseas_custom.OverseasLabelTotal)
+		item.OverseasLabel = v
+		if val, ok := labelDataMap[v]; ok {
+			item.Total = val
+		}
+		labelList = append(labelList, item)
+	}
+
 	page := paging.GetPaging(currentIndex, pageSize, total)
 
 	resp := new(overseas_custom.CustomListResp)
 	resp.Paging = page
 	resp.List = list
-	resp.StatisticsData = statisticsDataList
-	resp.OverseasLabelData = overseasLabelDataList
+	resp.StatisticsData = statisticsDataStatusList
+	resp.OverseasLabelData = labelList
 
 	br.Ret = 200
 	br.Success = true

+ 1 - 1
models/overseas_custom/custom.go

@@ -177,7 +177,7 @@ func (obj *Custom) GetCustomList(condition string, pars []interface{}, companySt
 				CASE t.enabled
 				WHEN 0 THEN '关闭'
 				ELSE '试用' END AS company_status,
-				t.view_total,t.road_show_total,t.create_time,'' AS last_view_time,t.is_hide,t.overseas_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
 				FROM %s.english_company AS t
 				INNER JOIN overseas_custom_seller AS n ON t.seller_id=n.seller_id