ソースを参照

药品运送切换正式数据库

zgg 1 ヶ月 前
コミット
7e0cb9f3bc

+ 3 - 7
application/admin/controller/Wlps.php

@@ -28,12 +28,9 @@ class Wlps extends Auth
             }
             $map= empty($map) ? true: $map;
             //数据查询
-            // $lists = Db::connect('db_config_jili')->name('wlps')->where($map)->limit($start,$length)->order($order)->select();
-            $lists = Db::name('wlps')->where($map)->limit($start,$length)->order($order)->select();
-
+             $lists = Db::connect('db_config_jili')->name('wlps')->where($map)->limit($start,$length)->order($order)->select();
             //数据返回
-            // $totalCount = Db::connect('db_config_jili')->name('wlps')->where($map)->count();
-            $totalCount = Db::name('wlps')->where($map)->count();
+             $totalCount = Db::connect('db_config_jili')->name('wlps')->where($map)->count();
             $totalPage = ceil($totalCount/$length);
             $result['page'] = $page;
             $result['total'] = $totalPage;
@@ -47,8 +44,7 @@ class Wlps extends Auth
     
         public function deal(){
         $id = input('id','','intval');
-        // $info = Db::connect('db_config_jili')->name('wlps')->where('id',$id)->find();
-        $info = Db::name('wlps')->where('id',$id)->find();
+        $info = Db::connect('db_config_jili')->name('wlps')->where('id',$id)->find();
         if(!$info){
             $this->error('记录不存在');
         }

+ 6 - 14
application/common/model/Orders.php

@@ -1573,13 +1573,9 @@ class Orders extends Base {
 
             }
             if($info['work_type_mode'] == 3){
-//                $wlps = Db::connect('db_config_jili')->name('wlps')->where('order_id',$info['id'])->find();
-                $wlps = Db::name('wlps')->where('order_id',$info['id'])->find();
+                $wlps = Db::connect('db_config_jili')->name('wlps')->where('order_id',$info['id'])->find();
                 if($wlps){
-//                    Db::connect('db_config_jili')->name('wlps')->where('id',$wlps['id'])->update([
-//                        'send_time' => date('Y-m-d H:i:s')
-//                    ]);
-                    Db::name('wlps')->where('id',$wlps['id'])->update([
+                    Db::connect('db_config_jili')->name('wlps')->where('id',$wlps['id'])->update([
                         'send_time' => date('Y-m-d H:i:s')
                     ]);
                 }
@@ -2020,15 +2016,11 @@ class Orders extends Base {
                     }
                 }
                 if($info['work_type_mode'] == 3){
-//                $wlps = Db::connect('db_config_jili')->name('wlps')->where('order_id',$info['id'])->find();
-                    $wlps = Db::name('wlps')->where('order_id',$info['id'])->find();
+                $wlps = Db::connect('db_config_jili')->name('wlps')->where('order_id',$info['id'])->find();
                     if($wlps){
-//                    Db::connect('db_config_jili')->name('wlps')->where('id',$wlps['id'])->update([
-//                        'send_time' => date('Y-m-d H:i:s')
-//                    ]);
-                        Db::name('wlps')->where('id',$wlps['id'])->update([
-                            'send_time' => date('Y-m-d H:i:s')
-                        ]);
+                    Db::connect('db_config_jili')->name('wlps')->where('id',$wlps['id'])->update([
+                        'send_time' => date('Y-m-d H:i:s')
+                    ]);
                     }
                 }
                 $this->commit();

+ 8 - 30
application/common/model/Todo.php

@@ -465,22 +465,13 @@ class Todo extends Base
                 exception('订单修改失败');
             }
             if($info['work_type_mode'] == 3){
-//               $wlps = Db::connect('db_config_jili')->name('wlps')->where('order_id',$info['order_id'])->find();
-                $wlps = Db::name('wlps')->where('order_id',$info['order_id'])->find();
+               $wlps = Db::connect('db_config_jili')->name('wlps')->where('order_id',$info['order_id'])->find();
                 if($wlps){
                     $user = Db::name('user')->where('id',$info['to_user_id'])->find();
-//                    Db::connect('db_config_jili')->name('wlps')
-//                        ->where('id',$wlps['id'])
-//                        ->update([
-//                            'paisr' => $user?$user['user_id']:'',
-//                            'paisr_name' => $user?$user['real_name']:'',
-//                            'paisr_phone' => $user?$user['mobile']:'',
-//                            'pais_time' => date('Y-m-d H:i:s')
-//                        ]);
-                    Db::name('wlps')
+                    Db::connect('db_config_jili')->name('wlps')
                         ->where('id',$wlps['id'])
                         ->update([
-                            'paisr' => $user?$user['id']:'',
+                            'paisr' => $user?$user['user_id']:'',
                             'paisr_name' => $user?$user['real_name']:'',
                             'paisr_phone' => $user?$user['mobile']:'',
                             'pais_time' => date('Y-m-d H:i:s')
@@ -611,13 +602,9 @@ class Todo extends Base
                 }
             }
             if($data['work_type_mode'] == 3){
-//                $wlps = Db::connect('db_config_jili')->name('wlps')->where('order_id',$data['order_id'])->find();
-                $wlps = Db::name('wlps')->where('order_id',$data['order_id'])->find();
+                $wlps = Db::connect('db_config_jili')->name('wlps')->where('order_id',$data['order_id'])->find();
                 if($wlps){
-//                    Db::connect('db_config_jili')->name('wlps')->where('id',$wlps['id'])->update([
-//                        'send_time' => date('Y-m-d H:i:s')
-//                    ]);
-                    Db::name('wlps')->where('id',$wlps['id'])->update([
+                    Db::connect('db_config_jili')->name('wlps')->where('id',$wlps['id'])->update([
                         'send_time' => date('Y-m-d H:i:s')
                     ]);
                 }
@@ -939,22 +926,13 @@ class Todo extends Base
                 return false;
             }
             if($todo['work_type_mode'] == 3){
-//               $wlps = Db::connect('db_config_jili')->name('wlps')->where('order_id',$todo['order_id'])->find();
-                $wlps = Db::name('wlps')->where('order_id',$todo['order_id'])->find();
+               $wlps = Db::connect('db_config_jili')->name('wlps')->where('order_id',$todo['order_id'])->find();
                 if($wlps){
                     $user = Db::name('user')->where('id',$todo['to_user_id'])->find();
-//                    Db::connect('db_config_jili')->name('wlps')
-//                        ->where('id',$wlps['id'])
-//                        ->update([
-//                            'paisr' => $user?$user['user_id']:'',
-//                            'paisr_name' => $user?$user['real_name']:'',
-//                            'paisr_phone' => $user?$user['mobile']:'',
-//                            'pais_time' => date('Y-m-d H:i:s')
-//                        ]);
-                    Db::name('wlps')
+                    Db::connect('db_config_jili')->name('wlps')
                         ->where('id',$wlps['id'])
                         ->update([
-                            'paisr' => $user?$user['id']:'',
+                            'paisr' => $user?$user['user_id']:'',
                             'paisr_name' => $user?$user['real_name']:'',
                             'paisr_phone' => $user?$user['mobile']:'',
                             'pais_time' => date('Y-m-d H:i:s')

+ 3 - 6
application/common/model/Wlps.php

@@ -12,16 +12,14 @@ class Wlps extends Base
         $dep = 798;
         $userId = 3401;
         if(!$v['s_bmid'] || !$v['department_no']){
-            // Db::connect('db_config_jili')->name('wlps')->where('id',$v['id'])->update(['is_deal'=>2,'reason'=>'发起部门编号或病区编码为空']);
-            Db::name('wlps')->where('id',$v['id'])->update(['is_deal'=>2,'reason'=>'发起部门编号或病区编码为空']);
+             Db::connect('db_config_jili')->name('wlps')->where('id',$v['id'])->update(['is_deal'=>2,'reason'=>'发起部门编号或病区编码为空']);
             $this->error = '发起部门编号或病区编码为空';
             return false;
         }
         $start = Db::name('address')->where('del',0)->where('org_id',$orgId)->where('','exp',Db::raw("FIND_IN_SET(2,types)"))->where('third_sn',$v['s_bmid'])->find();
         $end = Db::name('address')->where('del',0)->where('org_id',$orgId)->where('','exp',Db::raw("FIND_IN_SET(2,types)"))->where('third_sn',$v['department_no'])->find();
         if(!$start || !$end){
-            //  Db::connect('db_config_jili')->name('wlps')->where('id',$v['id'])->update(['is_deal'=>2,'reason'=>'未查找到相关联的发起部门编号或病区编码']);
-            Db::name('wlps')->where('id',$v['id'])->update(['is_deal'=>2,'reason'=>'未查找到相关联的发起部门编号或病区编码']);
+              Db::connect('db_config_jili')->name('wlps')->where('id',$v['id'])->update(['is_deal'=>2,'reason'=>'未查找到相关联的发起部门编号或病区编码']);
             $this->error = '未查找到相关联的发起部门编号或病区编码';
             return false;
         }
@@ -106,8 +104,7 @@ class Wlps extends Base
             if($auto){
                 $wd['send_time'] = date('Y-m-d H:i:s');
             }
-            // $res = Db::connect('db_config_jili')->name('wlps')->where('id',$v['id'])->update($wd);
-            $res = Db::name('wlps')->where('id',$v['id'])->update($wd);
+             $res = Db::connect('db_config_jili')->name('wlps')->where('id',$v['id'])->update($wd);
             if (!$res) {
                 exception('订单保存失败');
             }

+ 11 - 21
application/cron/Wlps.php

@@ -27,8 +27,7 @@ class Wlps extends Task
     }
     
     public function ypconvey(){
-        // $lists = Db::connect('db_config_jili')->name('wlps')->where('is_deal',0)->where('is_qx','N')->select();
-        $lists = Db::name('wlps')->where('is_deal',0)->where('is_qx','N')->select();
+         $lists = Db::connect('db_config_jili')->name('wlps')->where('is_deal',0)->where('is_qx','N')->select();
         $lists = $lists?$lists:[];
         foreach ($lists as $k=>$v){
             (new \app\common\model\Wlps())->deal_wlps($v);
@@ -36,25 +35,16 @@ class Wlps extends Task
     }
     // 药品运送取消,每分钟查询一次
     public function cancelypconvey(){
-        // $lists=Db::connect('db_config_jili')
-        //     ->name('wlps')
-        //     ->alias('a')
-        //     ->join('orders as b','a.order_id = b.order_id')
-        //     ->field('b.*')
-        //     ->whereIn('b.order_mode',[1,5])
-        //     ->where('b.del_ref',0)
-        //     ->where('a.order_id', '>',0)
-        //     ->where('a.is_qx','<>','N')
-        //     ->select();
-        $lists=Db::name('wlps')
-            ->alias('a')
-            ->join('orders as b','a.order_id = b.order_id')
-            ->field('b.*')
-            ->whereIn('b.order_mode',[1,5])
-            ->where('b.del_ref',0)
-            ->where('a.order_id', '>',0)
-            ->where('a.is_qx','<>','N')
-            ->select();
+         $lists=Db::connect('db_config_jili')
+             ->name('wlps')
+             ->alias('a')
+             ->join('orders as b','a.order_id = b.order_id')
+             ->field('b.*')
+             ->whereIn('b.order_mode',[1,5])
+             ->where('b.del_ref',0)
+             ->where('a.order_id', '>',0)
+             ->where('a.is_qx','<>','N')
+             ->select();
         $lists = $lists?$lists:[];
         foreach ($lists as $k=>$v){
              $this->startTrans();