tiaobug
This commit is contained in:
@@ -29,15 +29,19 @@ class SettleCouponImport implements ToModel, WithStartRow, WithChunkReading, Wit
|
|||||||
try {
|
try {
|
||||||
$order_id = trim($row[0]);
|
$order_id = trim($row[0]);
|
||||||
$exists = Coupon::query()->where('pa_order_id', $order_id)->exists();
|
$exists = Coupon::query()->where('pa_order_id', $order_id)->exists();
|
||||||
|
if ($exists) {
|
||||||
|
Coupon::query()->where('pa_order_id', $order_id)->update([
|
||||||
|
'is_settle' => 1
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
$exists = CouponPaCheck::query()->where('pa_order_id', $order_id)->exists();
|
||||||
if (! $exists) {
|
if (! $exists) {
|
||||||
CouponPaCheck::create([
|
CouponPaCheck::create([
|
||||||
'pa_order_id' => $order_id
|
'pa_order_id' => $order_id
|
||||||
]);
|
]);
|
||||||
} else {
|
|
||||||
Coupon::query()->where('pa_order_id', $order_id)->update([
|
|
||||||
'is_settle' => 1
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
throw new \Exception($e->getMessage());
|
throw new \Exception($e->getMessage());
|
||||||
|
|||||||
Reference in New Issue
Block a user