瀏覽代碼

Merge branch 'hotfix/v1.0.4.1' of https://jygit.jydev.jianyu360.cn/CRM/application into hotfix/v1.0.4.1

wangchuanjin 1 年之前
父節點
當前提交
fe3d10cac0
共有 1 個文件被更改,包括 8 次插入4 次删除
  1. 8 4
      api/internal/service/owner.go

+ 8 - 4
api/internal/service/owner.go

@@ -136,7 +136,11 @@ func (t *OwnerService) OwnerlList() map[string]interface{} {
 	startIndex := (t.PageIndex - 1) * t.PageSize
 	endIndex := t.PageIndex * t.PageSize
 	sort.Slice(returnData, func(i, j int) bool {
-		return returnData[i].Zbtime < returnData[j].Zbtime
+		if returnData[i].Zbtime != 0 {
+			return returnData[i].Zbtime > returnData[j].Zbtime
+		} else {
+			return returnData[i].BuyerId > returnData[j].BuyerId
+		}
 	})
 	if startIndex < gconv.Int64(len(returnData)) {
 		if endIndex > gconv.Int64(len(returnData)) {
@@ -225,7 +229,7 @@ func Findwinner(buyerArr []string, returnData []map[string]interface{}) []map[st
 	from
 			transaction_info     
 	where
-		buyer_id in (%s)`, strings.Join(buyerArr, ","))
+		buyer_id in (%s) order by  zbtime DESC,project_id DESC  `, strings.Join(buyerArr, ","))
 	winnerArr := SupplierFindConnectionsHandle(winnerSql)
 	if winnerArr != nil && len(winnerArr) > 0 {
 		//企业联系人处理
@@ -1053,11 +1057,11 @@ func (t *OwnerService) OwnerCooperate() []map[string]interface{} {
 			transaction_info     
 		ARRAY 
 		JOIN winner_id  as  winnerId  
-		where  buyer_id= '%s' and  winnerId='%s'`, t.BuyerId, t.WinnerId)
+		where  buyer_id= '%s' and  winnerId='%s' order by  zbtime DESC,project_id DESC `, t.BuyerId, t.WinnerId)
 		dataArr = TimeFindConnectionsHandle(supplierSql)
 	} else if t.CooperateType == "agency" {
 		//代理机构
-		agentSql := fmt.Sprintf(`select  zbtime,project_id,project_name  from   transaction_info  where  buyer_id ='%s' and  agency_id ='%s' order by zbtime,winner_id `, t.BuyerId, t.WinnerId)
+		agentSql := fmt.Sprintf(`select  zbtime,project_id,project_name  from   transaction_info  where  buyer_id ='%s' and  agency_id ='%s' order by  zbtime DESC,project_id DESC   `, t.BuyerId, t.WinnerId)
 		dataArr = TimeFindConnectionsHandle(agentSql)
 	}
 	if dataArr != nil && len(dataArr) > 0 {