123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- namespace app\admin\service;
- use Curl\Curl;
- use GuzzleHttp\Client;
- use think\facade\Db;
- /**
- * Class TaxiChauffeur
- * @package app\service
- */
- class TaxiChauffeur
- {
- protected $client;
- protected $curl;
- public $url = 'http://106.37.189.144:8080/staffcert-web/public/queryStaffCertFromTranscert.json';
- public function __construct()
- {
- $this->client = new Client();
- $this->curl = new Curl();
- }
- public function getChauffeurData($page,$size)
- {
- $data = Db::table('taxi_chauffeur_copy1')
- ->field('chauffeurid,card_num,areacode,fullname,is_test')
- ->page($page,$size)
- ->select()
- ->each(function ($item){
- $item['areacode'] = substr_replace($item['areacode'],'0000',2);
- return $item;
- });
- foreach ($data as $item){
- dump($this->selectRes($item));
- }
- return ;
- }
- public function updateIsLegitimate($id)
- {
- $data = Db::table('taxi_chauffeur_copy1')
- ->where('chauffeurid','=',$id)
- ->update(['is_legitimate'=>2]);
- return $data;
- }
- /**
- * @param $data
- * @return bool|mixed
- */
- public function selectRes($data)
- {
- $infos = [
- 'provinceCode'=>$data['areacode'],
- 'idCard'=>$data['card_num'],
- 'staffName'=>$data['fullname']
- ];
- if($this->curl->post($this->url,$infos)->response != '') {
- $this->updateIsLegitimate($data['chauffeurid']);
- }else{
- return 'no legitimate'.$data['chauffeurid'];
- }
- }
- }
|