SignLog.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. namespace app\user\controller;
  3. use library\Controller;
  4. use think\Db;
  5. /**
  6. * 会员签到记录
  7. * Class SignLog
  8. * @package app\user\controller
  9. */
  10. class SignLog extends Controller
  11. {
  12. protected $table ="UserSign";
  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. $where[] = ['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('sign_time')) $where[] = ['i.create_at','between time',[$this->request->request('sign_time').' 00:00:00',$this->request->request('sign_time').' 23:59:59']];
  31. $query->alias('i')
  32. ->field('i.* ,m.headimg,m.name,m.phone')
  33. ->join('store_member m',' m.id = i.user_id ','LEFT');
  34. if(!empty($where)) $query->where($where);
  35. $query ->order('i.id desc')->page();
  36. }
  37. /**
  38. * 删除签到日志
  39. * @auth true
  40. * @menu true
  41. * @throws \think\Exception
  42. * @throws \think\db\exception\DataNotFoundException
  43. * @throws \think\db\exception\ModelNotFoundException
  44. * @throws \think\exception\DbException
  45. * @throws \think\exception\PDOException
  46. */
  47. public function del()
  48. {
  49. $this->_save($this->table, ['is_deleted' => 1]);
  50. }
  51. /**
  52. * 批量删除
  53. * @auth true
  54. * @throws \think\Exception
  55. * @throws \think\exception\PDOException
  56. */
  57. public function remove()
  58. {
  59. $this->_save($this->table, ['is_deleted' => 1]);
  60. }
  61. }