setName('HomeLocation') ->setDescription('测试输出'); } /** * @notes:执行 * @param Input $input * @param Output $output * @throws DataNotFoundException * @throws DbException * @throws ModelNotFoundException * @author: wanghousheng */ protected function execute(Input $input, Output $output) { $this->setHomeLocation(); } public function setHomeLocation() { $model = new User(); $dealerUser = Db::name('user')->where('homelocation','')->where('mobile','<>','') ->distinct(true)->field('mobile')->select(); foreach($dealerUser as $user){ //$userMobiles = explode(',', $user['mobile']); $localdate= UserService::getHomeLocation($user['mobile']); // print_r( $localdate); $localdate = json_decode($localdate,true); // print_r( $localdate['data']); $localdate = json_encode($localdate['data'],JSON_UNESCAPED_UNICODE); // print_r( $localdate); // exit; $date = $model::where('mobile',$user['mobile'])->update(['homelocation'=>$localdate]); var_dump($date); } } }