|
|
@@ -5,6 +5,8 @@ namespace SixShop\Lakala\Cron;
|
|
|
use SixShop\Core\Attribute\Cron;
|
|
|
use SixShop\Lakala\Service\PaymentRecordService;
|
|
|
use SixShop\Payment\Model\ExtensionPaymentModel;
|
|
|
+use think\db\Query;
|
|
|
+use think\facade\Db;
|
|
|
|
|
|
class WechatOrderCron
|
|
|
{
|
|
|
@@ -21,13 +23,19 @@ class WechatOrderCron
|
|
|
->where([
|
|
|
'p.pay_type' => 'lakala',
|
|
|
'p.status' => 2,
|
|
|
- 'o.shipping_status' => 1,
|
|
|
- 'w.status' => 1
|
|
|
+ 'o.shipping_status' => 1
|
|
|
])
|
|
|
- ->whereNull('w.order_state')
|
|
|
- ->field('p.id')
|
|
|
+ ->where(function (Query $query) {
|
|
|
+ $query->where('w.order_state', 1)
|
|
|
+ ->whereOr('w.order_state', null);
|
|
|
+ })
|
|
|
+ ->field('p.id,w.order_state')
|
|
|
->select()->each(function ($payment){
|
|
|
- $this->paymentRecordService->createWechatOrder($payment->id);
|
|
|
+ if ($payment->order_state === null) {
|
|
|
+ $this->paymentRecordService->createWechatOrder($payment->id);
|
|
|
+ } else {
|
|
|
+ // 发货 todo
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
}
|