作者 李宇航

合并分支 'lyh-server' 到 'master'

Lyh server



查看合并请求 !2346
@@ -98,14 +98,14 @@ class GeoQuestionRes extends Command @@ -98,14 +98,14 @@ class GeoQuestionRes extends Command
98 goto GET_RESULT; 98 goto GET_RESULT;
99 } 99 }
100 } catch (\Exception $e) { 100 } catch (\Exception $e) {
101 - $this->output('task id:' . $task_id . ', question: ' . $question . ', platform: ' . $question . ', error: ' . $e->getMessage()); 101 + $this->output('task id:' . $task_id . ', question: ' . $question . ', platform: ' . $platform . ', error: ' . $e->getMessage());
102 goto GET_RESULT; 102 goto GET_RESULT;
103 } 103 }
104 // 命中文案 104 // 命中文案
105 $hit_data[] = $result['text']; 105 $hit_data[] = $result['text'];
106 if(!empty($result['annotations'])){ 106 if(!empty($result['annotations'])){
107 $url = array_column(array_column($result['annotations'], 'url_citation'), 'url'); 107 $url = array_column(array_column($result['annotations'], 'url_citation'), 'url');
108 - $title = array_column(array_column($result['annotations'], 'url_citation'), 'title');; 108 + $title = array_column(array_column($result['annotations'], 'url_citation'), 'title');
109 $hit_data = array_merge($url, $title, $hit_data); 109 $hit_data = array_merge($url, $title, $hit_data);
110 } 110 }
111 // 命中关键词和路由 111 // 命中关键词和路由
@@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
9 9
10 namespace App\Console\Commands\Sync; 10 namespace App\Console\Commands\Sync;
11 11
  12 +use App\Models\Manage\Mobile;
12 use App\Models\User\User; 13 use App\Models\User\User;
13 use Illuminate\Console\Command; 14 use Illuminate\Console\Command;
14 use Illuminate\Support\Facades\DB; 15 use Illuminate\Support\Facades\DB;
@@ -40,30 +41,40 @@ class SyncMobile extends Command @@ -40,30 +41,40 @@ class SyncMobile extends Command
40 $url = 'https://www.quanqiusou.cn/extend_api/saas/get_phone.php'; 41 $url = 'https://www.quanqiusou.cn/extend_api/saas/get_phone.php';
41 // $data = curlGet($url);//TODO::获取号码库 42 // $data = curlGet($url);//TODO::获取号码库
42 $client = new \GuzzleHttp\Client(); 43 $client = new \GuzzleHttp\Client();
43 - $data = $client->request('GET', $url, [  
44 - 'proxy' => env('CURL_PROXY'), // 代理服务器地址和端口号  
45 - ])->getBody()->getContents();  
46 - $data = json_decode($data, true);  
47 - DB::table('gl_mobile')->delete();  
48 - $create_time = date('Y-m-d H:i:s');  
49 - foreach ($data as $v){  
50 - $param = [  
51 - 'mobile'=>$v,  
52 - 'created_at'=>$create_time  
53 - ];  
54 - DB::table('gl_mobile')->insert($param); 44 + try {
  45 + $data = $client->request('GET', $url, [
  46 + 'proxy' => env('CURL_PROXY'), // 代理服务器地址和端口号
  47 + ])->getBody()->getContents();
  48 + }catch (\Exception $e){
  49 + echo date('Y-m-d H:i:s').':未拉起到数据'.PHP_EOL;
55 } 50 }
56 if(!empty($data)){ 51 if(!empty($data)){
  52 + $mobileModel = new Mobile();
  53 + $mobileModel->truncate();
  54 + $data = json_decode($data, true);
57 $userModel = new User(); 55 $userModel = new User();
58 - try {  
59 - $data[] = '13083988828';  
60 - $data[] = '6591559603';  
61 - $userModel->edit(['status'=>1],['project_id'=>1,'mobile'=>['not in',$data]]);  
62 - $userModel->edit(['status'=>0],['project_id'=>1,'mobile'=>['in',$data]]);  
63 - }catch (\Exception $e){  
64 - echo date('Y-m-d H:i:s') . 'error' . PHP_EOL; 56 + foreach ($data as $mobile){
  57 + $param = [
  58 + 'mobile'=>$mobile,
  59 + 'created_at'=>date('Y-m-d H:i:s')
  60 + ];
  61 + $mobile->insert($param);
  62 + //查看当前用户是否存在
  63 + $info = $userModel->read(['mobile'=>$mobile,'project_id'=>1]);
  64 + if($info === false){
  65 + $data = [
  66 + 'mobile'=>$mobile,
  67 + 'password'=>base64_encode(md5('123456')),
  68 + 'project_id'=>1,
  69 + 'name'=>$mobile,
  70 + 'type'=>$userModel::TYPE_ONE
  71 + ];
  72 + $userModel->add($data);
  73 + }
65 } 74 }
  75 + $data[] = '13083988828';
  76 + $userModel->edit(['status'=>1],['project_id'=>1,'mobile'=>['not in',$data]]);
  77 + $userModel->edit(['status'=>0],['project_id'=>1,'mobile'=>['in',$data]]);
66 } 78 }
67 } 79 }
68 -  
69 } 80 }
@@ -665,7 +665,7 @@ if (!function_exists('getImageUrl')) { @@ -665,7 +665,7 @@ if (!function_exists('getImageUrl')) {
665 * @method :post 665 * @method :post
666 * @time :2023/7/20 16:46 666 * @time :2023/7/20 16:46
667 */ 667 */
668 - function getImageUrl($path,$storage_type = 0,$location = 0){ 668 + function getImageUrl($path,$storage_type = 0,$location = 0,$image_cdn = 1){
669 if(is_array($path)){ 669 if(is_array($path)){
670 $url =[]; 670 $url =[];
671 foreach ($path as $v){ 671 foreach ($path as $v){
@@ -683,8 +683,11 @@ if (!function_exists('getImageUrl')) { @@ -683,8 +683,11 @@ if (!function_exists('getImageUrl')) {
683 } 683 }
684 if($location == 0){ 684 if($location == 0){
685 $cos = config('filesystems.disks.cos'); 685 $cos = config('filesystems.disks.cos');
686 - $cosCdn = ($storage_type == 0) ? $cos['cdn'] : $cos['cdn1'];  
687 -// $cosCdn = 'https://file.globalso.com';//TODO::暂时使用 686 + if($image_cdn == 0){//v6链接
  687 + $cosCdn = $cos['cdn2'];
  688 + }else{
  689 + $cosCdn = ($storage_type == 0) ? $cos['cdn'] : $cos['cdn1'];
  690 + }
688 $url = $cosCdn.$path; 691 $url = $cosCdn.$path;
689 }else{ 692 }else{
690 $s3 = config('filesystems.disks.s3'); 693 $s3 = config('filesystems.disks.s3');