|
@@ -575,6 +575,7 @@ func ordersClue() {
|
|
|
|
|
|
func refundAuto() {
|
|
func refundAuto() {
|
|
log.Println("自动移交销售定时任务开始")
|
|
log.Println("自动移交销售定时任务开始")
|
|
|
|
+ findNowTime := time.Now().AddDate(0, 0, db.ExpirationPeriod).Format(date.Date_Full_Layout)
|
|
nowTime := time.Now().Format(date.Date_Full_Layout)
|
|
nowTime := time.Now().Format(date.Date_Full_Layout)
|
|
TiDb.SelectByBath(100, func(l *[]map[string]interface{}) bool {
|
|
TiDb.SelectByBath(100, func(l *[]map[string]interface{}) bool {
|
|
for _, v := range *l {
|
|
for _, v := range *l {
|
|
@@ -594,7 +595,7 @@ func refundAuto() {
|
|
}
|
|
}
|
|
isFull := FindUpperLimit(gconv.String(saleId), "", false)
|
|
isFull := FindUpperLimit(gconv.String(saleId), "", false)
|
|
isAllRefund := false
|
|
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 vip_endtime < ?`, uid, nowTime)
|
|
|
|
|
|
+ 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 vip_endtime < ?`, uid, findNowTime)
|
|
if myOrders != nil {
|
|
if myOrders != nil {
|
|
refundCount := 0
|
|
refundCount := 0
|
|
for _, v := range *myOrders {
|
|
for _, v := range *myOrders {
|
|
@@ -651,19 +652,27 @@ func refundAuto() {
|
|
})
|
|
})
|
|
TiDb.UpdateOrDeleteBySql(`UPDATE dwd_f_csm_customer_info SET is_transfer=1 WHERE clue_id = ?`, clueId)
|
|
TiDb.UpdateOrDeleteBySql(`UPDATE dwd_f_csm_customer_info SET is_transfer=1 WHERE clue_id = ?`, clueId)
|
|
} else {
|
|
} else {
|
|
- order1 := TiDb.SelectBySql(`select id from dwd_f_userbase_order_info where uid=? and (product_type = "企业商机管理" or product_type = "大会员") and vip_endtime > ? and order_status = 1 `, uid, nowTime)
|
|
|
|
|
|
+ order1 := TiDb.SelectBySql(`select id from dwd_f_userbase_order_info where uid=? and (product_type = "企业商机管理" or product_type = "大会员") and vip_endtime > ? and order_status = 1 `, uid, findNowTime)
|
|
if order1 == nil || len(*order1) == 0 {
|
|
if order1 == nil || len(*order1) == 0 {
|
|
isOk := false
|
|
isOk := false
|
|
- order3 := TiDb.SelectBySql(`select vip_endtime from dwd_f_userbase_order_info where uid=? and (product_type = "企业商机管理" or product_type = "大会员") and vip_endtime < ? and order_status = 1 `, uid, nowTime)
|
|
|
|
|
|
+ order3 := TiDb.SelectBySql(`select vip_endtime from dwd_f_userbase_order_info where uid=? and (product_type = "企业商机管理" or product_type = "大会员") and vip_endtime < ? and order_status = 1 `, uid, findNowTime)
|
|
if order3 != nil && len(*order3) > 0 {
|
|
if order3 != nil && len(*order3) > 0 {
|
|
for _, vv := range *order3 {
|
|
for _, vv := range *order3 {
|
|
if isRenewalProtection == 1 {
|
|
if isRenewalProtection == 1 {
|
|
vip_endtime := common.ObjToString(vv["vip_endtime"])
|
|
vip_endtime := common.ObjToString(vv["vip_endtime"])
|
|
vip_endtimes, _ := time.ParseInLocation(date.Date_Full_Layout, vip_endtime, time.Local)
|
|
vip_endtimes, _ := time.ParseInLocation(date.Date_Full_Layout, vip_endtime, time.Local)
|
|
- //beforeTime := time.Now().AddDate(0, -1, 0)
|
|
|
|
- if time.Now().Unix()-vip_endtimes.Unix() < 3*30*86400 {
|
|
|
|
- //if beforeTime.Unix() <= vip_endtimes.Unix() {
|
|
|
|
- isOk = true
|
|
|
|
|
|
+ //查看服务到期时间
|
|
|
|
+ historyTimes, _ := time.ParseInLocation(date.Date_Full_Layout, nowTime, time.Local)
|
|
|
|
+ if vip_endtimes.Unix() <= historyTimes.Unix() {
|
|
|
|
+ //三个月
|
|
|
|
+ if time.Now().Unix()-vip_endtimes.Unix() < 3*30*86400 {
|
|
|
|
+ isOk = true
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ //一个月
|
|
|
|
+ if time.Now().Unix()-vip_endtimes.Unix() < db.HandoverCycle*86400 {
|
|
|
|
+ isOk = true
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|