|
@@ -116,6 +116,33 @@ func SendComapnyToShanghai(url, jsonCompany, postType string) (err error) {
|
|
|
}
|
|
|
|
|
|
func DotongbuShangHai(cont context.Context) (err error) {
|
|
|
+ var condition string
|
|
|
+ updateTime := time.Now().Add(-time.Hour * 30).Format("2006-01-02 15:04:05")
|
|
|
+ listUpdateUser, err := models.GetWxUserOpLog(updateTime)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ var companyIds string
|
|
|
+ if len(listUpdateUser) > 0 {
|
|
|
+ for _, v := range listUpdateUser {
|
|
|
+ companyIds += strconv.Itoa(v.CompanyId) + ","
|
|
|
+ }
|
|
|
+ }
|
|
|
+ condition = ` AND p.modify_time > ` + "'" + updateTime + "'"
|
|
|
+ //同30小时有变更的公司
|
|
|
+ go DotongbuShangHaApi(condition)
|
|
|
+
|
|
|
+ //原有的公司如果新增了也同步
|
|
|
+ companyIds = strings.TrimRight(companyIds, ",")
|
|
|
+ if companyIds != "" {
|
|
|
+ condition = ` AND c.company_id IN (` + companyIds + ")"
|
|
|
+ go DotongbuShangHaApi(condition)
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+//func DotongbuShangHai(cont context.Context) (err error) {
|
|
|
+func DotongbuShangHaApi(condition string) (err error) {
|
|
|
var msg string
|
|
|
defer func() {
|
|
|
if err != nil {
|
|
@@ -123,10 +150,10 @@ func DotongbuShangHai(cont context.Context) (err error) {
|
|
|
}
|
|
|
}()
|
|
|
//同步24小时之前的数据到上海平台,为防止遗漏改成30小时
|
|
|
- var condition string
|
|
|
- updateTime := time.Now().Add(-time.Hour * 30).Format("2006-01-02 15:04:05")
|
|
|
- condition = ` AND p.modify_time > ` + "'" + updateTime + "'"
|
|
|
- fmt.Println(condition)
|
|
|
+
|
|
|
+ //updateTime := time.Now().Add(-time.Hour * 30).Format("2006-01-02 15:04:05")
|
|
|
+ //condition = ` AND p.modify_time > ` + "'" + updateTime + "'"
|
|
|
+ //fmt.Println(condition)
|
|
|
//获取token
|
|
|
url := "https://crm.hzinsights.com/openapi/v1/auth/getAccessToken?app_key=26945134&app_secret=b99cb2bdec70d20156000f664ec5ac30"
|
|
|
method := "GET"
|