TaxiChauffeur.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace app\admin\model;
  3. use Curl\Curl;
  4. use GuzzleHttp\Client;
  5. use think\facade\Db;
  6. /**
  7. * Class TaxiChauffeur
  8. * @package app\service
  9. */
  10. class TaxiChauffeur
  11. {
  12. protected $db;
  13. protected $client;
  14. protected $curl;
  15. public $url = 'http://106.37.189.144:8080/staffcert-web/public/queryStaffCertFromTranscert.json';
  16. public function __construct()
  17. {
  18. $this->db = Db::connect('mysql0');
  19. $this->client = new Client();
  20. $this->curl = new Curl();
  21. }
  22. public function getChauffeurData()
  23. {
  24. $this->db->table('taxi_chauffeur_copy1')
  25. ->field('chauffeurid,card_num,areacode,fullname,is_test')
  26. ->chunk(100,function ($list){
  27. foreach ($list as $item){
  28. $this->updateIsLegitimate($item['chauffeurid']);
  29. }
  30. });
  31. }
  32. public function updateIsLegitimate($id)
  33. {
  34. $data = $this->db->table('taxi_chauffeur_copy1')
  35. ->where('chauffeurid','=',$id)
  36. ->update(['is_test'=>0]);
  37. return $data;
  38. }
  39. }