wuggemail@foxmail.com 3 months ago
parent
commit
9d5667dcf7

+ 38 - 0
app/admin/controller/Purchease.php

@@ -0,0 +1,38 @@
+<?php
+
+namespace app\admin\controller;
+
+
+
+use think\App;
+
+class Purchease extends Base
+{
+    public function __construct(App $app)
+    {
+        parent::__construct($app);
+        $this->model = new \app\admin\model\PurcheaseOrder();
+    }
+    public function list(){
+    }
+    //批量同步到结算
+    public function SyscnToSettle(){
+        $params = $this->request->param(['idArr'=>[]],"post","trim");
+        $valid = $this->validate($params,[
+            'idArr|订单编号'=>'require|array'
+        ]);
+        if($valid!==true) return error($valid);
+        $orderArr = $this->model->whereIn("id",$params['idArr'])->select();
+        if($orderArr->isEmpty()) return error("订单不存在");
+        $this->model->startTrans();
+        try{
+            $up=$this->model->whereIn("id",$params['idArr'])->save(["update_time"=>date("Y-m-d H:i:s")]);
+            if($up===false) throw new \Exception("更新失败");
+            $this->model->commit();
+        }catch (\Exception $e){
+            $this->model->rollback();
+            return error($e->getMessage());
+        }
+        return success("批量同步提交成功");
+    }
+}

+ 31 - 0
app/admin/controller/Sale.php

@@ -10,4 +10,35 @@ class Sale extends Base{
         parent::__construct($app);
         $this->model = new \app\admin\model\Sale();
     }
+
+    public function list(){
+    }
+    public function add(){
+    }
+    public function edit(){
+    }
+    public function delete(){
+    }
+    public function status(){
+    }
+    //批量同步到结算
+    public function SyscnToSettle(){
+        $params = $this->request->param(['idArr'=>[]],"post","trim");
+        $valid = $this->validate($params,[
+            'idArr|订单编号'=>'require|array'
+        ]);
+        if($valid!==true) return error($valid);
+        $orderArr = $this->model->whereIn("id",$params['idArr'])->select();
+        if($orderArr->isEmpty()) return error("订单不存在");
+        $this->model->startTrans();
+        try{
+            $up=$this->model->whereIn("id",$params['idArr'])->save(["update_time"=>date("Y-m-d H:i:s")]);
+            if($up===false) throw new \Exception("更新失败");
+            $this->model->commit();
+        }catch (\Exception $e){
+            $this->model->rollback();
+            return error($e->getMessage());
+        }
+        return success("批量同步提交成功");
+    }
 }

+ 2 - 2
app/middleware/HttpLog.php

@@ -29,8 +29,8 @@ class HttpLog
                 'param' =>json_encode($request->param(),JSON_UNESCAPED_UNICODE),
                 'response' =>"[]",
                  'client_ip'=>$request->ip(),
-                'action_id' => $userinfo->id??0,
-                'action_name' => $userinfo->nickname??'system'
+                'action_id' => $userinfo['id']??0,
+                'action_name' => $userinfo['nickname']??'system'
                 ];
         $log=SystemLog::create($data);
         $this->logid=$log->id;

+ 0 - 1
app/user/controller/SystemLog.php

@@ -7,7 +7,6 @@ namespace app\user\controller;
 use think\App;
 class SystemLog extends Base{
     public function __construct(App $app) {
-        $this->noLogin=["*"];
         parent::__construct($app);
         $this->model = new \app\user\model\SystemLog();
     }

+ 1 - 1
app/user/model/SystemLog.php

@@ -38,7 +38,7 @@ class SystemLog extends Base{
     protected $append=['action_msg'];
 
      public function getActionMsgAttr($value,$data){
-           return   \SystemLog::GET_LOG_PATH($data,$data['action_name'],$data['param']);
+           return   \SystemLog::GET_LOG_PATH($data,$data['action_name'],json_decode($data['param'],true));
     }
 
     public function getParamAttr($value){

+ 1 - 1
extend/SystemLog.php

@@ -13,7 +13,7 @@ class SystemLog {
                 throw new Exception("文件不存在");
             }
              $data = include_once(self::$logPath.$file['system'].'/'.$file['controller'].'.php');
-            return sprintf($data[$file['action']]['msg'],$system_uname,$param[$file['replace'][0]??0]??'');
+            return sprintf($data[$file['action']]['msg'],$system_uname,$param[$data[$file['action']]['resplace'][0]??0]??'');
         }catch (Exception $e){
             return "文件不存在";
         }