소스 검색

推送取消FICC客户

xingzai 3 년 전
부모
커밋
d6e34237ef
2개의 변경된 파일17개의 추가작업 그리고 9개의 파일을 삭제
  1. 5 2
      models/send_company_user.go
  2. 12 7
      services/send_company_user.go

+ 5 - 2
models/send_company_user.go

@@ -80,8 +80,9 @@ func GetSendCompanyList() (items []*CompanyJson, err error) {
 			AND p.STATUS IN ( '正式', '试用' ) 
 			AND a.STATUS IN ( '正式', '试用' )
 			AND c.credit_code != ''
+			AND p.product_id = 2
 		GROUP BY
-			c.company_id LIMIT 3 `
+			c.company_id  `
 	_, err = o.Raw(sql).QueryRows(&items)
 	return
 }
@@ -123,10 +124,12 @@ func GetSendUserList() (items []*UserJson, err error) {
 				AND b.cygx_auth = 1 
 				AND p.STATUS IN ( '正式', '试用' ) 
 				AND a.STATUS IN ( '正式', '试用' ) 
+				AND p.product_id = 2
 			GROUP BY
 				c.company_id 
 			) 
-			AND c.credit_code != '' LIMIT 3`
+			AND c.credit_code != '' `
+
 	_, err = o.Raw(sql).QueryRows(&items)
 	return
 }

+ 12 - 7
services/send_company_user.go

@@ -82,12 +82,13 @@ func Dotognbu() {
 	var companyItems []*models.CompanyJson
 	if len(companyList) > 0 {
 		url = "https://crm.hzinsights.com/openapi/v1/Customer/batchSyncFiccCustomer?access_token=" + accessToken
-		for k, v := range companyList {
-			if v.Permission == "策略" {
-				companyList[k].Fe = "FICC"
-			} else {
-				companyList[k].Fe = "权益"
-			}
+		for k, _ := range companyList {
+			//if v.Permission == "策略" {
+			//	companyList[k].Fe = "FICC"
+			//} else {
+			//
+			//}
+			companyList[k].Fe = "权益"
 			//一次同步一百条
 			companyItems = append(companyItems, companyList[k])
 			if (k+1)%100 == 0 {
@@ -134,6 +135,9 @@ func Dotognbu() {
 			}
 			userList[k].CountryCode = "+" + v.CountryCode
 			userList[k].OutboundCountryCode = "+" + v.OutboundCountryCode
+			if userList[k].Mobile != "" && userList[k].OutboundMobile != "" && userList[k].Mobile == userList[k].OutboundMobile {
+				userList[k].OutboundMobile = ""
+			}
 			//一次同步一百条
 			userItems = append(userItems, userList[k])
 			if (k+1)%100 == 0 {
@@ -144,9 +148,10 @@ func Dotognbu() {
 				jsonstr := string(data)
 				jsonstr = "{\"sync_data\": " + jsonstr + " }"
 				SendComapnyToShanghai(url, jsonstr)
-				companyItems = make([]*models.CompanyJson, 0)
+				userItems = make([]*models.UserJson, 0)
 			}
 		}
+
 		//如果剩下还有则同步剩下的部分
 		if len(userItems) > 0 {
 			data, err := json.Marshal(userItems)