AuctionProduct.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 AuctionProduct extends BaseModel
  16. {
  17. use ModelTrait;
  18. protected $pk = 'id';
  19. protected $name = 'auction_product';
  20. protected $autoWriteTimestamp = true;
  21. public static function list($where, $id)
  22. {
  23. $model = self::alias('a')
  24. ->where('a.auction_id', $id)
  25. ->field('a.*,u.nickname, au.name as au_name')
  26. ->order('a.id DESC')
  27. ->leftJoin('auction au', 'a.auction_id = au.id')
  28. ->leftJoin('user u', 'a.uid = u.uid');
  29. if (trim(($where['store_name'])) != ''){
  30. $model->where('a.id|a.name|u.nickname', 'like','%'.$where['store_name'].'%');
  31. }
  32. if ( trim($where['is_show']) != ''){
  33. $where['is_show'] = $where['is_show'] == 2? 0: 1;
  34. $model->where('a.is_show', '=',$where['is_show']);
  35. }
  36. if ($where['page'] && $where['limit']){
  37. $model->page($where['page'], $where['limit']);
  38. }else{
  39. $model->page(20, 1);
  40. }
  41. $data['count'] = $model->count();
  42. $data['data'] = $model->select()->toArray();
  43. return $data;
  44. }
  45. }