Browse Source

wip:销售业绩刷库程序提交

wangkaiyue 11 tháng trước cách đây
mục cha
commit
1cf26f8cf6
2 tập tin đã thay đổi với 25 bổ sung2 xóa
  1. 8 2
      saleFlush/main.go
  2. 17 0
      zhimaPush/main.go

+ 8 - 2
saleFlush/main.go

@@ -214,7 +214,7 @@ func CreateSaleRecord(ctx context.Context) {
 				insertArr = append(insertArr, m)
 			}
 		} else {
-			insertArr = append(insertArr, map[string]interface{}{
+			m := map[string]interface{}{
 				"state":         2,
 				"ordercode":     order_code,
 				"saler_Id":      -1,
@@ -226,7 +226,13 @@ func CreateSaleRecord(ctx context.Context) {
 				"group_uuid":    uuidStr,
 				"operator":      "系统自动",
 				"create_time":   create_time,
-			})
+			}
+			if statistics_time != "" {
+				m["statistics_time"] = statistics_time
+				m["state"] = 1
+				m["change_reason"] = "回款成功"
+			}
+			insertArr = append(insertArr, m)
 		}
 		//save
 		if len(insertArr) >= 100 {

+ 17 - 0
zhimaPush/main.go

@@ -148,6 +148,11 @@ func (m *pushManager) RunJob(ctx context.Context) {
 func (m *pushManager) DoPush(ctx context.Context, pv, uv int, ent, dateStr string) error {
 	//g.Log().Printf(ctx, "模拟上报数据\nparam ent:%v pv:%v uv:%v", ent, pv, uv)
 	//return nil
+	actionContent := getCode(ent)
+	if len(actionContent) == 0 {
+		return nil
+	}
+
 	bizC := bizContent{
 		FeedbackData: []feedBackData{
 			{
@@ -235,3 +240,15 @@ func parsePrivateKey(key string) (*rsa.PrivateKey, error) {
 	}
 	return rsaPrivateKey.(*rsa.PrivateKey), nil
 }
+
+func getCode(creditNo string) (rData []string) {
+	res, _ := common.MG.DB().FindOneByField("qyxy_std", map[string]interface{}{
+		"credit_no": creditNo,
+	}, `{"zhima_labels":1}`)
+	if res != nil && len(*res) > 0 {
+		for _, m := range gconv.Maps((*res)["zhima_labels"]) {
+			rData = append(rData, gconv.String(m["zhima_code"]))
+		}
+	}
+	return
+}