cqpCow пре 1 година
родитељ
комит
af42bb7508

+ 81 - 1
app/Service/Box/BoxService.php

@@ -206,9 +206,89 @@ class BoxService extends Service
     }
 
     public function saveOutOrder($data,$user){
-        //todo
+        list($status,$msg) = $this->saveOutOrderRule($data,$user);
+        if(! $status) return [false, $msg];
+
+        //组织数据
+        $yongyou_data = [];
+        foreach ($data['out_data'] as $value){
+            $pro_tmp = [];
+            foreach ($value['product'] as $p){
+                $t_k = $p['cinvcode'] . $p['cfree1'];
+                $pro_tmp[$t_k] = [
+                    'cinvcode' => $p['cinvcode'],
+                    'cfree1' => $p['cfree1'],
+                    'iquantity' => $p['iquantity'],
+                ];
+            }
+
+            if(isset($yongyou_data[$value['customer_code']])){
+                $yongyou_data[$value['customer_code']]['cdlcode_string'] .= ',' . $value['cdlcode'];
+                foreach ($pro_tmp as $k => $v){
+                    if(isset($yongyou_data[$value['customer_code']]['product'][$k])){
+                        $yongyou_data[$value['customer_code']]['product'][$k]['iquantity'] += $v['iquantity'];
+                    }else{
+                        $yongyou_data[$value['customer_code']]['product'][$k] = $v;
+                    }
+                }
+            }else{
+                $yongyou_data[$value['customer_code']] = [
+                    'customer_code' => $value['customer_code'],
+                    'cdlcode_string' => $value['cdlcode'],
+                    'product' => $pro_tmp
+                ];
+            }
+        }
+        if(empty($yongyou_data)) return [false, '暂无写入用友发货出库数据!'];
+
+        //用友 ------发货出库
+        $service = new FinishedOrderService();
+        list($status,$msg) = $service->U8Rdrecord32Save($yongyou_data,$user);
+        if(! $status) return [false, $msg];
+
+        return [true, ''];
     }
 
+    public function saveOutOrderRule($data,$user){
+        if(empty($data['out_data'])) return [false, '未获取到发货数据,操作失败!'];
+        //客户校验
+        $customer_code = array_column($data['out_data'],'customer_code');
+        $isAllSame = count(array_unique($customer_code)) === 1;
+        if(! $isAllSame) return [false, '发货出库,请选择同一个客户的订单!'];
+        //用友发货数据查询
+        $cdlcode = array_column($data['out_data'],'cdlcode');
+        $service = new FyySqlServerService($user);
+        if($service->error) return [false, $service->error];
+        $out_data_map = $service->getDataFromDispatchListForCheck(['cdlcode' => $cdlcode]);
+        if(empty($out_data_map)) return [false, '未在用友发货数据中查找到相关数据!'];
+
+        //数据校验
+        foreach ($data['out_data'] as $value){
+            if(empty($value['cdlcode'])) return [false, '发货单号不能为空!'];
+            if(! isset($out_data_map[$value['cdlcode']])) return [false, '发货单号:' . $value['cdlcode'] . '不存在或已被删除!'];
+            $tmp = $out_data_map[$value['cdlcode']];
+            if(empty($value['customer_code'])) return [false, '客户编码不能为空!'];
+            if($tmp['customer_code'] != $value['customer_code']) return [false, '客户编码与用友数据中不一致!'];
+            if(empty($tmp['product'])) return [false, '发货单号:' . $value['cdlcode'] . '未查找到用友的发货产品数据!'];
+            $tmp_pro = [];
+            foreach ($tmp['product'] as $t){
+                $t_k = $t['cinvcode'] . $t['cfree1'];
+                $tmp_pro[$t_k] = $t['iquantity'] - $t['out_quantity'];//未发货数量
+            }
+            if(empty($value['product'])) return [false, '发货产品不能为空!'];
+            foreach ($value['product'] as $p){
+                if(empty($p['cinvcode'])) return [false, '存货编码不能为空!'];
+                if(empty($p['cfree1'])) return [false, '存货颜色不能为空!'];
+                $p_k = $p['cinvcode'] . $p['cfree1'];
+                if(! isset($tmp_pro[$p_k])) return [false, '发货单号:' . $value['cdlcode'] . '下无该发货产品:编码为' . $p['cinvcode'] . ',颜色为:' . $p['cfree1']];
+                if(empty($p['iquantity']) || $p['iquantity'] <= 0) return [false, '发货数量不能为空!'];
+                $last = $tmp_pro[$p_k];
+//                if($p['iquantity'] > $last) return [false, '发货单号:' . $value['cdlcode'] . '下的发货产品:编码为' . $p['cinvcode'] . ',颜色为' . $p['cfree1'] . '的未发货数量为' . $last];
+            }
+        }
+
+        return [true, ''];
+    }
     /**
      * 根据发货单包装(恒诚塑业不需要)
      * @param $data

+ 15 - 14
app/Service/FinishedOrderService.php

@@ -156,9 +156,9 @@ class FinishedOrderService extends Service
         return [true, ''];
     }
 
-    //产成品入
+    //产成品入
     public function U8Rdrecord10Save($package_data, $user){
-        if(empty($package_data)) return [true, ''];
+        if(empty($package_data)) return [false, '产成品入库为空,请确认!'];
 
         try{
             //获取包装单信息
@@ -173,6 +173,8 @@ class FinishedOrderService extends Service
             if(! empty($boxDetail)){
                 $sqlServerModel = new FyySqlServerService($user);
                 if($sqlServerModel->error) return [false, $sqlServerModel->error];
+                $username = $sqlServerModel->getYongyouName();
+                $box['create_name'] = $username;
                 list($status,$msg) = $sqlServerModel->U8Rdrecord10Save($box,$boxDetail);
                 if(! $status) return [false, $msg];
             }
@@ -185,18 +187,17 @@ class FinishedOrderService extends Service
         return [true,''];
     }
 
-    //销售发货出库 toDO
+    //销售发货出库
     public function U8Rdrecord32Save($send_data, $user){
-        if(empty($send_data)) return [true, ''];
+        if(empty($send_data)) return [false, '销售发货出库为空,请确认!'];
 
         try{
             //用友数据插入------------
-            if(! empty($boxDetail)){
-                $sqlServerModel = new FyySqlServerService($user);
-                if($sqlServerModel->error) return [false, $sqlServerModel->error];
-                list($status,$msg) = $sqlServerModel->U8Rdrecord32Save($send_data,$boxDetail);
-                if(! $status) return [false, $msg];
-            }
+            $sqlServerModel = new FyySqlServerService($user);
+            if($sqlServerModel->error) return [false, $sqlServerModel->error];
+            $create_name = $sqlServerModel->getYongyouName();
+            list($status,$msg) = $sqlServerModel->U8Rdrecord32Save($send_data,$create_name);
+            if(! $status) return [false, $msg];
             //用友数据插入------------
 
         }catch (\Exception $e){
@@ -238,8 +239,8 @@ class FinishedOrderService extends Service
                 $sqlServerModel = new FyySqlServerService($user);
                 if($sqlServerModel->error) return [false,$sqlServerModel->error];
                 foreach ($insert_sql_server as $value){
-                    list($status,$msg) = $sqlServerModel->U8Rdrecord10Save($value);
-                    if(! $status) return [false,$msg];
+//                    list($status,$msg) = $sqlServerModel->U8Rdrecord10Save($value);
+//                    if(! $status) return [false,$msg];
                 }
             }
             //用友数据插入结束----------
@@ -751,8 +752,8 @@ class FinishedOrderService extends Service
                 $sqlServerModel = new FyySqlServerService($user);
                 if($sqlServerModel->error) return [false,$sqlServerModel->error];
                 foreach ($insert_sql_server as $value){
-                    list($status,$msg) = $sqlServerModel->U8Rdrecord10Save($value);
-                    if(! $status) return [false,$msg];
+//                    list($status,$msg) = $sqlServerModel->U8Rdrecord10Save($value);
+//                    if(! $status) return [false,$msg];
                 }
             }
             //用友数据写入结束------------

+ 2 - 2
app/Service/FyyOrderService.php

@@ -285,8 +285,8 @@ class FyyOrderService extends Service
             $sqlServerModel = new FyySqlServerService($user);
             if($sqlServerModel->error) return [false,$sqlServerModel->error];
 
-            list($status,$msg) = $sqlServerModel->U8Rdrecord32Save($data['post']);
-            if(! $status) return [false,$msg];
+//            list($status,$msg) = $sqlServerModel->U8Rdrecord32Save($data['post']);
+//            if(! $status) return [false,$msg];
 
             //更新
             DB::beginTransaction();

+ 146 - 58
app/Service/FyySqlServerService.php

@@ -15,6 +15,7 @@ use Illuminate\Support\Facades\Redis;
 class FyySqlServerService extends Service
 {
     public $db = null;
+    public $db2 = null;
     public $error = null;
     public $host = "192.168.0.157";//数据库外网域名
     public $host_api = '192.168.0.157';//用友接口外网域名
@@ -25,7 +26,7 @@ class FyySqlServerService extends Service
     public $sUserID = "0001";
     public $sPassword = "";
 
-    public function __construct($user_id = [])
+    public function __construct($user_id = [], $is_db2 = false)
     {
         try {
             //用户信息校验
@@ -57,7 +58,7 @@ class FyySqlServerService extends Service
             $this->sPassword = $emp->sqlserver_password ?? '';
             $this->url = $this->host_api . "/U8Sys/U8API";
 
-            if (!$this->db) {
+            if(!$this->db) {
                 $config = [
                     'driver' => 'sqlsrv',
                     'host' => $this->host,
@@ -79,6 +80,29 @@ class FyySqlServerService extends Service
                     return;
                 }
             }
+
+            if($is_db2){
+                $config = [
+                    'driver' => 'sqlsrv',
+                    'host' => $this->host,
+                    'port' => $this->port,
+                    'database' => 'UFSystem',
+                    'username' => env('SQLSRV_USERNAME'),
+                    'password' => env('SQLSRV_PASSWORD'),
+                ];
+
+                // 进行数据库连接
+                Config::set('database.connections.sqlsrvs', $config);
+
+                $pdo = DB::connection('sqlsrvs')->getPdo();
+                if ($pdo instanceof \PDO) {
+                    // 连接成功的逻辑代码
+                    $this->db2 = DB::connection('sqlsrvs');
+                } else {
+                    $this->error = '连接失败!';
+                    return;
+                }
+            }
         } catch (\Throwable $e) {
             $this->error = $e->getMessage();
         }
@@ -261,8 +285,21 @@ class FyySqlServerService extends Service
         return [true, $message, $product];
     }
 
+    //获取用友账号的人名
+    public function getYongyouName(){
+        if (!empty($this->error)) return [false, $this->error, ''];
+
+        $str = "";
+        $model = $this->db->table('UA_User')
+            ->where('cUser_Id',$this->sUserID)
+            ->select('cUser_Name')
+            ->first();
+        if(! empty($model)) $str = $model->cUser_Name;
+        return $str;
+    }
+
     //产成品入库单保存接口以及审核
-    public function U8Rdrecord10Save($data, $data_detail,  $bredvouch = 0)
+    public function U8Rdrecord10Save($data, $data_detail, $bredvouch = 0)
     {
         if (! empty($this->error)) return [false, $this->error];
 
@@ -275,24 +312,31 @@ class FyySqlServerService extends Service
         //数据
         $bodys = [];
         foreach ($data_detail as $value){
-            $bodys[] = [
-                "cinvcode" => $value["ext_1"],
-                "cposition" => "",
-                "cbatch" => "",
-                "iquantity" => $value["num"],
-                "inum" => $value["num"],
-                "iunitcost" => $value["price"] * 0.95,
-                "iprice" => $value["price"] * 0.95 * $value['num'],
-                "iinvexchrate" => "1.00",
-                "impoids" => "",
-                "cmocode" => "",
-                "imoseq" => "",
-                "cbmemo" => "",
-                "cfree1" => $value['ext_3'], //颜色
-                "cfree2" => "",
-                "cdefine28" => "",
-            ];
+            $key = $value['ext_1'] . $value['ext_3'];
+            if(! isset($bodys[$key])){
+                $bodys[$key] = [
+                    "cinvcode" => $value["ext_1"],
+                    "cposition" => "",
+                    "cbatch" => "",
+                    "iquantity" => $value["num"],
+                    "inum" => $value["num"],
+                    "iunitcost" => 0,
+                    "iprice" => 0,
+                    "iinvexchrate" => 0,
+                    "impoids" => "",
+                    "cmocode" => "",
+                    "imoseq" => "",
+                    "cbmemo" => "",
+                    "cfree1" => $value['ext_3'], //颜色
+                    "cfree2" => "",
+                    "cdefine28" => "",
+                ];
+            }else{
+                $bodys[$key]['iquantity'] += $value['num'];
+                $bodys[$key]['inum'] += $value['num'];
+            }
         }
+        $bodys = array_values($bodys);
 
         $post = [
             "password" => "cloud@123456",
@@ -308,7 +352,7 @@ class FyySqlServerService extends Service
             "data" => [
                 "ccode" => '',
                 "ddate" => date("Y-m-d"),
-                "cmaker" => $this->sUserID,
+                "cmaker" => $data['create_name'],
                 "dnmaketime" => date("Y-m-d"),
                 "IsExamine" => true,
                 "bredvouch" => $bredvouch,
@@ -332,46 +376,37 @@ class FyySqlServerService extends Service
     }
 
     //销售出库单保存接口给以及审核
-    public function U8Rdrecord32Save($data, $bredvouch = 0)
+    public function U8Rdrecord32Save($data,$create_name, $bredvouch = 0)
     {
         if (!empty($this->error)) return [false, $this->error];
 
         if ($bredvouch) {
-            $cmemo = '来源:恒诚塑业';
+            $cmemo = '来源:恒诚塑业发货出库操作(撤回)';
         } else {
             $cmemo = '来源:恒诚塑业发货出库操作';
         }
-
-        $new = [];
         foreach ($data as $value) {
-            $keys = $value['id'] . $value['cwhcode'];
-            $new[$keys][] = $value;
-        }
-
-        foreach ($new as $value) {
-            $main_tmp = $value[0];
             $bodys_tmp = [];
-            foreach ($value as $val) {
+            foreach ($value['product'] as $v){
                 $bodys_tmp[] = [
-                    "idlsid" => $val['idlsid'],
+                    "idlsid" => "",
                     "cdlcode" => "",
                     "dlrowno" => "",
                     "cbdlcode" => "",
-                    "cinvcode" => $val['cinvcode'],
-                    "cposition" => $val['cposition'] ?? "",
-                    "cbatch" => $val['cbatch'] ?? "",
-                    "iquantity" => $val['iquantity'],
-                    "inum" => $val['inum'],
-                    "iinvexchrate" => $val['iinvexchrate'] ?? 0,
-                    "iunitcost" => $val['iunitcost'] * 0.95,
-                    "iprice" => $val['iunitcost'] * 0.95 * $val['iquantity'],
+                    "cinvcode" => $v['cinvcode'],
+                    "cposition" => "",
+                    "cbatch" => "",
+                    "iquantity" => $v['iquantity'],
+                    "inum" => 0,
+                    "iinvexchrate" => 0,
+                    "iunitcost" => 0,
+                    "iprice" => 0,
                     "cbmemo" => "",
-                    "cfree1" => $val['cfree1'],
-                    "cfree2" => $val['cfree2'],
-                    "cdefine28" => $val['technology_material'],
-                    "cdefine30" => $val['process_mark'],
+                    "cfree1" => $v['cfree1'],
+                    "cfree2" => "",
                 ];
             }
+            $cmemo = $cmemo . '(发货单信息:' . $value['cdlcode_string'] . ')';
             $post_tmp = [
                 "password" => "cloud@123456",
                 "entity" => "U8Rdrecord32Save",
@@ -386,26 +421,27 @@ class FyySqlServerService extends Service
                 "data" => [
                     "ccode" => '',
                     "ddate" => date("Y-m-d"),
-                    "cmaker" => $this->sUserID,
+                    "cmaker" => $create_name,
                     "dnmaketime" => date("Y-m-d"),
                     "IsExamine" => true,
                     "bredvouch" => $bredvouch,
-                    "cwhcode" => $main_tmp['cwhcode'],
-                    "cdepcode" => $main_tmp['cdepcode'],
-                    "ccuscode" => $main_tmp['cuscode'],
+                    "cdepcode" => "03",
+                    "ccuscode" => $value['customer_code'],
                     "crdcode" => '202',
                     "cmemo" => $cmemo,
-                    "cdefine10" => $main_tmp['customer_name'], //客户名称
+                    "cwhcode" => "002",
                     "bodys" => $bodys_tmp,
                 ]
             ];
+        }
 
-            $return = $this->post_helper($this->url, json_encode($post_tmp), ['Content-Type:application/json']);
-            file_put_contents('record.txt', json_encode($new) . PHP_EOL . json_encode($post_tmp) . PHP_EOL, 8);
+        Log::channel('apiLog')->info('销售出库单:源数据', ["param" => $post_tmp]);
+        $return = $this->post_helper($this->url, json_encode($post_tmp), ['Content-Type:application/json']);
 
-            if (empty($return)) return [false, '异常错误,请确认请求接口地址!'];
-            if (!$return['flag']) return [false, $return['msg']];
-        }
+        Log::channel('apiLog')->info('产成品入库:返回结果', ["param" => $return]);
+
+        if (empty($return)) return [false, '异常错误,请确认请求接口地址!'];
+        if (! $return['flag']) return [false, $return['msg']];
 
         return [true, ''];
     }
@@ -438,7 +474,7 @@ class FyySqlServerService extends Service
         if (!empty($data['order_no'])) $model->where('b.cSOcode', $data['order_no']);
         if (!empty($data['out_order_no'])) $model->where('b.cSOcode', $data['out_order_no']);
 
-        $message = $model->select('a.cDLCode as cdlcode', 'a.DLID as id', 'a.cDefine10 as customer_name', 'b.cSOCode as csocode', 'a.cDepCode as cdepcode', 'a.cCusCode as cuscode', 'b.iDLsID as idlsid', 'b.cWhCode as cwhcode', 'b.cInvCode as cinvcode', 'b.cInvName as product_title', 'b.cFree1 as cfree1', 'b.cFree2 as cfree2', 'b.cPosition as cposition', 'b.cBatch as cbatch', 'b.iQuantity as iquantity', 'b.iNum as inum', 'b.iInvExchRate as iinvexchrate', 'b.fOutQuantity as out_quantity', 'b.iUnitPrice as iunitcost', 'b.iMoney as imoney', 'b.cDefine28 as technology_material', 'b.cDefine30 as process_mark', 'c.cInvStd as product_size')
+        $message = $model->select('a.cDLCode as cdlcode', 'a.DLID as id', 'a.cCusName as customer_name', 'b.cSOCode as csocode', 'a.cDepCode as cdepcode', 'a.cCusCode as cuscode', 'b.iDLsID as idlsid', 'b.cWhCode as cwhcode', 'b.cInvCode as cinvcode', 'b.cInvName as product_title', 'b.cFree1 as cfree1', 'b.cFree2 as cfree2', 'b.cPosition as cposition', 'b.cBatch as cbatch', 'b.iQuantity as iquantity', 'b.iNum as inum', 'b.iInvExchRate as iinvexchrate', 'b.fOutQuantity as out_quantity', 'b.iUnitPrice as iunitcost', 'b.iMoney as imoney', 'b.cDefine28 as technology_material', 'b.cDefine30 as process_mark', 'c.cInvStd as product_size')
             ->get()->toArray();
 
         if (!empty($message)) {
@@ -476,10 +512,10 @@ class FyySqlServerService extends Service
         if(empty($data['page_size'])) $data['page_size'] = 20;
         if(empty($data['page_index'])) $data['page_index'] = 1;
 
-        $model = $this->db->table('DispatchList as a')
+            $model = $this->db->table('DispatchList as a')
             ->leftJoin('DispatchLists as b', 'b.DLID', 'a.DLID')
             ->leftJoin('Inventory as c', 'c.cInvCode', 'b.cInvCode')
-            ->select('a.cDLCode as cdlcode', 'a.DLID as id', 'a.cDefine10 as customer_name', 'b.cSOCode as csocode', 'a.cDepCode as cdepcode', 'a.cCusCode as cuscode', 'a.dDate as date', 'b.iDLsID as idlsid', 'b.cWhCode as cwhcode', 'b.cInvCode as cinvcode', 'b.cInvName as product_title', 'b.cFree1 as cfree1', 'b.cFree2 as cfree2', 'b.cPosition as cposition', 'b.cBatch as cbatch', 'b.iQuantity as iquantity', 'b.iNum as inum', 'b.iInvExchRate as iinvexchrate', 'b.fOutQuantity as out_quantity', 'b.iUnitPrice as iunitcost', 'b.iMoney as imoney', 'b.cDefine28 as technology_material', 'b.cDefine30 as process_mark', 'c.cInvStd as product_size', DB::raw('(b.iQuantity - b.fOutQuantity) as quantity'), 'a.cMemo as table_header_mark', 'b.cMemo as table_body_mark')
+            ->select('a.cDLCode as cdlcode', 'a.DLID as id', 'a.cCusName as customer_name', 'b.cSOCode as csocode', 'a.cDepCode as cdepcode', 'a.cCusCode as cuscode', 'a.dDate as date', 'b.iDLsID as idlsid', 'b.cWhCode as cwhcode', 'b.cInvCode as cinvcode', 'b.cInvName as product_title', 'b.cFree1 as cfree1', 'b.cFree2 as cfree2', 'b.cPosition as cposition', 'b.cBatch as cbatch', 'b.iQuantity as iquantity', 'b.iNum as inum', 'b.iInvExchRate as iinvexchrate', 'b.fOutQuantity as out_quantity', 'b.iUnitPrice as iunitcost', 'b.iMoney as imoney', 'b.cDefine28 as technology_material', 'b.cDefine30 as process_mark', 'c.cInvStd as product_size', DB::raw('(b.iQuantity - b.fOutQuantity) as quantity'), 'a.cMemo as table_header_mark', 'b.cMemo as table_body_mark')
             ->whereNotNull('a.cVerifier')
 //            ->whereColumn('b.iQuantity', '>', 'b.fOutQuantity')
             ->where('a.dDate', '>=', $data['time'][0])
@@ -535,6 +571,7 @@ class FyySqlServerService extends Service
                     $new_data[$value['cdlcode']] = [
                         "cdlcode" => $value['cdlcode'],
                         "csocode" => $value['csocode'],
+                        "customer_code" => $value['cuscode'] ?? "",
                         "customer_name" => $value['customer_name'] ?? "",
                         "product" => [$pro]
                     ];
@@ -547,6 +584,57 @@ class FyySqlServerService extends Service
         return $list;
     }
 
+    //获取发货单数据 做校验
+    public function getDataFromDispatchListForCheck($data)
+    {
+        $model = $this->db->table('DispatchList as a')
+            ->leftJoin('DispatchLists as b', 'b.DLID', 'a.DLID')
+            ->select('a.cDLCode as cdlcode', 'a.cCusName as customer_name', 'b.cSOCode as csocode', 'a.cCusCode as cuscode','b.cInvCode as cinvcode', 'b.cInvName as product_title', 'b.cFree1 as cfree1','b.iQuantity as iquantity', 'b.iNum as inum', 'b.iInvExchRate as iinvexchrate', 'b.fOutQuantity as out_quantity', 'b.iUnitPrice as iunitcost', 'b.iMoney as imoney');
+
+        if (!empty($data['cdlcode'])) $model->whereIn('a.cDLCode', $data['cdlcode']);
+        //颜色
+        if (!empty($data['cfree1'])) $model->where('b.cFree1', 'Like', '%' . $data['cfree1'] . '%');
+
+        $list = $model->get()->toArray();
+
+        if (! empty($list)) {
+            $list = Collect($list)->map(function ($object) {
+                return (array)$object;
+            })->toArray();
+
+            $new_data = [];
+            foreach ($list as $value) {
+                $iquantity = intval($value['iquantity']);
+                $out_quantity = intval($value['out_quantity']);
+                $inum = intval($value['inum']);
+                $pro = [
+                    "cinvcode" => $value['cinvcode'],
+                    "product_title" => $value['product_title'],
+                    "cfree1" => $value['cfree1'],
+                    "iquantity" => $iquantity,
+                    "inum" => $inum,
+                    "out_quantity" => $out_quantity,
+                ];
+
+                if(isset($new_data[$value['cdlcode']])){
+                    $new_data[$value['cdlcode']]['product'][] = $pro;
+                }else{
+                    $new_data[$value['cdlcode']] = [
+                        "cdlcode" => $value['cdlcode'],
+                        "csocode" => $value['csocode'],
+                        "customer_code" => $value['cuscode'] ?? "",
+                        "customer_name" => $value['customer_name'] ?? "",
+                        "product" => [$pro]
+                    ];
+                }
+            }
+
+            $list = $new_data;
+        }
+
+        return $list;
+    }
+
     public function recordErrorTable($msg,$user,$data,$time,$type){
         // 连接到指定数据库连接
         ErrorTable::insert([