BillApply.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. namespace app\synth\controller;
  3. use library\Controller;
  4. use think\Db;
  5. class BillApply extends Controller
  6. {
  7. protected $table = 'BillApply';
  8. /**
  9. * 列表
  10. * @auth true
  11. * @menu true
  12. * @throws \think\Exception
  13. * @throws \think\db\exception\DataNotFoundException
  14. * @throws \think\db\exception\ModelNotFoundException
  15. * @throws \think\exception\DbException
  16. * @throws \think\exception\PDOException
  17. */
  18. public function index()
  19. {
  20. $this->title = '列表';
  21. $query = $this->_query($this->table);
  22. $this->type_arr = \app\common\model\BillType::getType();
  23. $where= [];
  24. $were[] = ['i.is_deleted','=',0];
  25. if($this->request->request('user_name')) $where[]= ['i.name','like','%'.$this->request->request('user_name').'%'];
  26. if($this->request->request('header')) $where[]= ['i.header','like','%'.$this->request->request('header').'%'];
  27. if($this->request->request('type')) $where[]= ['i.type','=',$this->request->request('type')];
  28. $query->alias('i')->field('i.* ,b.title type_name,m.headimg,m.name as user_name,m.phone')
  29. ->Leftjoin('store_member m',' m.id = i.user_id ')
  30. ->join('bill_type b',' b.id = i.type ','LEFT');
  31. if(!empty($where)) $query->where($where);
  32. $query ->order('i.id desc')->page();
  33. }
  34. protected function _index_page_filter(array &$data)
  35. {
  36. }
  37. /**
  38. * 删除
  39. * @auth true
  40. * @menu true
  41. * @param array $data
  42. * @throws \think\db\exception\DataNotFoundException
  43. * @throws \think\db\exception\ModelNotFoundException
  44. * @throws \think\exception\DbException
  45. */
  46. public function remove()
  47. {
  48. $this->_save($this->table, ['is_deleted' => '1']);
  49. }
  50. /**
  51. * 编辑
  52. * @auth true
  53. * @menu true
  54. * @throws \think\Exception
  55. * @throws \think\db\exception\DataNotFoundException
  56. * @throws \think\db\exception\ModelNotFoundException
  57. * @throws \think\exception\DbException
  58. * @throws \think\exception\PDOException
  59. */
  60. public function edit()
  61. {
  62. $this->title = '编辑';
  63. $this->_form($this->table, 'form');
  64. }
  65. }