Wlps.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace app\admin\controller;
  3. use think\Db;
  4. class Wlps extends Auth
  5. {
  6. private $org_Id=103;
  7. public function index(){
  8. if(request()->isAjax()){
  9. //分页参数
  10. $length = input('rows',10,'intval'); //每页条数
  11. $page = input('page',1,'intval'); //第几页
  12. $start = ($page - 1) * $length; //分页开始位置
  13. //排序
  14. $sortRow = input('sidx','id','trim'); //排序列
  15. $sort = input('sord','desc','trim'); //排序方式
  16. $order = $sortRow.' '.$sort;
  17. $bh = input('bh','','trim');
  18. if($bh){
  19. $map[] = ['jjddjbh','=',$bh];
  20. }
  21. if ($this->orgId != $this->org_Id) {
  22. $map[] = ['order_id','=',-1];
  23. }
  24. $map= empty($map) ? true: $map;
  25. //数据查询
  26. $lists = Db::connect('db_config_jili')->name('wlps')->where($map)->limit($start,$length)->order($order)->select();
  27. //数据返回
  28. $totalCount = Db::connect('db_config_jili')->name('wlps')->where($map)->count();
  29. $totalPage = ceil($totalCount/$length);
  30. $result['page'] = $page;
  31. $result['total'] = $totalPage;
  32. $result['records'] = $totalCount;
  33. $result['rows'] = $lists;
  34. return json($result);
  35. }else{
  36. return $this->fetch();
  37. }
  38. }
  39. public function deal(){
  40. $id = input('id','','intval');
  41. $info = Db::connect('db_config_jili')->name('wlps')->where('id',$id)->find();
  42. if(!$info){
  43. $this->error('记录不存在');
  44. }
  45. if($info['is_deal'] != 2 || $info['is_qx'] != 'N'){
  46. $this->error('该状态无法执行此操作');
  47. }
  48. $ret = model('Wlps')->deal_wlps($info);
  49. if($ret){
  50. $this->success('操作成功');
  51. }else{
  52. $this->error('操作失败,'.model('Wlps')->getError());
  53. }
  54. }
  55. }