Delivery.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace app\user\controller;
  3. use library\Controller;
  4. use think\Db;
  5. /**
  6. * 收货地址
  7. * Class Delivery
  8. * @package app\user\controller
  9. */
  10. class Delivery extends Controller
  11. {
  12. protected $table ="DeliveryAddress";
  13. /**
  14. * 列表
  15. * @auth true
  16. * @menu true
  17. * @throws \think\Exception
  18. * @throws \think\db\exception\DataNotFoundException
  19. * @throws \think\db\exception\ModelNotFoundException
  20. * @throws \think\exception\DbException
  21. * @throws \think\exception\PDOException
  22. */
  23. public function index()
  24. {
  25. $this->title = '收货地址列表';
  26. $query = $this->_query($this->table);
  27. $where= [];
  28. $were[] = ['i.is_deleted','=',0];
  29. if($this->request->request('user_name')) $where[]= ['m.name','like','%'.$this->request->request('user_name').'%'];
  30. if($this->request->request('name')) $where[]= ['i.name','like','%'.$this->request->request('name').'%'];
  31. if($this->request->request('sel_pro')) $where[]= ['i.pro_name','like','%'.$this->request->request('sel_pro').'%'];
  32. if($this->request->request('sel_city')) $where[]= ['i.city_name','like','%'.$this->request->request('sel_city').'%'];
  33. if($this->request->request('name')) $where[]= ['i.name','like','%'.$this->request->request('name').'%'];
  34. if($this->request->request('add_name')) $where[]= ['i.pro_name|i.city_name|i.county_name|i.street_name|i.detail','like','%'.$this->request->request('add_name').'%'];
  35. $query->alias('i')->field('i.* ,m.headimg,m.name as user_name,m.phone')
  36. ->join('store_member m',' m.id = i.user_id ','LEFT');
  37. if(!empty($where)) $query->where($where);
  38. $query ->order('i.id desc')->page();
  39. }
  40. /**
  41. * 删除
  42. * @auth true
  43. * @menu true
  44. * @throws \think\Exception
  45. * @throws \think\db\exception\DataNotFoundException
  46. * @throws \think\db\exception\ModelNotFoundException
  47. * @throws \think\exception\DbException
  48. * @throws \think\exception\PDOException
  49. */
  50. public function del()
  51. {
  52. $this->_save($this->table, ['is_deleted' => 1]);
  53. }
  54. }