|
@@ -30,15 +30,16 @@ class OrderService
|
|
|
// 订单主表
|
|
|
Order::where('order_id', $order->order_id)->update([
|
|
|
'order_is_complete' => 'Y',
|
|
|
- 'order_status_system' => 'CONFIRM'
|
|
|
+ 'order_status_system' => 'CONFIRM',
|
|
|
+ 'order_status_storage'=> 'DONE'
|
|
|
]);
|
|
|
// 订单详情表
|
|
|
- OrderSheet::where('join_sheet_order_id', $order->order_id)->update(['order_sheet_status' => 'CONFIRM']);
|
|
|
+ OrderSheet::where('join_sheet_order_id', $order->order_id)->update(['order_sheet_status' => 'DONE']);
|
|
|
|
|
|
// 7天后自动完成 order_is_complete=Y
|
|
|
- $redis = Redis::connection();
|
|
|
- $key = Order::AUTOMATIC_COMPLETE_PREFIX . date('Ymd', strtotime("+7 days"));
|
|
|
- $redis->sadd($key, $order->order_id);
|
|
|
+// $redis = Redis::connection();
|
|
|
+// $key = Order::AUTOMATIC_COMPLETE_PREFIX . date('Ymd', strtotime("+7 days"));
|
|
|
+// $redis->sadd($key, $order->order_id);
|
|
|
}
|
|
|
Db::commit();
|
|
|
} catch (\Exception $e) {
|
|
@@ -46,6 +47,43 @@ class OrderService
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @Desc 自动完成订单
|
|
|
+ * @Author Gorden
|
|
|
+ * @Date 2024/7/16 9:37
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public static function AutomaticComplete()
|
|
|
+ {
|
|
|
+ Db::beginTransaction();
|
|
|
+ try {
|
|
|
+
|
|
|
+ $redis = Redis::connection();
|
|
|
+ $key = Order::AUTOMATIC_COMPLETE_PREFIX . date('Ymd');
|
|
|
+ $orderIds = $redis->smembers($key);
|
|
|
+
|
|
|
+ foreach ($orderIds as $orderId){
|
|
|
+ $order = Order::where('order_id',$orderId)
|
|
|
+ ->select('order_is_complete','order_category','order_status_system')
|
|
|
+ ->first();
|
|
|
+ if ($order && $order->order_is_complete != 'Y' && $order->order_category != 'RETURN' && in_array($order->order_status_system,['RECVING','SIGNED','CONFIRM'])){
|
|
|
+ // 更新主表
|
|
|
+ Order::where('order_id',$orderId)->update(['order_is_complete'=>'Y','order_status_system'=>'CONFIRM','order_status_storage'=>'DONE']);
|
|
|
+ // sheet表
|
|
|
+ OrderSheet::where('join_sheet_order_id',$orderId)->update(['order_sheet_status'=>'DONE']);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $redis->del($key);
|
|
|
+
|
|
|
+ Db::commit();
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ dump($e->getMessage());
|
|
|
+ Db::rollBack();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public static function checkPayingOrder()
|
|
|
{
|
|
|
try {
|