UserProduct.php 1020 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. *
  4. * @author: xaboy<365615158@qq.com>
  5. * @day: 2017/12/25
  6. */
  7. namespace app\admin\model\user;
  8. use crmeb\basic\BaseModel;
  9. use crmeb\traits\ModelTrait;
  10. /**
  11. * TODO 用户申请
  12. * Class UserAddress
  13. * @package app\models\user
  14. */
  15. class UserProduct extends BaseModel
  16. {
  17. /**
  18. * 数据表主键
  19. * @var string
  20. */
  21. protected $pk = 'id';
  22. /**
  23. * 模型名称
  24. * @var string
  25. */
  26. protected $name = 'user_product';
  27. use ModelTrait;
  28. protected $autoWriteTimestamp = true;
  29. public static function list($where)
  30. {
  31. $model = self::field('*')->order('id DESC');
  32. if ($where['name'])$model->where('name' , 'like', '%'.$where['name'],'%');
  33. $data['count'] = $model->count();
  34. if ($where['page'] && $where['limit']){
  35. $model->page($where['page'], $where['limit']);
  36. }else{
  37. $model->page(20, 1);
  38. }
  39. $list = $model->select()->toArray();
  40. $data['data'] = $list;
  41. return $data;
  42. }
  43. }