瀏覽代碼

feat:xiugai

wangchuanjin 1 年之前
父節點
當前提交
08554b5495
共有 1 個文件被更改,包括 14 次插入1 次删除
  1. 14 1
      clueSync/kc.go

+ 14 - 1
clueSync/kc.go

@@ -649,7 +649,20 @@ func refundAuto() {
 				phone = common.ObjToString((*clueData)["phone"])
 			}
 			isFull := FindUpperLimit(gconv.String(saleId), "", false)
-			if TiDb.CountBySql(`select count(1) as count from dwd_f_userbase_order_info where uid=? and (product_type = "企业商机管理" or product_type = "大会员") and refund_status=1 and order_status = 1 and pay_money > 0`, uid) > 0 {
+			isAllRefund := false
+			myOrders := TiDb.SelectBySql(`select refund_status from dwd_f_userbase_order_info where uid=? and (product_type = "企业商机管理" or product_type = "大会员") and order_status = 1 and pay_money > 0`, uid)
+			if myOrders != nil {
+				refundCount := 0
+				for _, v := range *myOrders {
+					if common.IntAll(v["refund_status"]) == 1 {
+						refundCount++
+					}
+				}
+				if len(*myOrders) > 0 && len(*myOrders) == refundCount {
+					isAllRefund = true
+				}
+			}
+			if isAllRefund {
 				//全退款了
 				TiDb.UpdateOrDeleteBySql(`UPDATE dwd_f_crm_clue_info SET is_assign=0,trailstatus="01",position_id=null,seatNumber=null,updatetime=?,comeintime_open=?,comeinsource_open=1,level_open=3,next_trail_time=null,is_task=null,tasktime=null,taskstatus=null,comeinsource_private=null,tasksource=null,is_transfer=0 WHERE id = ?`, nowTime, nowTime, clueId)
 				TiDb.Insert("dwd_f_crm_clue_change_record", map[string]interface{}{