作者 lyh

测试脚本

@@ -34,7 +34,7 @@ class CountAllProject extends Command @@ -34,7 +34,7 @@ class CountAllProject extends Command
34 34
35 35
36 public function handle(){ 36 public function handle(){
37 - 37 + $allProjectModel = new AllProject();
38 } 38 }
39 39
40 public function SixProject(){ 40 public function SixProject(){
@@ -141,4 +141,9 @@ class CountAllProject extends Command @@ -141,4 +141,9 @@ class CountAllProject extends Command
141 ]; 141 ];
142 return $select; 142 return $select;
143 } 143 }
  144 +
  145 + public function end_channel($channel){
  146 + $parts = explode("-", $channel);
  147 + return end($parts);
  148 + }
144 } 149 }
@@ -23,18 +23,6 @@ use Illuminate\Support\Facades\DB; @@ -23,18 +23,6 @@ use Illuminate\Support\Facades\DB;
23 23
24 class TestController extends BaseController 24 class TestController extends BaseController
25 { 25 {
26 - public function ceshi1(){  
27 - $test = '';  
28 - $pattern = '/<img\s+[^>]*src=["\']([^"\']+)["\']/i';  
29 - $matches = [];  
30 - preg_match_all($pattern, $test, $matches);  
31 - $updatedSources = $this->saveBase64Images($matches[1]);  
32 - foreach($updatedSources as $k => $v){  
33 - $test = str_replace($v, $k, $test);  
34 - }  
35 - $this->response('success',Code::SUCCESS,$test);  
36 - }  
37 -  
38 /** 26 /**
39 * @remark :非6.0拉取数据 27 * @remark :非6.0拉取数据
40 * @name :NoSixProject 28 * @name :NoSixProject
@@ -43,8 +31,22 @@ class TestController extends BaseController @@ -43,8 +31,22 @@ class TestController extends BaseController
43 * @time :2024/11/11 14:51 31 * @time :2024/11/11 14:51
44 */ 32 */
45 public function ceshi(){ 33 public function ceshi(){
46 - $url = 'https://quanqiusou.cn/extend_api/api/projects.php?page=3&pagesize=100';  
47 - $data = http_get($url); 34 + $this->NoSixProject();
  35 + }
  36 +
  37 + public function NoSixProject(){
  38 + $res_data = [];
  39 + $i = 1;
  40 + while (true){
  41 + $url = 'https://quanqiusou.cn/extend_api/api/projects.php?page='.$i.'&pagesize=100';
  42 + $result = http_get($url);
  43 + $data = $result['data'];
  44 + if(empty($data)){
  45 + break;
  46 + }
  47 + $res_data = array_merge($res_data,$data['data']);
  48 + $i++;
  49 + }
48 $this->response('success',Code::SUCCESS,$data); 50 $this->response('success',Code::SUCCESS,$data);
49 } 51 }
50 52
@@ -60,13 +62,15 @@ class TestController extends BaseController @@ -60,13 +62,15 @@ class TestController extends BaseController
60 $allProjectModel = new AllProject(); 62 $allProjectModel = new AllProject();
61 $info = $allProjectModel->read(['version'=>1,'project_id'=>$v['id']],['id']); 63 $info = $allProjectModel->read(['version'=>1,'project_id'=>$v['id']],['id']);
62 if($info === false){ 64 if($info === false){
  65 + $channel = Channel::getChannelText($v['channel']['user_id'] ?? 0);
63 $data[] = [ 66 $data[] = [
64 'project_id'=>$v['id'], 67 'project_id'=>$v['id'],
65 'version'=>1,//代表6.0 68 'version'=>1,//代表6.0
66 'is_upgrade'=>$v['is_upgrade'], 69 'is_upgrade'=>$v['is_upgrade'],
67 'title'=>$v['title'], 70 'title'=>$v['title'],
68 'company'=>$v['company'], 71 'company'=>$v['company'],
69 - 'channel'=>Channel::getChannelText($v['channel']['user_id'] ?? 0), 72 + 'channel'=>$channel,
  73 + 'sale'=>$this->end_channel($channel),
70 'join_date'=>$v['cooperate_date'], 74 'join_date'=>$v['cooperate_date'],
71 'online_date'=>$v['uptime'], 75 'online_date'=>$v['uptime'],
72 'keywords_num'=>$v['key'], 76 'keywords_num'=>$v['key'],
@@ -91,6 +95,7 @@ class TestController extends BaseController @@ -91,6 +95,7 @@ class TestController extends BaseController
91 'title'=>$v['title'], 95 'title'=>$v['title'],
92 'company'=>$v['company'], 96 'company'=>$v['company'],
93 'channel'=>Channel::getChannelText($v['channel']['user_id'] ?? 0), 97 'channel'=>Channel::getChannelText($v['channel']['user_id'] ?? 0),
  98 + 'sale'=>$this->end_channel($channel),
94 'join_date'=>$v['cooperate_date'], 99 'join_date'=>$v['cooperate_date'],
95 'online_date'=>$v['uptime'], 100 'online_date'=>$v['uptime'],
96 'keywords_num'=>$v['key'], 101 'keywords_num'=>$v['key'],
@@ -153,4 +158,11 @@ class TestController extends BaseController @@ -153,4 +158,11 @@ class TestController extends BaseController
153 return $select; 158 return $select;
154 } 159 }
155 160
  161 + public function end_channel($channel){
  162 + if(!empty($channel)){
  163 + $parts = explode("-", $channel);
  164 + return end($parts);
  165 + }
  166 + return $channel;
  167 + }
156 } 168 }