where([ ["mobile", '=',$mobile], ["is_delete", '=', 0], ])->find(); return $customer ? true : false; } protected function genSchema(array $schema) { // TODO: Implement genSchema() method. } /** * @param array $params * @return \think\Paginator * @throws \think\db\exception\DbException */ public function findByPaginate(array $params) { $where = [ ['is_delete', '=', 0] ]; if(isset($params['name_zh'])) array_push($where,['name_zh', 'like', "%".$params['name_zh']."%"]); if(isset($params['name_en'])) array_push($where,['name_en', 'like', "%".$params['name_en']."%"]); if(isset($params['mobile'])) array_push($where,['mobile', 'like', "%".$params['mobile']."%"]); return $this->where($where) ->order('create_time','desc') ->paginate(['list_rows'=>10, "query" => $params]); } public function findByName($name) { return $this->where([ ['is_delete','=', 0], ['name_zh|name_en', '=', $name] ])->find(); } public function findByMobile($mobile) { return $this->where([ ['is_delete','=', 0], ['mobile', '=', $mobile] ])->find(); } public function search($store_id, $text = null) { $where = [ ['is_delete','=', 0], ['store_id','=', $store_id], ]; if($text) { array_push($where, ['id|name_zh|name_en|mobile', "like", "%{$text}%"]); } return $this->where($where)->limit(500)->select(); } }