ztt 5 months ago
commit 3611dd103e
  1. 130
      app/command/HomeLocation.php
  2. 66
      app/command/SprictTest.php

@ -1,66 +1,66 @@
<?php
declare (strict_types=1);
namespace app\command;
use think\console\Input;
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 HomeLocation extends Command
{
protected function configure()
{
// 指令配置
$this->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);
}
}
<?php
declare (strict_types=1);
namespace app\command;
use think\console\Input;
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 HomeLocation extends Command
{
protected function configure()
{
// 指令配置
$this->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);
}
}
}

@ -1,66 +0,0 @@
<?php
declare (strict_types=1);
namespace app\command;
use think\console\Input;
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
{
protected function configure()
{
// 指令配置
$this->setName('SprictTest')
->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);
}
}
}
Loading…
Cancel
Save