AuctionGu.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace app\admin\model\auction;
  3. use app\models\store\StoreProduct;
  4. use crmeb\services\SystemConfigService;
  5. use think\facade\Db;
  6. use crmeb\traits\ModelTrait;
  7. use crmeb\basic\BaseModel;
  8. /**
  9. * TODO 场馆model
  10. * Class Article
  11. * @package app\models\article
  12. */
  13. class AuctionGu extends BaseModel
  14. {
  15. /**
  16. * 数据表主键
  17. * @var string
  18. */
  19. protected $pk = 'id';
  20. /**
  21. * 模型名称
  22. * @var string
  23. */
  24. protected $name = 'auction_gu';
  25. protected $autoWriteTimestamp = true;
  26. use ModelTrait;
  27. public static function list($where)
  28. {
  29. $model = self::alias('a')
  30. ->field('a.*, u.nickname')
  31. ->order('a.id DESC')
  32. ->leftJoin('user u', 'u.uid = a.uid');
  33. if ($where['uid']) $model->where('a.uid', $where['uid']);
  34. if ($where['null']) $model->where('a.status', '>', 5);
  35. if ($where['auction'])$model->where('a.id|a.name|u.nickname' , 'like', '%'.$where['auction'],'%');
  36. $data['count'] = $model->count();
  37. if ($where['page'] && $where['limit']){
  38. $model->page($where['page'], $where['limit']);
  39. }else{
  40. $model->page(20, 1);
  41. }
  42. $list = $model->select();
  43. $list = count($list) ? $list->toArray() : [];
  44. $data['data'] = $list;
  45. return $data;
  46. }
  47. }