|
@@ -20,11 +20,18 @@ import (
|
|
func increInvest() {
|
|
func increInvest() {
|
|
//每周三执行,查询 11天之前,update_time 的数据
|
|
//每周三执行,查询 11天之前,update_time 的数据
|
|
now := time.Now()
|
|
now := time.Now()
|
|
- start := now.AddDate(0, 0, -11)
|
|
|
|
|
|
+ //start := now.AddDate(0, 0, -2)
|
|
|
|
+ //start := time.Date(now.Year(), now.Month(), now.Day()-2, 0, 0, 0, 0, now.Location())
|
|
|
|
+ offset := int(time.Monday - now.Weekday())
|
|
|
|
+ if offset > 0 {
|
|
|
|
+ offset = -6
|
|
|
|
+ }
|
|
|
|
+ weekBeginDate := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location()).AddDate(0, 0, offset)
|
|
|
|
+ //weekMonday := weekBeginDate.Format("2006-01-02")
|
|
|
|
|
|
where := map[string]interface{}{
|
|
where := map[string]interface{}{
|
|
- "update_time": map[string]interface{}{
|
|
|
|
- "$gt": start.Format("2006-01-02"),
|
|
|
|
|
|
+ "jy_updatetime": map[string]interface{}{
|
|
|
|
+ "$gte": weekBeginDate.Unix(),
|
|
},
|
|
},
|
|
}
|
|
}
|
|
|
|
|
|
@@ -44,7 +51,8 @@ func increInvest() {
|
|
} else {
|
|
} else {
|
|
log.Info("increInvest", zap.String("clickhouse 打开成功", db.Name()))
|
|
log.Info("increInvest", zap.String("clickhouse 打开成功", db.Name()))
|
|
}
|
|
}
|
|
- query := sess.DB("mixdata").C("company_partner").Find(where).Select(nil).Sort("update_time").Iter()
|
|
|
|
|
|
+ log.Info("increInvest", zap.Any("where", where))
|
|
|
|
+ query := sess.DB("mixdata").C("company_partner").Find(where).Select(nil).Iter()
|
|
count := 0
|
|
count := 0
|
|
//datas := make([]EntMapCode, 0)
|
|
//datas := make([]EntMapCode, 0)
|
|
for tmp := make(map[string]interface{}); query.Next(tmp); count++ {
|
|
for tmp := make(map[string]interface{}); query.Next(tmp); count++ {
|
|
@@ -203,7 +211,14 @@ func increBidding() {
|
|
db.Where(&EntMapCode{AName: util.ObjToString(tmp["buyer"]), BName: winer}).First(&exist)
|
|
db.Where(&EntMapCode{AName: util.ObjToString(tmp["buyer"]), BName: winer}).First(&exist)
|
|
|
|
|
|
if exist.CreateTime == 0 {
|
|
if exist.CreateTime == 0 {
|
|
|
|
+ AInfo := EntInfo{}
|
|
|
|
+ BInfo := EntInfo{}
|
|
|
|
+ db.Model(&EntInfo{}).Where("company_name = ? ", util.ObjToString(tmp["buyer"])).Select("company_name", "id").First(&AInfo)
|
|
|
|
+ db.Model(&EntInfo{}).Where("company_name = ? ", winer).Select("company_name", "id").First(&BInfo)
|
|
|
|
+
|
|
data := EntMapCode{
|
|
data := EntMapCode{
|
|
|
|
+ AId: AInfo.ID,
|
|
|
|
+ BId: BInfo.ID,
|
|
AName: util.ObjToString(tmp["buyer"]),
|
|
AName: util.ObjToString(tmp["buyer"]),
|
|
BName: winer,
|
|
BName: winer,
|
|
Code: "0301",
|
|
Code: "0301",
|