1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <?php
- namespace app\admin\controller;
- use think\App;
- use think\facade\Db;
- //消息(已读未读)
- class Proorder extends Base
- {
- public function __construct(App $app)
- {
- parent::__construct($app);
- }
- 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],['a.order_status',"=",2]];
- $count = Db::name('process_order')->alias("a")->leftJoin("workflow b","a.order_type=b.order_type and a.order_code=b.order_code")->where($where)->count();
- $total = ceil("$count/$size");
- $page = $page>$total ? $total:$page;
- $list = Db::name('process_order')->alias("a")->leftJoin("workflow b","a.order_type=b.order_type and a.order_code=b.order_code")
- ->field("b.apply_id,b.apply_name,a.addtime,a.action_uid,a.action_name,a.order_status,a.action_status,a.order_type,a.action_process,a.order_code,a.order_id,a.id")
- ->where($where)->page($page,$size)->order("a.addtime desc")->select();
- $data=[];
- foreach ($list as $value){
- $str = Db::name("process")->where(['process_type' => $value['order_type']])->field("process_name,status")->find();
- $var = Db::name("action_process")->where(['order_type'=>$value['order_type'],'order_process'=>$value['action_status']])->field("status_name,order_process,order_name,roleid")->find();
- $value['process_name']=$str['process_name'];
- $value['order_name']=$var['order_name'];
- $value['status_name'] = $var['status_name'];
- $data[]=$value;
- }
- return app_show(0,"获取成功",['count'=>$count,'list'=>$data]);
- }
- public function waitlist(){
- $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],['a.status',"=",1]];
- $order_code= isset($this->post['order_code']) && $this->post['order_code'] !==""? intval($this->post['order_code']):"";
- if($order_code!=""){
- $where[]= ["a.order_code",'like',"%$order_code%"];
- }
- $apply_id = isset($this->post['apply_id']) && $this->post['apply_id'] !==""? trim($this->post['apply_id']) :"";
- if($apply_id!=""){
- $where[]=["a.wait_id","=",$apply_id];
- }
- $action_uid = isset($this->post['action_uid']) && $this->post['action_uid'] !==""? trim($this->post['action_uid']) :"";
- if($action_uid!=""){
- $where[]=["a.action_uid","=",$action_uid];
- }
- $count = Db::name('process_wait')->alias("a")->leftJoin("workflow b","a.order_type=b.order_type and a.order_code=b.order_code")->where($where)->count();
- $total = ceil("$count/$size");
- $page = $page>$total ? $total:$page;
- $list = Db::name('process_wait')->alias("a")->leftJoin("workflow b","a.order_type=b.order_type and a.order_code=b.order_code")
- ->field("a.wait_id apply_id,a.wait_name apply_name,a.addtime,a.action_uid,a.action_name,a.order_status,a.order_type,a.order_process,a.order_code,a.order_id,a.id")
- ->where($where)->page($page,$size)->order("a.addtime desc")->select();
- $data=[];//->field("status,order_name,process_name")
- foreach ($list as $value) {
- $str = Db::name("process")->where(['process_type' => $value['order_type']])->field("process_name,status")->find();
- $var = Db::name("action_process")->where(['order_type'=>$value['order_type'],'order_process'=>$value['order_status']])->field("status_name,order_process,order_name,roleid")->find();
- $value['process_name']=$str['process_name'];
- $value['order_name']=$var['order_name'];
- $value['status_name'] = $var['status_name'];
- $data[]=$value;
- }
- return app_show(0,"获取成功",["list"=>$data,'count'=>$count]);
- }
- public function all(){
- $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']);
- }
- $where=[["is_del","=",0]];
- $process_name = isset($this->post['process_name']) && $this->post['process_name'] !==""? trim($this->post['process_name']) :"";
- if($process_name!=""){
- $where[]=["process_name","like","%$process_name%"];
- }
- $process_type = isset($this->post['process_type']) && $this->post['process_type'] !==""? trim($this->post['process_type']) :"";
- if($process_type!=""){
- $where[]=["process_type","like","%$process_type%"];
- }
- $list = Db::name('process')->where($where)->order("addtime desc")->select();
- return app_show(0,"获取成功",$list);
- }
- }
|