|
@@ -1,58 +1,110 @@
|
|
|
package ent_contact
|
|
|
|
|
|
-func aaaa(tmp map[string]interface{}) {
|
|
|
- //buyer := qu.ObjToString(tmp["buyer"])
|
|
|
- //agency := qu.ObjToString(tmp["agency"])
|
|
|
- //winner := qu.ObjToString(tmp["winner"])
|
|
|
- //owner := qu.ObjToString(tmp["owner"])
|
|
|
- //s_winner := qu.ObjToString(tmp["s_winner"])
|
|
|
- //b_per := qu.ObjToString(tmp["buyerperson"])
|
|
|
- //b_tel := qu.ObjToString(tmp["buyertel"])
|
|
|
- //if utf8.RuneCountInString(b_tel) > 60 {
|
|
|
- // b_tel = ""
|
|
|
- //}
|
|
|
- //a_per := qu.ObjToString(tmp["agencyperson"])
|
|
|
- //a_tel := qu.ObjToString(tmp["agencytel"])
|
|
|
- //if utf8.RuneCountInString(a_tel) > 60 {
|
|
|
- // a_tel = ""
|
|
|
- //}
|
|
|
- //w_per := qu.ObjToString(tmp["winnerperson"])
|
|
|
- //w_tel := qu.ObjToString(tmp["winnertel"])
|
|
|
- //if utf8.RuneCountInString(w_tel) > 60 {
|
|
|
- // w_tel = ""
|
|
|
- //}
|
|
|
- //o_per := qu.ObjToString(tmp["project_person"])
|
|
|
- //o_tel := qu.ObjToString(tmp["project_phone"])
|
|
|
- //if utf8.RuneCountInString(o_tel) > 60 {
|
|
|
- // o_tel = ""
|
|
|
- //}
|
|
|
- //
|
|
|
- //buyerclass := qu.ObjToString(tmp["buyerclass"])
|
|
|
- //publishtime := qu.Int64All(tmp["publishtime"])
|
|
|
- //tmpid := ul.BsonTOStringId(tmp["_id"])
|
|
|
- //winner_arr, winner_bool := ul.SegmentationEntName(winner, s_winner)
|
|
|
- //
|
|
|
- //updateLock.Lock()
|
|
|
- //if buyer != "" && utf8.RuneCountInString(buyer) < 30 {
|
|
|
- // dealWithUpdateContact(buyer, buyerclass, &ul.Contact{b_per, b_tel, true, false, false, false, publishtime}, "0001", tmpid)
|
|
|
- //}
|
|
|
- ////中标单位
|
|
|
- //for k, v := range winner_arr {
|
|
|
- // b := winner_bool[k]
|
|
|
- // c := ul.Contact{"", "", false, false, true, false, publishtime}
|
|
|
- // if b {
|
|
|
- // c.Per = w_per
|
|
|
- // c.Tel = w_tel
|
|
|
+import (
|
|
|
+ "context"
|
|
|
+ ul "data_ent_wuye/ent_util"
|
|
|
+ log "github.com/donnie4w/go-logger/logger"
|
|
|
+ qu "jygit.jydev.jianyu360.cn/data_processing/common_utils"
|
|
|
+ "time"
|
|
|
+)
|
|
|
+
|
|
|
+// from tidb
|
|
|
+func InjectContactTidbInfo(tmp map[string]interface{}) {
|
|
|
+ index, total := 0, 0
|
|
|
+ query := map[string]interface{}{}
|
|
|
+L:
|
|
|
+ for {
|
|
|
+ dataArr := ul.MysqlGlobalTool.Find(ul.G_Units_Baseinfo, query, "", "id", index*50000, 50000)
|
|
|
+ if dataArr != nil {
|
|
|
+ if len(*dataArr) == 0 {
|
|
|
+ break
|
|
|
+ }
|
|
|
+ //for _, v := range *dataArr {
|
|
|
+ // tel :=
|
|
|
+ //}
|
|
|
+ } else {
|
|
|
+ break L
|
|
|
+ }
|
|
|
+ index++
|
|
|
+ total += len(*dataArr)
|
|
|
+ if index%5 == 0 {
|
|
|
+ log.Debug("cur idx ", total)
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// from 凭安库
|
|
|
+func InjectContactPingAnInfo(tmp map[string]interface{}) {
|
|
|
+ //name := qu.ObjToString(tmp["company_name"])
|
|
|
+ //phone := qu.ObjToString(tmp["company_phone"])
|
|
|
+ //email := qu.ObjToString(tmp["company_email"])
|
|
|
+ //createtime := time.Now().Format(ul.TimeLayout_New)
|
|
|
+ ////查询当前通讯录是否有数据
|
|
|
+ //if phone != "" {
|
|
|
+ // if !QueryingEntContact(uid,name,phone) {
|
|
|
+ // query := "INSERT INTO information.ent_contact(id,phone,name,email,create_time,update_time) VALUES(?,?,?,?,?,?)"
|
|
|
+ // //插入数据
|
|
|
+ // err := ul.ClickHouseConn.Exec(context.Background(), query, uid, phone, name, email, createtime, createtime)
|
|
|
+ // if err != nil {
|
|
|
+ // log.Debug(err)
|
|
|
+ // }
|
|
|
// }
|
|
|
- // dealWithUpdateContact(v, "", &c, "0010", tmpid)
|
|
|
- //}
|
|
|
- //
|
|
|
- //if agency != "" && utf8.RuneCountInString(agency) < 30 {
|
|
|
- // dealWithUpdateContact(agency, "", &ul.Contact{a_per, a_tel, false, true, false, false, publishtime}, "0100", tmpid)
|
|
|
//}
|
|
|
- //
|
|
|
- //if owner != "" && utf8.RuneCountInString(owner) < 30 {
|
|
|
- // dealWithUpdateContact(owner, "", &ul.Contact{o_per, o_tel, false, false, false, true, publishtime}, "1000", tmpid)
|
|
|
- //}
|
|
|
- //updateLock.Unlock()
|
|
|
+}
|
|
|
+
|
|
|
+// from 马克
|
|
|
+func InjectContactMaKeInfo(uid string, tmp map[string]interface{}) {
|
|
|
+ name := qu.ObjToString(tmp["company_name"])
|
|
|
+ phone := qu.ObjToString(tmp["company_phone"])
|
|
|
+ email := qu.ObjToString(tmp["company_email"])
|
|
|
+ source_type := 2
|
|
|
+ createtime := time.Now().Unix()
|
|
|
+ //查询当前通讯录是否有数据
|
|
|
+ if phone != "" {
|
|
|
+ msgs := GetEntContacts(uid)
|
|
|
+ if !QueryingExists(msgs, name, phone) {
|
|
|
+ query := "INSERT INTO information.ent_contact(id,phone,name,email,source_type,create_time,update_time) VALUES(?,?,?,?,?,?,?)"
|
|
|
+ //插入数据
|
|
|
+ err := ul.ClickHouseConn.Exec(context.Background(), query, uid, phone, name, email, source_type, createtime, createtime)
|
|
|
+ if err != nil {
|
|
|
+ log.Debug(err)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+func GetEntContacts(uid string) []Msg {
|
|
|
+ query := `SELECT id,name,phone FROM information.ent_contact WHERE id = ` + "'" + uid + "'"
|
|
|
+ rows, err := ul.ClickHouseConn.Query(context.Background(), query)
|
|
|
+ if err != nil {
|
|
|
+ log.Debug(err)
|
|
|
+ return []Msg{}
|
|
|
+ }
|
|
|
+ msgs := make([]Msg, 0)
|
|
|
+ for rows.Next() {
|
|
|
+ var msg Msg
|
|
|
+ rows.Scan(
|
|
|
+ &msg.id,
|
|
|
+ &msg.name,
|
|
|
+ &msg.phone,
|
|
|
+ )
|
|
|
+ msgs = append(msgs, msg)
|
|
|
+ }
|
|
|
+ return msgs
|
|
|
+}
|
|
|
+
|
|
|
+// 是否存在
|
|
|
+func QueryingExists(ects []Msg, name string, phone string) bool {
|
|
|
+ for _, msg := range ects {
|
|
|
+ if name == msg.name && phone == msg.phone {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false
|
|
|
+}
|
|
|
+
|
|
|
+type Msg struct {
|
|
|
+ id string
|
|
|
+ name string
|
|
|
+ phone string
|
|
|
}
|