AuctionBooking.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /**
  3. *
  4. * @author: xaboy<365615158@qq.com>
  5. * @day: 2017/11/02
  6. */
  7. namespace app\admin\model\auction;
  8. use crmeb\traits\ModelTrait;
  9. use crmeb\basic\BaseModel;
  10. /**
  11. * 预约 Model
  12. * Class WechatNews
  13. * @package app\admin\model\wechat
  14. */
  15. class AuctionBooking extends BaseModel
  16. {
  17. use ModelTrait;
  18. protected $pk = 'id';
  19. protected $name = 'auction_booking';
  20. protected $autoWriteTimestamp = true;
  21. public static function list($where)
  22. {
  23. $model = self::where('a.delete_time', 0)
  24. ->alias('a')
  25. ->order('a.id', 'desc')
  26. ->field('a.*, au.nickname as name, u.account, u.nickname')
  27. ->leftJoin('auction au', 'a.auction_id = au.id')
  28. ->leftJoin('user u', 'a.uid = u.uid');
  29. if (trim($where['store_name']) != '') $model->where('a.id|u.account|u.nickname', 'like', '%'.$where['store_name'].'%');
  30. if (trim($where['auction_id']) != '') $model->where('a.auction_id', $where['auction_id']);
  31. if (trim($where['data']) != '') $model = self::getModelTime($where, $model, 'create_time');
  32. $data['count'] = $model->count();
  33. if ($where['page'] && $where['limit']){
  34. $model->page($where['page'], $where['limit']);
  35. }else{
  36. $model->page(20, 1);
  37. }
  38. $list = $model->select();
  39. $data['data'] = $list;
  40. return $data;
  41. }
  42. }