Przeglądaj źródła

问题件 问题件的软删除查询和方法

ajun 5 lat temu
rodzic
commit
32e5a0c8d9
1 zmienionych plików z 24 dodań i 0 usunięć
  1. 24 0
      app/Services/OrderIssueService.php

+ 24 - 0
app/Services/OrderIssueService.php

@@ -561,4 +561,28 @@ class OrderIssueService
     {
         return  $this->getConditionQuery($params)->get();
     }
+
+
+    public function getRecycleBinOrderIssue($params)
+    {
+        return OrderIssue::query()->with(['order'=>function($query){
+            $query->with(['logistic','shop'.'owner','packages']);
+        },'rejectedBill','issueType','secondOrder'])->onlyTrashed();
+    }
+
+    public function getRecycleBinPaginate($params){
+        return  $this->getDeleteOrderIssue($params)->paginate($params['paginate'] ?? 50);
+    }
+
+    public function recoverOrderIssue($ids)
+    {
+        try {
+            $bool = OrderIssue::query()->withTrashed()->whereIn('id', $ids)->restore();
+            app('LogService')->log(__METHOD__, __FUNCTION__, '恢复问题件 ids = ' . json_encode($ids));
+            return ['success'=>$bool];
+        } catch (\Exception $e) {
+            app('LogService')->log(__METHOD__, 'ERROR '.__FUNCTION__, '恢复问题件 Error' . json_encode($ids).' || '.json_encode($e->getMessage()).' || '.json_encode($e->getTraceAsString()));
+            return ['success'=>false,'error'=>$e->getMessage()];
+        }
+    }
 }