作者 lyh

gx脚本demo

@@ -106,7 +106,6 @@ class CountAll extends Command @@ -106,7 +106,6 @@ class CountAll extends Command
106 if($inquiry_list == false){ 106 if($inquiry_list == false){
107 return false; 107 return false;
108 } 108 }
109 - echo date('Y-m-d H:i:s') . '拉取询盘状态:' .$inquiry_list['status'] . PHP_EOL;  
110 if($inquiry_list['status'] == self::STATUS_ERROR){ 109 if($inquiry_list['status'] == self::STATUS_ERROR){
111 $arr['inquiry_num'] = 0; 110 $arr['inquiry_num'] = 0;
112 $countryArr = []; 111 $countryArr = [];
@@ -149,6 +149,7 @@ class CountProject extends Command @@ -149,6 +149,7 @@ class CountProject extends Command
149 if($inquiry_list == false){ 149 if($inquiry_list == false){
150 return false; 150 return false;
151 } 151 }
  152 + echo date('Y-m-d H:i:s') . '拉取询盘状态:' .json_encode($inquiry_list) . PHP_EOL;
152 if($inquiry_list['status'] == self::STATUS_ERROR){ 153 if($inquiry_list['status'] == self::STATUS_ERROR){
153 $arr['inquiry_num'] = 0; 154 $arr['inquiry_num'] = 0;
154 $countryArr = []; 155 $countryArr = [];
@@ -35,6 +35,7 @@ use App\Models\Template\BTemplateCom; @@ -35,6 +35,7 @@ use App\Models\Template\BTemplateCom;
35 use App\Services\AmazonS3Service; 35 use App\Services\AmazonS3Service;
36 use App\Services\ProjectServer; 36 use App\Services\ProjectServer;
37 use App\Utils\EncryptUtils; 37 use App\Utils\EncryptUtils;
  38 +use GuzzleHttp\Exception\GuzzleException;
38 use Illuminate\Console\Command; 39 use Illuminate\Console\Command;
39 use Illuminate\Support\Facades\DB; 40 use Illuminate\Support\Facades\DB;
40 use Illuminate\Support\Facades\Schema; 41 use Illuminate\Support\Facades\Schema;
@@ -56,6 +57,20 @@ class Demo extends Command @@ -56,6 +57,20 @@ class Demo extends Command
56 */ 57 */
57 protected $description = 'demo'; 58 protected $description = 'demo';
58 59
  60 + public function handle(){
  61 + $domain = "https://www.xawellauto.com/";
  62 + $token = md5($domain.date("Y-m-d"));
  63 + $url = "https://form.globalso.com/api/external-interface/domain_con/15243d63ed5a5738?domain=$domain&token=$token&source=1,2,3,4&num=15";
  64 + try {
  65 + $res = http_get($url,['charset=utf-8']);
  66 + } catch (\Exception | GuzzleException $e) {
  67 + errorLog('提交询盘信息失败', $domain, $e);
  68 + return false;
  69 + }
  70 + echo date('Y-m-d H:i:s') . '数据:'.json_encode($res) . PHP_EOL;
  71 + return true;
  72 + }
  73 +
59 // public function handle(){ 74 // public function handle(){
60 // $projectModel = new Project(); 75 // $projectModel = new Project();
61 // $list = $projectModel->list(['id'=>503]); 76 // $list = $projectModel->list(['id'=>503]);
@@ -89,26 +104,26 @@ class Demo extends Command @@ -89,26 +104,26 @@ class Demo extends Command
89 // DB::disconnect('custom_mysql'); 104 // DB::disconnect('custom_mysql');
90 // } 105 // }
91 // } 106 // }
92 - public function handle(){  
93 - ProjectServer::useProject(503);  
94 - $newsCate = new NewsCategory();  
95 - $newsList = $newsCate->list();  
96 - foreach ($newsList as $v){  
97 - $data = [  
98 - 'name'=>$v['name'],  
99 - 'status'=>0,  
100 - 'sort'=>$v['sort'],  
101 - 'pid'=>$v['pid'],  
102 - 'route'=>$v['alias'],  
103 - 'project_id'=>503,  
104 - 'operator_id'=>$v['operator_id'],  
105 - 'create_id'=>1101,  
106 - 'module_id'=>10,  
107 - ];  
108 - $moduleCateModel = new CustomModuleCategory();  
109 - $id = $moduleCateModel->addReturnId($data);  
110 - RouteMap::setRoute($v['alias'],RouteMap::SOURCE_MODULE_CATE,$id,503);  
111 - }  
112 - DB::disconnect('custom_mysql');  
113 - } 107 +// public function handle(){
  108 +// ProjectServer::useProject(503);
  109 +// $newsCate = new NewsCategory();
  110 +// $newsList = $newsCate->list();
  111 +// foreach ($newsList as $v){
  112 +// $data = [
  113 +// 'name'=>$v['name'],
  114 +// 'status'=>0,
  115 +// 'sort'=>$v['sort'],
  116 +// 'pid'=>$v['pid'],
  117 +// 'route'=>$v['alias'],
  118 +// 'project_id'=>503,
  119 +// 'operator_id'=>$v['operator_id'],
  120 +// 'create_id'=>1101,
  121 +// 'module_id'=>10,
  122 +// ];
  123 +// $moduleCateModel = new CustomModuleCategory();
  124 +// $id = $moduleCateModel->addReturnId($data);
  125 +// RouteMap::setRoute($v['alias'],RouteMap::SOURCE_MODULE_CATE,$id,503);
  126 +// }
  127 +// DB::disconnect('custom_mysql');
  128 +// }
114 } 129 }
@@ -155,5 +155,24 @@ class FormGlobalsoApi @@ -155,5 +155,24 @@ class FormGlobalsoApi
155 return $res; 155 return $res;
156 } 156 }
157 157
158 - 158 + /**
  159 + * @remark :获取当前项目所有询盘及询盘国家
  160 + * @name :getInquiryAll
  161 + * @author :lyh
  162 + * @method :post
  163 + * @time :2024/8/15 14:16
  164 + */
  165 + public function getInquiryAll($domain){
  166 + $domain = 'https://'.$domain.'/';
  167 + $token = md5($domain.date("Y-m-d"));
  168 + $url = "https://form.globalso.com/api/external-interface/domain_con/15243d63ed5a5738?domain=$domain&token=$token&source=1,2,3,4&num=15";
  169 + try {
  170 + $res = http_get($url,['charset=utf-8']);
  171 + } catch (\Exception | GuzzleException $e) {
  172 + errorLog('提交询盘信息失败', $domain, $e);
  173 + return false;
  174 + }
  175 + echo date('Y-m-d H:i:s') . '数据:'.json_encode($res) . PHP_EOL;
  176 + return $res;
  177 + }
159 } 178 }