Browse Source

no message

xingzai 3 years ago
parent
commit
800c2d18f7
3 changed files with 38 additions and 26 deletions
  1. 10 3
      models/send_company_user.go
  2. 27 22
      services/send_company_user.go
  3. 1 1
      services/task.go

+ 10 - 3
models/send_company_user.go

@@ -81,6 +81,7 @@ func GetSendCompanyList() (items []*CompanyJson, err error) {
 			AND a.STATUS IN ( '正式', '试用' )
 			AND( c.credit_code LIKE '91%'  OR  c.credit_code LIKE 'HZ%' ) 
 			AND p.product_id = 2
+			AND c.credit_code IN ('91469027MA5TW2803X','91330104MA27W2L868','913101133986714446','9144030059070789XY')
 		GROUP BY
 			c.company_id  `
 	_, err = o.Raw(sql).QueryRows(&items)
@@ -131,6 +132,7 @@ func GetSendCompanyFiccList() (items []*CompanyJson, err error) {
 			AND a.STATUS IN ( '正式', '试用' ) 
 			AND ( c.credit_code LIKE '91%' OR c.credit_code LIKE 'HZ%' ) 
 			AND p.product_id = 1 
+AND c.credit_code IN ('91469027MA5TW2803X','91330104MA27W2L868','913101133986714446','9144030059070789XY')
 			AND c.company_id NOT IN (
 			SELECT
 				c.company_id 
@@ -149,6 +151,7 @@ func GetSendCompanyFiccList() (items []*CompanyJson, err error) {
 				AND a.STATUS IN ( '正式', '试用' ) 
 				AND ( c.credit_code LIKE '91%' OR c.credit_code LIKE 'HZ%' ) 
 				AND p.product_id = 2 
+				AND c.credit_code IN ('91469027MA5TW2803X','91330104MA27W2L868','913101133986714446','9144030059070789XY')
 			GROUP BY
 				c.company_id 
 			) 
@@ -173,10 +176,11 @@ func GetSendUserList() (items []*UserJson, err error) {
 			u.email,
 			u.is_maker,
 			c.company_id,
-			UNIX_TIMESTAMP( u.created_time ) AS created_time 
+			UNIX_TIMESTAMP( us.create_time ) AS created_time 
 		FROM
 			wx_user AS u
-			INNER JOIN company AS c ON c.company_id = u.company_id 
+			INNER JOIN company AS c ON c.company_id = u.company_id
+			INNER JOIN user_seller_relation AS us ON us.user_id = u.user_id 
 		WHERE
 			1 = 1 
 			AND u.company_id IN (
@@ -195,11 +199,14 @@ func GetSendUserList() (items []*UserJson, err error) {
 				AND b.cygx_auth = 1 
 				AND p.STATUS IN ( '正式', '试用' ) 
 				AND a.STATUS IN ( '正式', '试用' )
+				AND us.create_time  != ''
+				AND c.credit_code IN ('9144030059070789XY')
+
 			GROUP BY
 				c.company_id 
 			) 
 			AND c.credit_code != '' `
-
+	//AND c.credit_code IN ('91469027MA5TW2803X','91330104MA27W2L868','913101133986714446','9144030059070789XY')
 	_, err = o.Raw(sql).QueryRows(&items)
 	return
 }

+ 27 - 22
services/send_company_user.go

@@ -4,8 +4,10 @@ import (
 	"encoding/json"
 	"fmt"
 	"hongze/hongze_cygx/models"
+	"hongze/hongze_cygx/utils"
 	"io/ioutil"
 	"net/http"
+	"strings"
 )
 
 type GetShangHaiTokenResultApi struct {
@@ -22,28 +24,30 @@ type ShangHaiResultApidate struct {
 
 //把信息同步到上海策略品台
 func SendComapnyToShanghai(url, jsonCompany string) {
-	//method := "POST"
-	//fmt.Println(string(jsonCompany))
-	//payload := strings.NewReader(jsonCompany)
-	//client := &http.Client{}
-	//req, err := http.NewRequest(method, url, payload)
-	//if err != nil {
-	//	fmt.Println(err)
-	//	return
-	//}
-	//req.Header.Add("Content-Type", "application/json")
-	//res, err := client.Do(req)
-	//if err != nil {
-	//	fmt.Println(err)
-	//	return
-	//}
-	//defer res.Body.Close()
-	//body, err := ioutil.ReadAll(res.Body)
-	//if err != nil {
-	//	fmt.Println(err)
-	//	return
-	//}
-	//fmt.Println(string(body))
+	method := "POST"
+	fmt.Println(string(jsonCompany))
+	utils.FileLog.Info(string(jsonCompany))
+	payload := strings.NewReader(jsonCompany)
+	client := &http.Client{}
+	req, err := http.NewRequest(method, url, payload)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+	req.Header.Add("Content-Type", "application/json")
+	res, err := client.Do(req)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+	defer res.Body.Close()
+	body, err := ioutil.ReadAll(res.Body)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+	utils.FileLog.Info(string(body))
+	fmt.Println(string(body))
 }
 
 func Dotognbu() {
@@ -169,6 +173,7 @@ func Dotognbu() {
 			userList[k].OutboundCountryCode = "+" + v.OutboundCountryCode
 			if userList[k].Mobile != "" && userList[k].OutboundMobile != "" && userList[k].Mobile == userList[k].OutboundMobile {
 				userList[k].OutboundMobile = ""
+				userList[k].OutboundCountryCode = ""
 			}
 			//一次同步一百条
 			userItems = append(userItems, userList[k])

+ 1 - 1
services/task.go

@@ -62,7 +62,7 @@ func Task() {
 	//GetAddpArticle() //同步日度点评数据
 	//SendEmailAllUserWithRAI()     //发送当前所有权益用户到沈大爷的邮箱
 	//SendEmailAllUserWithCompany() //发送这些公司下的用户到沈大爷的邮箱
-	task.StartTask()
+	//task.StartTask()
 	//StatisticalReport()//导出报表
 	fmt.Println("end")
 }