|
|
|
@ -9,6 +9,11 @@ use think\console\Output; |
|
|
|
|
use think\console\Command; |
|
|
|
|
use think\db\exception\DataNotFoundException; |
|
|
|
|
use think\db\exception\ModelNotFoundException; |
|
|
|
|
use app\api\model\dealer\User as DealerUserModel; |
|
|
|
|
use app\api\model\User; |
|
|
|
|
use app\common\service\User as UserService; |
|
|
|
|
use app\common\enum\user\UserTypeEnum; |
|
|
|
|
use think\facade\Db; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SprictTest extends Command |
|
|
|
@ -33,11 +38,29 @@ class SprictTest extends Command |
|
|
|
|
protected function execute(Input $input, Output $output) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
echo "666"; |
|
|
|
|
$this->setHomeLocation(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function test() |
|
|
|
|
{ |
|
|
|
|
echo "hello world"; |
|
|
|
|
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); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |