作者 lyh

测试脚本

... ... @@ -34,7 +34,7 @@ class CountAllProject extends Command
public function handle(){
$allProjectModel = new AllProject();
}
public function SixProject(){
... ... @@ -141,4 +141,9 @@ class CountAllProject extends Command
];
return $select;
}
public function end_channel($channel){
$parts = explode("-", $channel);
return end($parts);
}
}
... ...
... ... @@ -23,18 +23,6 @@ use Illuminate\Support\Facades\DB;
class TestController extends BaseController
{
public function ceshi1(){
$test = '';
$pattern = '/<img\s+[^>]*src=["\']([^"\']+)["\']/i';
$matches = [];
preg_match_all($pattern, $test, $matches);
$updatedSources = $this->saveBase64Images($matches[1]);
foreach($updatedSources as $k => $v){
$test = str_replace($v, $k, $test);
}
$this->response('success',Code::SUCCESS,$test);
}
/**
* @remark :非6.0拉取数据
* @name :NoSixProject
... ... @@ -43,8 +31,22 @@ class TestController extends BaseController
* @time :2024/11/11 14:51
*/
public function ceshi(){
$url = 'https://quanqiusou.cn/extend_api/api/projects.php?page=3&pagesize=100';
$data = http_get($url);
$this->NoSixProject();
}
public function NoSixProject(){
$res_data = [];
$i = 1;
while (true){
$url = 'https://quanqiusou.cn/extend_api/api/projects.php?page='.$i.'&pagesize=100';
$result = http_get($url);
$data = $result['data'];
if(empty($data)){
break;
}
$res_data = array_merge($res_data,$data['data']);
$i++;
}
$this->response('success',Code::SUCCESS,$data);
}
... ... @@ -60,13 +62,15 @@ class TestController extends BaseController
$allProjectModel = new AllProject();
$info = $allProjectModel->read(['version'=>1,'project_id'=>$v['id']],['id']);
if($info === false){
$channel = Channel::getChannelText($v['channel']['user_id'] ?? 0);
$data[] = [
'project_id'=>$v['id'],
'version'=>1,//代表6.0
'is_upgrade'=>$v['is_upgrade'],
'title'=>$v['title'],
'company'=>$v['company'],
'channel'=>Channel::getChannelText($v['channel']['user_id'] ?? 0),
'channel'=>$channel,
'sale'=>$this->end_channel($channel),
'join_date'=>$v['cooperate_date'],
'online_date'=>$v['uptime'],
'keywords_num'=>$v['key'],
... ... @@ -91,6 +95,7 @@ class TestController extends BaseController
'title'=>$v['title'],
'company'=>$v['company'],
'channel'=>Channel::getChannelText($v['channel']['user_id'] ?? 0),
'sale'=>$this->end_channel($channel),
'join_date'=>$v['cooperate_date'],
'online_date'=>$v['uptime'],
'keywords_num'=>$v['key'],
... ... @@ -153,4 +158,11 @@ class TestController extends BaseController
return $select;
}
public function end_channel($channel){
if(!empty($channel)){
$parts = explode("-", $channel);
return end($parts);
}
return $channel;
}
}
... ...