Browse Source

Merge branch 'CRM_15.6' into debug

# Conflicts:
#	models/company/company.go
#	services/statistic_report/company.go
zwxi 1 year ago
parent
commit
2eec712984
3 changed files with 12 additions and 3 deletions
  1. 10 3
      models/company/company.go
  2. 1 0
      services/statistic_report/company.go
  3. 1 0
      utils/constants.go

+ 10 - 3
models/company/company.go

@@ -219,7 +219,8 @@ type CompanyItem struct {
 	IsSigning           int                  `description:"是否签约过,1是,0否"`
 	SigningStatus       string               `description:"签约状态,已签约过/未签约过"`
 	CompanyStatusButton *CompanyStatusButton
-	Nation              string `description:"所属国家"`
+	Nation              string 				 `description:"所属国家"`
+	LatestServiceRecord time.Time               `description:"最近沟通时间"`
 }
 
 type CompanyListItem struct {
@@ -403,9 +404,15 @@ as sort_todo_end_time,
 			SUM(b.view_total) as all_view_total,
 			SUM(b.try_out_day_total) as all_try_out_day_total,
 			IF(LEFT(GROUP_CONCAT(DISTINCT b.last_view_time ORDER BY b.product_id), 19) >= "` + t + `", 1, 0) AS week_view_active,
-			a.nation
+			a.nation,
+			c.latest_service_record 
 			FROM company AS a
 			INNER JOIN company_product AS b ON a.company_id=b.company_id
+			LEFT JOIN (
+    SELECT company_id, MAX(create_time) AS latest_service_record
+    FROM company_service_record
+    GROUP BY company_id
+) AS c ON a.company_id = c.company_id
 			WHERE a.enabled=1  `
 	if condition != "" {
 		sql += condition
@@ -1964,4 +1971,4 @@ func GetOverseasCompanys() (items []*Company, err error) {
 	sql := ` SELECT * FROM company where region_type= '海外' `
 	_, err = o.Raw(sql).QueryRows(&items)
 	return
-}
+}

+ 1 - 0
services/statistic_report/company.go

@@ -557,6 +557,7 @@ func CompanyList(sysUser *system.Admin, req statisticModels.IncrementalCompanyLi
 				TryStageSlice:   tryStageSlice,
 				ShareSeller:     v.ShareSeller,
 				ShareSellerId: v.ShareSellerId,
+				LatestServiceRecord: v.LatestServiceRecord.Format(utils.FormatDate2),
 			}
 			if strings.Contains(companyList.ApproveStatus, "已审批") {
 				companyList.ApproveStatus = ""

+ 1 - 0
utils/constants.go

@@ -10,6 +10,7 @@ const (
 	FormatTime                 = "15:04:05"                //时间格式
 	FormatTimeHm               = "15:04"                   //时间格式
 	FormatDate                 = "2006-01-02"              //日期格式
+	FormatDate2                = "06-01-02"                //日期格式
 	FormatDateUnSpace          = "20060102"                //日期格式
 	FormatDateTime             = "2006-01-02 15:04:05"     //完整时间格式
 	HlbFormatDateTime          = "2006-01-02_15:04:05.999" //完整时间格式