UserModel.php 797 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace app\common\model;
  3. class UserModel extends BaseModel
  4. {
  5. protected $table = 'erp_user';
  6. protected function genSchema(array $schema)
  7. {
  8. // TODO: Implement genSchema() method.
  9. }
  10. public function doesItExist($mobile) {
  11. return $this->where([
  12. ["mobile", '=', $mobile],
  13. ["is_delete", '=', 0]
  14. ])->find();
  15. }
  16. public function findByPaginate(array $params) {
  17. $where = [
  18. ['is_delete', '=', 0]
  19. ];
  20. if(!is_null($params['store_id']) && $params['store_id'] > 0)
  21. array_push($where, ['store_id', '=', $params['store_id']]);
  22. return $this->where($where)
  23. ->order('create_time','desc')
  24. ->paginate(['list_rows'=> 10, "query" => $params]);
  25. }
  26. }