AppointList.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <?php
  2. namespace app\admin\controller\box;
  3. use app\admin\model\SystemAdmin;
  4. use app\common\model\BoxModel;
  5. use app\common\model\BoxRecordModel;
  6. use app\common\model\CouponAreaModel;
  7. use app\common\model\CouponPlanModel;
  8. use app\common\model\ShopCategory;
  9. use app\admin\traits\Curd;
  10. use app\common\controller\AdminController;
  11. use app\common\model\ThirddataLogModel;
  12. use app\common\model\ThirddataModel;
  13. use EasyAdmin\annotation\ControllerAnnotation;
  14. use EasyAdmin\annotation\NodeAnotation;
  15. use think\App;
  16. use think\facade\Db;
  17. use think\Model;
  18. /**
  19. * Class Admin
  20. * @package app\admin\controller\system
  21. * @ControllerAnnotation(title="魔盒")
  22. */
  23. class AppointList extends AdminController
  24. {
  25. public function __construct(App $app)
  26. {
  27. parent::__construct($app);
  28. $this->model = new BoxRecordModel();
  29. }
  30. use Curd;
  31. // protected $allowModifyFields = [
  32. // 'can_buy',
  33. // 'status'
  34. // ];
  35. /**
  36. * @NodeAnotation(title="预约记录")
  37. */
  38. public function index ()
  39. {
  40. if ($this->request->isAjax()) {
  41. if (input('selectFields')) {
  42. return $this->selectList();
  43. }
  44. list($page, $limit, $where) = $this->buildTableParames();
  45. $count = $this->model
  46. ->where($where)
  47. ->count();
  48. // return 11;
  49. // return json_decode('[{"price":10, "fee":1},{"price":50, "fee":0.5},{"price":100, "fee":0}]');
  50. $list = $this->model
  51. // ->alias('r')
  52. // ->leftJoin('box b', 'u.id = o.user_id')
  53. ->withJoin('user', 'LEFT')
  54. // ->withJoin('box', 'LEFT')
  55. // ->withAttr('buy_time', function ($val, $data){
  56. // if (!$val){return '还未配置时间';}
  57. // $curdata = json_decode($val);
  58. // $cu_data['day'] = sr_getcurtime($curdata->day, 'Y-m-d');
  59. //
  60. // $arr_time = $curdata->time;
  61. // for ($i = 0; $i < count($arr_time); $i++){
  62. // $val1 = $curdata->time[$i];
  63. // $key = 'time'.($i+1);
  64. // $cu_data[$key] = (sr_getcurtime($val1->start_time, 'H:i:s') . ' - ' . sr_getcurtime($val1->end_time, 'H:i:s'));
  65. // }
  66. //
  67. // return ($cu_data['day']. '日'. ($cu_data['time1']?('【'.$cu_data['time1'].'】'):'' ). '|'. (isset($cu_data['time2'])?('【'.$cu_data['time2'].'】'):''). '|' .(isset($cu_data['time3'])?('【'.$cu_data['time3'].'】'):''));
  68. // })
  69. ->withAttr('box_img', function($val, $data){
  70. return getWebUrl().'/'.$val;
  71. })
  72. ->where($where)
  73. ->page($page, $limit)
  74. ->order($this->sort)
  75. ->select();
  76. $data = [
  77. 'code' => 0,
  78. 'msg' => '',
  79. 'count' => $count,
  80. 'data' => $list,
  81. ];
  82. return json($data);
  83. }
  84. return $this->fetch();
  85. }
  86. }