|
|
@@ -855,34 +855,35 @@ func JudgePackageOrdOrdState(outTradeNo string) (err error) { |
|
|
|
} |
|
|
|
|
|
|
|
//1、判断是否有 `待就餐` |
|
|
|
count, err := db.Db.Where("ord_no =?", outTradeNo).And("state =?", enum2.CentralKitchenForSchoolUserWithDayStateForWait).Count(&m) |
|
|
|
count1, err := db.Db.Where("ord_no =?", outTradeNo).And("state =?", enum2.CentralKitchenForSchoolUserWithDayStateForWait).Count(&m) |
|
|
|
if err != nil { |
|
|
|
return |
|
|
|
} |
|
|
|
if count == 0 { |
|
|
|
if count1 == 0 { |
|
|
|
ordState = enum2.CentralKitchenForSchoolPackageOrdOrdStateForComplete |
|
|
|
} else { |
|
|
|
ordState = enum2.CentralKitchenForSchoolPackageOrdOrdStateForSuccess |
|
|
|
} |
|
|
|
|
|
|
|
//2、判断是否有 `已退款` / `部分退款` |
|
|
|
count, err = db.Db.Where("ord_no =?", outTradeNo).And("state =?", enum2.CentralKitchenForSchoolUserWithDayStateForCancel).Count(&m) |
|
|
|
count2, err := db.Db.Where("ord_no =?", outTradeNo).And("state =?", enum2.CentralKitchenForSchoolUserWithDayStateForCancel).Count(&m) |
|
|
|
if err != nil { |
|
|
|
return |
|
|
|
} |
|
|
|
if count > 0 && count < total { |
|
|
|
//if count2 > 0 && count2 < total && count1 > 0 { |
|
|
|
if count2 > 0 && count2 < total { |
|
|
|
ordState = enum2.CentralKitchenForSchoolPackageOrdOrdStateForPartRefunded |
|
|
|
} |
|
|
|
if count > 0 && count != total { |
|
|
|
if count2 > 0 && count2 == total { |
|
|
|
ordState = enum2.CentralKitchenForSchoolPackageOrdOrdStateForRefunded |
|
|
|
} |
|
|
|
|
|
|
|
//3、判断是否有 `退款中` |
|
|
|
count, err = db.Db.Where("ord_no =?", outTradeNo).And("state =?", enum2.CentralKitchenForSchoolUserWithDayStateForCanceling).Count(&m) |
|
|
|
count3, err := db.Db.Where("ord_no =?", outTradeNo).And("state =?", enum2.CentralKitchenForSchoolUserWithDayStateForCanceling).Count(&m) |
|
|
|
if err != nil { |
|
|
|
return |
|
|
|
} |
|
|
|
if count > 0 { |
|
|
|
if count3 > 0 { |
|
|
|
ordState = enum2.CentralKitchenForSchoolPackageOrdOrdStateForRefunding |
|
|
|
} |
|
|
|
|
|
|
|