panlumeng 3 år sedan
förälder
incheckning
261fd5cf1d

+ 41 - 9
app/admin/controller/After.php

@@ -2,8 +2,6 @@
 
 
 namespace app\admin\controller;
-
-
 use think\App;
 use think\facade\Db;
 
@@ -76,7 +74,8 @@ class After extends \app\BaseController
                 "error_num"=>$num,
                 "error_img"=>$img,
                 "error_msg"=>$error['result'],
-                "remark"=>$remark,
+                "error_remark"=>$remark,
+                "remark"=>'',
                 "except_code"=>$except_code,
                 "order_type"=>$order_type,
                 "status"=>0,
@@ -150,11 +149,11 @@ class After extends \app\BaseController
         if($end!==""){
             $where[]=['a.addtime',"<=", $end];
         }
-        $count=Db::name("order_return")->alias("a")->leftJoin("order_returninfo b","a.orderCode=b.returnCode")->where
+        $count=Db::name("order_return")->alias("a")->leftJoin("order_returninfo b","a.returnCode=b.returnCode")->where
         ($where)->count();
         $total = ceil($count/$size);
         $page = $total>=$page ? $page :$total;
-        $list =Db::name("order_return")->alias("a")->leftJoin("order_returninfo b","a.orderCode=b.returnCode")->where($where)
+        $list =Db::name("order_return")->alias("a")->leftJoin("order_returninfo b","a.returnCode=b.returnCode")->where($where)
             ->field("a.*,b.return_wsm,b.contactor,b.mobile,b.addr,b.addr_code,b.post_code,b.post_company,b.post_fee,b.gys_remark")->page($page,$size)
             ->order("addtime desc")->select();
         $data=[];
@@ -246,7 +245,7 @@ class After extends \app\BaseController
         $mobile = isset($this->post['mobile']) && $this->post['mobile']!="" ? trim($this->post['mobile']):"";
         $addr = isset($this->post['addr']) && $this->post['addr']!="" ? trim($this->post['addr']):"";
         $addr_code = isset($this->post['addr_code']) && $this->post['addr_code']!="" ? trim($this->post['addr_code']):"";
-        if($info['is_th']==0){
+        if($info['is_th']==0 && $info['order_type']==2){
             if($contactor==''){
                 return error_show(1005,"参数 contactor 不能为空");
             }
@@ -346,10 +345,11 @@ class After extends \app\BaseController
         $return_info['post_code'] = $post_code;
         $fee= isset($this->post['post_fee'])&&$this->post['post_fee']!=='' ? round($this->post['post_fee'],2):"";
         if($fee===''){
-            return error_show(1005,"参数post_code不能为空");
+            return error_show(1005,"参数post_fee不能为空");
         }
         $return_info['post_fee'] = $fee;
         Db::startTrans();
+
         try{
             $info['status']=$info['order_type']==1?4:5;
             $info['updatetime']=date("Y-m-d H:i:s");
@@ -357,8 +357,34 @@ class After extends \app\BaseController
             if($up){
                 $in=Db::name("order_returninfo")->save($return_info);
                 if($in){
-                    Db::commit();
-                    return app_show(0,"更新成功");
+                    $data=[
+                        'thNo'=>makeNo("TH"),
+                        "orderCode"=>$info['orderCode'],
+                        "order_type"=>$info['order_type'],
+                        "outCode"=>$info['outCode'],
+                        "returnCode"=>$info['returnCode'],
+                        "good_code"=>$info['good_code'],
+                        "good_name"=>$info['good_name'],
+                        "return_wsm"=>$return_info['return_wsm'],
+                        "return_num"=>$info['error_num'],
+                        "contactor"=>$return_info['contactor'],
+                        "mobile"=>$return_info['mobile'],
+                        "addr"=>$return_info['addr'],
+                        "addr_code"=>$return_info['addr_code'],
+                        "return_code"=>$info['error_code'],
+                        "return_msg"=>$info['error_msg'],
+                        "post_fee"=>$return_info['post_fee'],
+                        "post_code"=>$return_info['post_code'],
+                        "post_company"=>$return_info['post_company'],
+                        "customer_code"=>$info['customer_code'],
+                        "addtime"=>date("Y-m-d H:i:s"),
+                        "updatetime"=>date("Y-m-d H:i:s")
+                    ];
+                    $back =Db::name("order_back")->insert($data);
+                    if($back){
+                        Db::commit();
+                        return app_show(0,"更新成功");
+                    }
                 }
             }
             Db::rollback();
@@ -369,6 +395,12 @@ class After extends \app\BaseController
         }
     }
 
+    /**
+     * @return \think\response\Json|void
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     */
     public function GysFeed(){
         $bkcode = isset($this->post['returnCode']) && $this->post['returnCode']!="" ? trim($this->post['returnCode']):"";
         if($bkcode==""){

+ 16 - 4
app/admin/controller/Allot.php

@@ -2,6 +2,7 @@
 
 namespace app\admin\controller;
 
+use app\admin\model\ActionLog;
 use app\admin\model\GoodLog;
 use app\BaseController;
 use think\App;
@@ -155,6 +156,8 @@ class Allot extends BaseController
             $pd=Db::name('allot_stock')->insert($data,true);
             $dm=[];
             if($pd>0) {
+                $order = ["order_code"=>$allot_code,"status"=>$status,"action_remark"=>'',"action_type"=>"create"];
+                ActionLog::logAdd($this->post['token'],$order,"DBD",$status,$this->post);
                 foreach ($dain as $value) {
                     $st = Db::name("good_type")->alias("b")->join("good a", "a.good_code = b.good_code", "left")
                         ->join("good_stock c", "c.good_type_code = b.type_code", "left")
@@ -162,7 +165,6 @@ class Allot extends BaseController
                         ->join("supplier n","n.code=v.supplierNo","left")
                         ->where(['c.wsm_code' => $wsm_out, 'good_type_code' => $value['good_code'], 'b.is_del' => 0, 'a.is_del' => 0])->where("c.is_del=0 or c.is_del is null")
                         ->field("b.type_code,a.good_name,a.unit,c.wsm_code,c.usable_stock,c.good_type_code,c.wait_out_stock,c.wait_in_stock,n.name")->find();
-                  // var_dump(Db::name("good_type")->getLastSql());
                     if (empty($st)) {
                         Db::rollback();
                         return error_show(1003, "商品不能为空");
@@ -186,9 +188,8 @@ class Allot extends BaseController
                         $dm[]=$temp;
                     }
                 $io = Db::name('allot_info')->insertAll($dm);
-                //var_dump(Db::name('allot_info')->getLastSql());
                 if ($io) {
-                    DB::commit();
+                    Db::commit();
                     return error_show(0, "调拨创建成功");
                 }
             }
@@ -307,11 +308,12 @@ class Allot extends BaseController
             ];
             $da = Db::name('allot_stock')->where(["id"=>$id,"is_del"=>0])->save($data);
             if($da>0) {
+                $order = ["order_code"=>$etid['allot_code'],"status"=>$etid['status'],"action_remark"=>'',"action_type"=>"edit"];
+                ActionLog::logAdd($this->post['token'],$order,"DBD",$etid['status'],$this->post);
                 foreach ($dain as $value) {
                     $st = Db::name("good_type")->alias("b")->join("good a", "a.good_code = b.good_code", "left")
                         ->join("good_stock c", "c.good_type_code = b.type_code", "left")->where(['wsm_code' => $wsm_out, 'good_type_code' => $value['good_code'], 'b.is_del' => 0, 'a.is_del' => 0])->where("c.is_del=0 or c.is_del is null")
                         ->field("b.type_code,a.good_name,a.unit,c.wsm_code,c.usable_stock,c.good_type_code,c.wait_out_stock,c.wait_in_stock")->find();
-                  // var_dump(Db::name("good_type")->getLastSql());
                     if (empty($st)) {
                         Db::rollback();
                         return error_show(1003, "商品不能为空");
@@ -370,6 +372,8 @@ class Allot extends BaseController
         }
         $end = Db::name('allot_stock')->update(['id'=>$id,'is_del'=>1,'updatetime'=>date("Y-m-d H:i:s")]);
         if($end){
+            $order = ["order_code"=>$str['allot_code'],"status"=>$str['status'],"action_remark"=>'',"action_type"=>"del"];
+            ActionLog::logAdd($this->post['token'],$order,"DBD",$str['status'],$this->post);
             return error_show(0,"删除成功");
         }else{
             return error_show(1002,"删除失败");
@@ -396,6 +400,8 @@ class Allot extends BaseController
             $st['updatetime']= date('Y-m-d H:i:s');
             $sv = Db::name('allot_stock')->save($st);
             if($sv){
+                $order = ["order_code"=>$st['allot_code'],"status"=>$st['status'],"action_remark"=>'',"action_type"=>"del"];
+                ActionLog::logAdd($this->post['token'],$order,"DBD",$status,$this->post);
                 if($status==2 || $status==1){
                     $vmp = Db::name('allot_info')->where(['allot_code'=>$st['allot_code'],"is_del"=>0])->select();
                     foreach ($vmp as $value){
@@ -464,6 +470,8 @@ class Allot extends BaseController
             ];
             $datainfo = Db::name('allot_stock')->where(['allot_code'=>$allot_code])->update($data);
             if($datainfo){
+                $order = ["order_code"=>$al['allot_code'],"status"=>$al['status'],"action_remark"=>'',"action_type"=>"del"];
+                ActionLog::logAdd($this->post['token'],$order,"DBD",3,$this->post);
                     $vnp = Db::name('allot_info')->where(['allot_code'=>$al['allot_code'],'is_del'=>0])->select();
                    // var_dump(Db::name('allot_info')->getLastSql());
                 $good_data=[];
@@ -520,6 +528,8 @@ class Allot extends BaseController
         ];
         $datainfo = Db::name('allot_stock')->where(['allot_code'=>$allot_code,"is_del"=>0])->save($data);
         if($datainfo>0) {
+            $order = ["order_code"=>$al['allot_code'],"status"=>$al['status'],"action_remark"=>'',"action_type"=>"del"];
+            ActionLog::logAdd($this->post['token'],$order,"DBD",4,$this->post);
             $good_data=[];
             foreach ($dain as $value) {
                 $st = Db::name("good_type")->alias("b")->join("good a", "a.good_code = b.good_code", "left")
@@ -624,6 +634,8 @@ public function vesio(){
         ];
         $datainfo = Db::name('allot_stock')->where(['allot_code'=>$allot_code,"is_del"=>0])->save($data);
         if($datainfo>0) {
+            $order = ["order_code"=>$al['allot_code'],"status"=>$al['status'],"action_remark"=>'',"action_type"=>"del"];
+            ActionLog::logAdd($this->post['token'],$order,"DBD",5,$this->post);
             foreach ($dain as $value) {
                 $st = Db::name("good_type")->alias("b")->join("good a", "a.good_code = b.good_code", "left")
                     ->join("good_stock c", "c.good_type_code = b.type_code", "left")->where(['wsm_code' => $al['wsm_in'], 'good_type_code' => $value['good_code'], 'b.is_del' => 0, 'a.is_del' => 0])->where("c.is_del=0 or c.is_del is null")

+ 29 - 15
app/admin/controller/Check.php

@@ -408,22 +408,36 @@ public function edit()
         return error_show(1005, $e->getMessage());
     }
 }
-public function dell(){
-    $id = $this->post['id'] && $this->post['id'] !=="" ? intval($this->post['id']) :"";
-    if($id===""){
-        return  error_show(1004,"参数id不能为空");
-    }
-    $deln= Db::name('good_check')->where(['id'=>$id,'is_del'=>0])->find();
-    if(empty($deln)){
-        return error_show(1002,"未找到数据");
-    }
-    $sv = Db::name('good_check')->update(['id'=>$id,'is_del'=>1,'updatetime'=>date("Y-m-d H:i:s")]);
-    if($sv){
-        return error_show(0,"删除成功");
-    }else{
-        return error_show(1002,"删除失败");
+
+    /**
+     * @return \think\response\Json|void
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     */
+    public function dell(){
+        $id = $this->post['id'] && $this->post['id'] !=="" ? intval($this->post['id']) :"";
+        if($id===""){
+            return  error_show(1004,"参数id不能为空");
+        }
+        $deln= Db::name('good_check')->where(['id'=>$id,'is_del'=>0])->find();
+        if(empty($deln)){
+            return error_show(1002,"未找到数据");
+        }
+        $sv = Db::name('good_check')->update(['id'=>$id,'is_del'=>1,'updatetime'=>date("Y-m-d H:i:s")]);
+        if($sv){
+            return error_show(0,"删除成功");
+        }else{
+            return error_show(1002,"删除失败");
+        }
     }
-}
+
+    /**
+     * @return \think\response\Json|void
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     */
     public function statu()
     {
         $id = isset($this->post['id']) && $this->post['id'] !=="" ? intval($this->post['id']) :"";

+ 97 - 0
app/admin/controller/Gold.php

@@ -0,0 +1,97 @@
+<?php
+
+
+namespace app\admin\controller;
+
+
+use think\App;
+use think\facade\Db;
+
+class Gold extends \app\BaseController
+{
+    public $post=[];
+    public function __construct(App $app)
+    {
+        parent::__construct($app);
+        $this->post=$this->request->post();
+    }
+
+    /**
+     * @return \think\response\Json|void
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     */
+    public function list(){
+        $page = isset($this->post['page']) && $this->post['page'] !== "" ? intval($this->post['page']) : "1";
+        $size = isset($this->post['size']) && $this->post['size'] !== "" ? intval($this->post['size']) : "10";
+        $type = isset($this->post['type']) && $this->post['type'] !== "" ? intval($this->post['type']) : "";
+        $condition=[];
+        if($type!=''){
+            $condition = [['type',"=",$type]];
+        }
+        $count = Db::name("gold_price")->where($condition)->count();
+        $total = ceil($count/$size);
+        $page = $page >= $total ? $total : $page;
+        $list =Db::name("gold_price")->where($condition)->page($page,$size)->order("addtime desc")->select();
+        $data=[];
+        foreach ($list as $value){
+            $value['gold'] = $value['type']==1?'18K':($value['type']==2?"24K":'白银');
+            $data[]=$value;
+        }
+        return app_show(0,"获取成功",['list'=>$data,"count"=>$count]);
+    }
+
+    public  function add(){
+        $token=isset($this->post['token'])&&$this->post['token']!=''?trim($this->post['token']):"";
+        if($token==""){
+            return error_show(1004,"参数token不能为空");
+        }
+        $userinfo = GetUserInfo($token);
+        if(empty($userinfo)||$userinfo['code']!=0){
+            return error_show(1002,"申请人数据不存在");
+        }
+        $rid= isset($userinfo["data"]['id']) ?  $userinfo["data"]['id'] : "";
+        $rname= isset($userinfo["data"]['nickname']) ?  $userinfo["data"]['nickname'] : "";
+        $type = isset($this->post['type'])&&$this->post['type']!=''?intval($this->post['type']):"";
+        if($type==""){
+            return error_show(1004,"参数type不能为空");
+        }
+        $price =  isset($this->post['price'])&&$this->post['price']!=''?floor($this->post['price']):"";
+        if($price==''){
+            return error_show(1004,"参数price不能为空");
+        }
+        $gold =[
+            "action_name"=>$rname,
+            "type"=>$type,
+            "price"=>$price,
+            "addtime"=>date("Y-m-d H:i:s")
+        ];
+        $int = Db::name("gold_price")->insert($gold);
+        if($int){
+            return app_show(0,"新建成功");
+        }else{
+            return error_show(1004,"新建失败");
+        }
+    }
+
+    /**
+     * @return \think\response\Json|void
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     */
+    public function GetByType(){
+        $type = isset($this->post['type'])&&$this->post['type']!=''?intval($this->post['type']):"";
+        if($type==""){
+            return error_show(1004,"参数type不能为空");
+        }
+        $price = Db::name("gold_price")->where(["type"=>$type])->order("addtime desc")->find();
+        if(empty($price)){
+            return error_show(1004,"未找到数据");
+        }
+        $price['gold'] = $price['type']==1?'18K':($price['type']==2?"24K":'白银');
+        return app_show(0,"获取成功",$price);
+    }
+
+}

+ 261 - 0
app/admin/controller/Orderback.php

@@ -0,0 +1,261 @@
+<?php
+
+
+namespace app\Admin\controller;
+
+use think\App;
+use think\facade\Db;
+
+class Orderback extends \app\BaseController
+{
+    public $post=[];
+    public function __construct(App $app)
+    {
+        parent::__construct($app);
+        $this->post =$this->request->post();
+    }
+
+    public function list(){
+        $page = isset($this->post['page']) && $this->post['page'] !=="" ? intval($this->post['page']):"1";
+        $size = isset($this->post['size']) && $this->post['size'] !=="" ? intval($this->post['size']):"10";
+        $where =[['is_del',"=",0]];
+        $thNo = isset($this->post['thNo']) && $this->post['thNo']!="" ? trim($this->post['thNo']):"";
+        if($thNo!=""){
+            $where[]=['thNo',"like", "%{$thNo}%"];
+        }
+        $status = isset($this->post['status']) && $this->post['status']!=="" ? intval($this->post['status']):"";
+        if($status!==""){
+            // $where['status'] = $status;
+            $where[]=['status',"=", $status];
+        }
+        $post_code= isset($this->post['post_code']) && $this->post['post_code']!="" ? trim($this->post['post_code']):"";
+        if($post_code!=""){
+            $where[]=['post_code',"like", "%{$post_code}%"];
+        }
+        $post_compay = isset($this->post['post_compay']) && $this->post['post_compay']!="" ? trim($this->post['post_compay']):"";
+        if($post_compay!=""){
+            $where[]=['post_company',"=", $post_compay];
+        }
+        $customer_code = isset($this->post['customer_code']) && $this->post['customer_code']!="" ? trim($this->post['customer_code']):"";
+        if($customer_code!=""){
+            $where[]=['customer_code',"like", "%{$customer_code}%"];
+        }
+        $order_code = isset($this->post['order_code']) && $this->post['order_code']!="" ? trim($this->post['order_code']):"";
+        if($order_code!=""){
+            $where[]=['orderCode',"like", "%{$order_code}%"];
+        }
+        $out_code = isset($this->post['out_code']) && $this->post['out_code']!="" ? trim($this->post['out_code']):"";
+        if($out_code!=""){
+            $where[]=['outCode',"like", "%{$out_code}%"];
+        }
+        $return_code = isset($this->post['return_code']) && $this->post['return_code']!="" ? trim($this->post['return_code']):"";
+        if($return_code!=""){
+            $where[]=['returnCode',"like", "%{$return_code}%"];
+        }
+        $start =isset($this->post['start'])&&$this->post['start']!='' ? $this->post['start']:"";
+        if($start!==""){
+            $where[]=['addtime',">=", $start];
+        }
+        $end =isset($this->post['end'])&&$this->post['end']!='' ? $this->post['end']:"";
+        if($end!==""){
+            $where[]=['addtime',"<=", $end];
+        }
+        $count=Db::name("order_back")->where($where)->count();
+        $total = ceil($count/$size);
+        $page = $page >= $total ? $total : $page;
+        $list = Db::name("order_back")->where($where)->page($page,$size)->order("addtime desc")->select();
+        $data=[];
+        foreach ($list as $value){
+            $value['wsm_name']="";
+            $value['wsm_supplier']='';
+            $value['wsm_supplierNo']='';
+            if($value['return_wsm']!=""){
+                $wsmcode = Db::name("warehouse_info")->alias("a")->leftJoin("supplier b","a.supplierNo=b.code")
+                    ->where(["a.wsm_code"=>$value['return_wsm']])->field("a.name as wsm_name,b.name,b.code")->find();
+                $value['wsm_name'] =isset($wsmcode['wsm_name']) ? $wsmcode['wsm_name']:"";
+                $value['wsm_supplier'] =isset($wsmcode['name']) ? $wsmcode['name']:"";
+                $value['wsm_supplierNo'] =isset($wsmcode['code']) ? $wsmcode['code']:"";
+            }
+            $inorder= Db::name("order_backinfo")->where(['thNo'=>$value['thNo'],"is_del"=>0])->select();
+            $value['child']=empty($inorder)? [] : $inorder;
+            $data[]=$value;
+        }
+        return app_show(0,"获取成功",["list"=>$data ,"count"=>$count]);
+    }
+
+    /**
+     * @return \think\response\Json|void
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     */
+  public function info(){
+      $thNo = isset($this->post['thNo']) && $this->post['thNo']!="" ? trim($this->post['thNo']):"";
+      if($thNo==""){
+        return error_show(1004,"参数thNo不能为空");
+      }
+      $info =Db::name("order_back")->where(['thNo'=>$thNo])->find();
+      if(empty($info)){
+          return error_show(1004,"未找到数据");
+      }
+      $info['wsm_name']="";
+      $info['wsm_supplier']='';
+      $info['wsm_supplierNo']='';
+      if($info['return_wsm']!=""){
+          $wsmcode = Db::name("warehouse_info")->alias("a")->leftJoin("supplier b","a.supplierNo=b.code")
+              ->where(["a.wsm_code"=>$info['return_wsm']])->field("a.name as wsm_name,b.name,b.code")->find();
+          $info['wsm_name'] =isset($wsmcode['wsm_name']) ? $wsmcode['wsm_name']:"";
+          $info['wsm_supplier'] =isset($wsmcode['name']) ? $wsmcode['name']:"";
+          $info['wsm_supplierNo'] =isset($wsmcode['code']) ? $wsmcode['code']:"";
+      }
+      $inorder= Db::name("order_backinfo")->where(['thNo'=>$info['thNo'],"is_del"=>0])->select();
+      $info['child']=empty($inorder)? [] : $inorder;
+      return  app_show(0,"获取成功",$info);
+  }
+
+    /**
+     * @return \think\response\Json|void
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     */
+  public function check(){
+      $thNo = isset($this->post['thNo']) && $this->post['thNo']!="" ? trim($this->post['thNo']):"";
+      if($thNo==""){
+          return error_show(1004,"参数thNo不能为空");
+      }
+      $info =Db::name("order_back")->where(['thNo'=>$thNo])->find();
+      if(empty($info)){
+          return error_show(1004,"未找到数据");
+      }
+      $receive = isset($this->post['receive']) && $this->post['receive']!="" ? intval($this->post['receive']):"";
+      if($receive==""){
+          return error_show(1004,"参数receive不能为空");
+      }
+      $normal = isset($this->post['normal']) && $this->post['normal']!=="" ? intval($this->post['normal']):"";
+      if($receive===""){
+          return error_show(1004,"参数receive不能为空");
+      }
+      $errorlist = isset($this->post['errorlist']) && $this->post['errorlist']!=="" ? $this->post['errorlist']:[];
+
+      $remark =  isset($this->post['remark']) && $this->post['remark']!=="" ? trim($this->post['remark']):"";
+      $info['received_num'] = $receive;
+      $info['normal_num'] = $normal;
+      $info['remark'] = $remark;
+      $info['status'] = 2;
+      $info['updatetime'] = date("Y-m-d H:i:s");
+      Db::startTrans();
+      try{
+          $up=Db::name("order_back")->save($info);
+          if($up){
+              if(empty($errorlist)){
+                  Db::commit();
+                  return app_show(0,'更新成功');
+              }
+              $temp =[];
+              foreach($errorlist as $value){
+                  $data=[];
+                  $data['thNo']=$thNo;
+                  $data['error_num']=$value['error_num'];
+                  $data['error_code']=$value['error_code'];
+                  $data['error_remark']=$value['error_remark'];
+                  $data['addtime']=date("Y-m-d H:i:s");
+                  $data['updatetime']=date("Y-m-d H:i:s");
+                  $temp[]=$data;
+              }
+              $in = Db::name("order_backinfo")->insertAll($temp);
+              if($in){
+                  Db::commit();
+                  return app_show(0,'更新成功');
+              }
+          }
+          Db::rollback();
+          return error_show(1005,'更新失败');
+      }catch (\Exception $e){
+          Db::rollback();
+          return error_show(1004,$e->getMessage());
+      }
+  }
+
+  public function CheckExam(){
+      $thNo = isset($this->post['thNo']) && $this->post['thNo']!="" ? trim($this->post['thNo']):"";
+      if($thNo==""){
+          return error_show(1004,"参数thNo不能为空");
+      }
+      $info =Db::name("order_back")->where(['thNo'=>$thNo])->find();
+      if(empty($info)){
+          return error_show(1004,"未找到数据");
+      }
+      $errorlist = isset($this->post['errorlist']) && $this->post['errorlist']!=="" ? $this->post['errorlist']:[];
+      $status = isset($this->post['status']) && $this->post['status']!=="" ? intval($this->post['status']):"";
+      if($status===""){
+          return error_show(1004,"参数status不能为空");
+      }
+      Db::startTrans();
+      try{
+          $info['status'] =$status;
+          $info['updatetime'] = date("Y-m-d H:i:s");
+          $up=Db::name("order_back")->save($info);
+          if($up){
+              if(empty($errorlist)){
+                  Db::commit();
+                  return app_show(0,'更新成功');
+              }
+             // $temp =[];
+              foreach($errorlist as $value){
+                $temp=Db::name("order_backinfo")->where(['id'=>$value["id"],"is_del"=>0,"thNo"=>$thNo])->find();
+                if(empty($temp)){
+                    Db::rollback();
+                    return error_show(1005,'异常记录数据未找到');
+                }
+                $temp['status']=$value['status'];
+                $temp['exam_remark']=$value['remark'];
+                $temp['updatetime']=date("Y-m-d H:i:s");
+                $com = Db::name("order_backinfo")->save($temp);
+                if($com==false){
+                    Db::rollback();
+                    return error_show(1005,'异常记录数据更新失败');
+                }
+              }
+                  Db::commit();
+                  return app_show(0,'更新成功');
+          }
+          Db::rollback();
+          return error_show(1005,'更新失败');
+      }catch (\Exception $e){
+          Db::rollback();
+          return error_show(1004,$e->getMessage());
+      }
+  }
+    public function Exam(){
+        $thNo = isset($this->post['thNo']) && $this->post['thNo']!="" ? trim($this->post['thNo']):"";
+        if($thNo==""){
+            return error_show(1004,"参数thNo不能为空");
+        }
+        $info =Db::name("order_back")->where(['thNo'=>$thNo])->find();
+        if(empty($info)){
+            return error_show(1004,"未找到数据");
+        }
+        $status = isset($this->post['status']) && $this->post['status']!=="" ? intval($this->post['status']):"";
+        if($status===""){
+            return error_show(1004,"参数status不能为空");
+        }
+        $remark= isset($this->post['remark']) && $this->post['remark']!="" ? trim($this->post['remark']):"";
+        Db::startTrans();
+        try{
+            $info['status'] =$status;
+            $info['remark'] =$remark;
+            $info['updatetime'] = date("Y-m-d H:i:s");
+            $up=Db::name("order_back")->save($info);
+            if($up){
+                Db::commit();
+                return app_show(0,'更新成功');
+            }
+            Db::rollback();
+            return error_show(1005,'更新失败');
+        }catch (\Exception $e){
+            Db::rollback();
+            return error_show(1004,$e->getMessage());
+        }
+    }
+}

+ 1 - 1
app/admin/controller/Process.php

@@ -67,7 +67,7 @@ class Process extends BaseController
       if($orderCode==""){
           return error_show(1004,"参数orderCode不能为空");
       }
-    $list = Db::name("action_process")->where(['order_type'=>$process_type,"is_del"=>0,"status"=>1])->order("weight desc,id")
+    $list = Db::name("action_process")->where(['order_type'=>$process_type,"is_del"=>0,"status"=>1])->order("weight desc,id desc")
         ->select();
     $data=[];
     foreach ($list as $value){

+ 8 - 8
app/admin/controller/Resign.php

@@ -17,14 +17,14 @@ class Resign extends BaseController
     {
         parent::__construct($app);
         $this->post = $this->request->post();
-//        $token = isset($this->post['token']) ? trim($this->post['token']) : "";
-//        if($token==""){
-//            return error_show(101,'token不能为空');
-//        }
-//        $effetc = VerifyTokens($token);
-//        if(!empty($effetc) && $effetc['code']!=0) {
-//            return error_show($effetc['code'], $effetc['message']);
-//        }
+        $token = isset($this->post['token']) ? trim($this->post['token']) : "";
+        if($token==""){
+            return error_show(101,'token不能为空');
+        }
+        $effetc = VerifyTokens($token);
+        if(!empty($effetc) && $effetc['code']!=0) {
+            return error_show($effetc['code'], $effetc['message']);
+        }
     }
     public function list(){
         $page = isset($this->post['page']) && $this->post['page'] !=="" ? intval($this->post['page']):"1";

+ 12 - 1
app/admin/route/app.php

@@ -229,4 +229,15 @@ Route::rule('afterpost','admin/After/addpost');
 Route::rule('aftergys','admin/After/GysFeed');
 
 Route::rule('processolist','admin/Proorder/list');
-Route::rule('processowaitlist','admin/Proorder/waitlist');
+Route::rule('processowaitlist','admin/Proorder/waitlist');
+
+Route::rule('orderbacklist','admin/Orderback/list');
+Route::rule('orderbackinfo','admin/Orderback/info');
+Route::rule('orderbackcheck','admin/Orderback/check');
+Route::rule('orderbce','admin/Orderback/CheckExam');
+Route::rule('orderbackexam','admin/Orderback/Exam');
+
+Route::rule('goldlist','admin/Gold/list');
+Route::rule('goldadd','admin/Gold/add');
+Route::rule('gold','admin/Gold/GetByType');
+