Invite.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace app\user\controller;
  3. use library\Controller;
  4. use think\Db;
  5. /**
  6. * 推荐管理
  7. * Class Invite
  8. * @package app\user\controller
  9. */
  10. class Invite extends Controller
  11. {
  12. protected $table ="InviteInfo";
  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. $name = input('name');
  27. $phone = input('phone');
  28. $goods_id = input('goods_id');
  29. $pid = input('pid');
  30. $where = [];
  31. if($name) $where[] = ['m.name','like','%'.$name.'%'] ;
  32. if($phone) $where[] = ['m.phone','=',$phone] ;
  33. if($goods_id) $where[] = ['i.goods_id','=',$goods_id] ;
  34. if($pid) $where[] = ['i.pid','=',$pid] ;
  35. $query = $this->_query($this->table)->alias('i')
  36. ->field('i.*,m.name,m.headimg,m.phone');
  37. if(!empty($where)) $query->where($where);
  38. $query->join('store_member m','m.id = i.user_id','LEFT')
  39. ->order('i.id desc')->page();
  40. }
  41. protected function _index_page_filter(&$data)
  42. {
  43. foreach ($data as $k=>&$v){
  44. $parent_info = Db::table('store_member')->field('headimg,name')->find($v['pid']);
  45. $v['p_name'] = $parent_info['name'];
  46. $v['p_headimg'] = $parent_info['headimg'];
  47. }
  48. }
  49. }