where([ ["mobile", '=',$mobile], ["is_delete", '=', 0], ])->find(); return $customer ? true : false; } protected function genSchema(array $schema) { // TODO: Implement genSchema() method. } //for ($i = 2; $i< 10; $i++) { //$this->saveAll([ //[ //'name' => '佩佩'.$i, //'mobile' => '1557692025'.$i, //'sex'=> 1, //'sun_calendar' => '2020-'.$i.'-11', //'lunar_calendar' => '2020-'.($i-1).'-19', //'user_id' => 100000, //'username' => 'Caviar.', //'relation' => '朋友'.$i, //'address' => '巴西'.$i, //'email' => $i.'@163.com', //'store_id' => 1, //'linkman' => 'A_Caviar' //] //]); //} /** * @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]); } }