Proorder.php 4.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. namespace app\admin\controller;
  3. use think\App;
  4. use think\facade\Db;
  5. //消息(已读未读)
  6. class Proorder extends Base
  7. {
  8. public function __construct(App $app)
  9. {
  10. parent::__construct($app);
  11. }
  12. public function list(){
  13. $page = isset($this->post['page']) && $this->post['page'] !==""? intval($this->post['page']) :"1";
  14. $size = isset($this->post['size']) && $this->post['size'] !==""? intval($this->post['size']) :"10";
  15. $where =[['is_del',"=",0],['a.order_status',"=",2]];
  16. $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();
  17. $total = ceil("$count/$size");
  18. $page = $page>$total ? $total:$page;
  19. $list = Db::name('process_order')->alias("a")->leftJoin("workflow b","a.order_type=b.order_type and a.order_code=b.order_code")
  20. ->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")
  21. ->where($where)->page($page,$size)->order("a.addtime desc")->select();
  22. $data=[];
  23. foreach ($list as $value){
  24. $str = Db::name("process")->where(['process_type' => $value['order_type']])->field("process_name,status")->find();
  25. $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();
  26. $value['process_name']=$str['process_name'];
  27. $value['order_name']=$var['order_name'];
  28. $value['status_name'] = $var['status_name'];
  29. $data[]=$value;
  30. }
  31. return app_show(0,"获取成功",['count'=>$count,'list'=>$data]);
  32. }
  33. public function waitlist(){
  34. $page = isset($this->post['page']) && $this->post['page'] !==""? intval($this->post['page']) :"1";
  35. $size = isset($this->post['size']) && $this->post['size'] !==""? intval($this->post['size']) :"10";
  36. $where = [['is_del',"=",0],['a.status',"=",1]];
  37. $order_code= isset($this->post['order_code']) && $this->post['order_code'] !==""? intval($this->post['order_code']):"";
  38. if($order_code!=""){
  39. $where[]= ["a.order_code",'like',"%$order_code%"];
  40. }
  41. $apply_id = isset($this->post['apply_id']) && $this->post['apply_id'] !==""? trim($this->post['apply_id']) :"";
  42. if($apply_id!=""){
  43. $where[]=["a.wait_id","=",$apply_id];
  44. }
  45. $action_uid = isset($this->post['action_uid']) && $this->post['action_uid'] !==""? trim($this->post['action_uid']) :"";
  46. if($action_uid!=""){
  47. $where[]=["a.action_uid","=",$action_uid];
  48. }
  49. $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();
  50. $total = ceil("$count/$size");
  51. $page = $page>$total ? $total:$page;
  52. $list = Db::name('process_wait')->alias("a")->leftJoin("workflow b","a.order_type=b.order_type and a.order_code=b.order_code")
  53. ->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")
  54. ->where($where)->page($page,$size)->order("a.addtime desc")->select();
  55. $data=[];//->field("status,order_name,process_name")
  56. foreach ($list as $value) {
  57. $str = Db::name("process")->where(['process_type' => $value['order_type']])->field("process_name,status")->find();
  58. $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();
  59. $value['process_name']=$str['process_name'];
  60. $value['order_name']=$var['order_name'];
  61. $value['status_name'] = $var['status_name'];
  62. $data[]=$value;
  63. }
  64. return app_show(0,"获取成功",["list"=>$data,'count'=>$count]);
  65. }
  66. public function all(){
  67. $token = isset($this->post['token']) ? trim($this->post['token']) : "";
  68. if($token==""){
  69. return error_show(101,'token不能为空');
  70. }
  71. $effetc = VerifyTokens($token);
  72. if(!empty($effetc) && $effetc['code']!=0){
  73. return error_show($effetc['code'],$effetc['message']);
  74. }
  75. $where=[["is_del","=",0]];
  76. $process_name = isset($this->post['process_name']) && $this->post['process_name'] !==""? trim($this->post['process_name']) :"";
  77. if($process_name!=""){
  78. $where[]=["process_name","like","%$process_name%"];
  79. }
  80. $process_type = isset($this->post['process_type']) && $this->post['process_type'] !==""? trim($this->post['process_type']) :"";
  81. if($process_type!=""){
  82. $where[]=["process_type","like","%$process_type%"];
  83. }
  84. $list = Db::name('process')->where($where)->order("addtime desc")->select();
  85. return app_show(0,"获取成功",$list);
  86. }
  87. }