|
@@ -6,7 +6,6 @@ import (
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
|
"io/ioutil"
|
|
|
- "log"
|
|
|
"math"
|
|
|
"net/http"
|
|
|
"net/url"
|
|
@@ -23,6 +22,7 @@ import (
|
|
|
"app.yhyue.com/moapp/jybase/es"
|
|
|
. "bp.jydev.jianyu360.cn/BaseService/biService/entity"
|
|
|
"bp.jydev.jianyu360.cn/BaseService/biService/rpc/biservice"
|
|
|
+ "github.com/zeromicro/go-zero/core/logx"
|
|
|
)
|
|
|
|
|
|
const (
|
|
@@ -70,19 +70,19 @@ func ClueImportTtSync(this *biservice.ClueImportReq) (string, int) {
|
|
|
id_new := common.GetMd5String(fmt.Sprintf("%s_%d", common.ObjToString(v["id"]), common.Int64All(v["multipackage_id"])))
|
|
|
v["id_new"] = id_new
|
|
|
if BiService.Count("customer_data_ttzl", map[string]interface{}{"id_new": id_new}) > 0 {
|
|
|
- log.Println("数据重复", id)
|
|
|
+ logx.Info("数据重复", id)
|
|
|
return
|
|
|
}
|
|
|
if dataId := BiService.Insert("customer_data_ttzl", v); dataId > 0 {
|
|
|
if details, ok := CreateEs(v); ok {
|
|
|
BiService.Insert("customer_data_ttzl_gl", map[string]interface{}{"msg_id": dataId, "info_id": id, "details": details, "isHistory": "否"})
|
|
|
atomic.AddInt64(&counts, 1)
|
|
|
- log.Println("es存入成功", id)
|
|
|
+ logx.Info("es存入成功", id)
|
|
|
} else {
|
|
|
- log.Println("es存入失败!!", id)
|
|
|
+ logx.Info("es存入失败!!", id)
|
|
|
}
|
|
|
} else {
|
|
|
- log.Println("tidb存入失败!!", id)
|
|
|
+ logx.Info("tidb存入失败!!", id)
|
|
|
}
|
|
|
}(v)
|
|
|
}
|
|
@@ -107,7 +107,7 @@ func ClueImportTtSync(this *biservice.ClueImportReq) (string, int) {
|
|
|
func CreateEsById(newId string) bool {
|
|
|
data := BiService.FindOne("customer_data_ttzl", map[string]interface{}{"id_new": newId}, "", "")
|
|
|
if data == nil || len(*data) == 0 {
|
|
|
- log.Println("没有找到该数据", newId)
|
|
|
+ logx.Info("没有找到该数据", newId)
|
|
|
return false
|
|
|
}
|
|
|
_, ok := CreateEs(*data)
|
|
@@ -144,7 +144,7 @@ func CreateEs(v map[string]interface{}) (string, bool) {
|
|
|
client.Delete().Index("ttbid").Id(newId).Refresh("true").Do(context.TODO())
|
|
|
_, err := client.Index().Index("ttbid").Id(newId).BodyJson(v).Refresh("true").Do(context.TODO())
|
|
|
if err != nil {
|
|
|
- log.Println("保存到ES出错", err.Error())
|
|
|
+ logx.Info("保存到ES出错", err.Error())
|
|
|
return details, false
|
|
|
} else {
|
|
|
return details, true
|
|
@@ -157,7 +157,7 @@ func DelById(index, id string) bool {
|
|
|
defer esV7.DestoryEsConn(client)
|
|
|
_, err := client.Delete().Index(index).Id(id).Refresh("true").Do(context.TODO())
|
|
|
if err != nil {
|
|
|
- log.Println("删除es出错:", id, err)
|
|
|
+ logx.Info("删除es出错:", id, err)
|
|
|
return false
|
|
|
}
|
|
|
return true
|
|
@@ -214,7 +214,7 @@ func ClueAdd(this *biservice.ClueAddReq, col string) *biservice.AddProjectResp {
|
|
|
bs, err := doGet(url)
|
|
|
if err != nil {
|
|
|
status = -1
|
|
|
- log.Println("调用接口失败")
|
|
|
+ logx.Info("调用接口失败")
|
|
|
} else {
|
|
|
resMap := common.StringToMap(string(bs))
|
|
|
if resMap["success"] != nil && resMap["success"].(bool) {
|
|
@@ -235,7 +235,7 @@ func ClueAdd(this *biservice.ClueAddReq, col string) *biservice.AddProjectResp {
|
|
|
|
|
|
func DistributeClue(this *biservice.DistributeClueReq) *biservice.AddProjectResp {
|
|
|
count, status := DistributeClueSync(this)
|
|
|
- log.Println("分配数量 ", count)
|
|
|
+ logx.Info("分配数量 ", count)
|
|
|
return &biservice.AddProjectResp{
|
|
|
ErrorCode: 0,
|
|
|
Data: &biservice.AddProject{
|
|
@@ -249,7 +249,7 @@ func getToken() string {
|
|
|
url := "https://a1.7x24cc.com/accessToken?account=N000000029739&appid=w4w2ex0bnt1n61or&secret=3c8f7dd04d2c11edb786132b38c4d48a"
|
|
|
bs, err := doGet(url)
|
|
|
if err != nil {
|
|
|
- log.Println("token生成失败", err)
|
|
|
+ logx.Info("token生成失败", err)
|
|
|
return ""
|
|
|
}
|
|
|
tokenMap := common.StringToMap(string(bs))
|
|
@@ -387,7 +387,7 @@ func DistributeClueMore(saleMap map[string]map[string]interface{}, distributedAr
|
|
|
"operator_id": thispositionId,
|
|
|
})
|
|
|
} else {
|
|
|
- log.Println("私海修改失败 ", v, positionId, seatNumber)
|
|
|
+ logx.Info("私海修改失败 ", v, positionId, seatNumber)
|
|
|
}
|
|
|
} else {
|
|
|
updateClue := map[string]interface{}{
|
|
@@ -477,7 +477,7 @@ func DistributeClueMore(saleMap map[string]map[string]interface{}, distributedAr
|
|
|
})
|
|
|
}
|
|
|
} else {
|
|
|
- log.Println("私海插入失败 ", v, positionId, seatNumber)
|
|
|
+ logx.Info("私海插入失败 ", v, positionId, seatNumber)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -488,7 +488,7 @@ func DistributeClueMore(saleMap map[string]map[string]interface{}, distributedAr
|
|
|
|
|
|
func DrawClue(this *biservice.DrawClueReq) *biservice.AddProjectResp {
|
|
|
count, status := DrawClueSync(this)
|
|
|
- log.Println("领取数量 ", count)
|
|
|
+ logx.Info("领取数量 ", count)
|
|
|
return &biservice.AddProjectResp{
|
|
|
ErrorCode: 0,
|
|
|
Data: &biservice.AddProject{
|
|
@@ -524,8 +524,8 @@ func DrawClueSync(this *biservice.DrawClueReq) (int, int) {
|
|
|
counts3 += counts2 - count2
|
|
|
counts2 = count2
|
|
|
}
|
|
|
- log.Println(count1, count2)
|
|
|
- log.Println(counts1, counts2, counts3)
|
|
|
+ logx.Info(count1, count2)
|
|
|
+ logx.Info(counts1, counts2, counts3)
|
|
|
return DrawClues(this.PositionId, counts1, counts2, counts3), 1
|
|
|
} else {
|
|
|
return 0, 2
|
|
@@ -758,10 +758,10 @@ func batchDraw(data []map[string]interface{}, nowTime, seatNumber, name string,
|
|
|
}
|
|
|
return ok1 && recordId > 0 && recordId1 > 0 && recordId2 > 0 && recordId3 > -1 && recordId4 > -1
|
|
|
}) {
|
|
|
- log.Println("领取线索成功")
|
|
|
+ logx.Info("领取线索成功")
|
|
|
count++
|
|
|
} else {
|
|
|
- log.Println("领取线索失败")
|
|
|
+ logx.Info("领取线索失败")
|
|
|
}
|
|
|
}
|
|
|
return count
|
|
@@ -1214,6 +1214,6 @@ func doGet(url string) ([]byte, error) {
|
|
|
defer func() {
|
|
|
_ = resp.Body.Close()
|
|
|
}()
|
|
|
- log.Println(url, "调用结果 ", string(bs))
|
|
|
+ logx.Info(url, "调用结果 ", string(bs))
|
|
|
return bs, nil
|
|
|
}
|