作者 刘锟

Merge remote-tracking branch 'origin' into akun

... ... @@ -9,11 +9,13 @@
namespace App\Console\Commands;
use App\Helper\Arr;
use App\Models\Blog\Blog;
use App\Models\Blog\BlogCategory;
use App\Models\News\News;
use App\Models\News\NewsCategory;
use App\Models\Product\Category;
use App\Models\Product\CategoryRelated;
use App\Models\Product\Keyword;
use App\Models\Product\Product;
use App\Models\Project\Project;
... ... @@ -54,13 +56,14 @@ class UpdateRoute extends Command
*/
public function handle(){
$projectModel = new Project();
$list = $projectModel->list(['id'=>['in',[627]]]);
$list = $projectModel->list(['id'=>['in',[475]]]);
foreach ($list as $v){
echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
ProjectServer::useProject($v['id']);
// $this->getProduct();
// $this->setProductKeyword();
$this->getRouteMap();
// $this->getRouteMap();
$this->getProductCategory();
DB::disconnect('custom_mysql');
}
echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
... ... @@ -157,6 +160,62 @@ class UpdateRoute extends Command
}
/**
* @remark :更新产品关联表
* @name :getProductCategory
* @author :lyh
* @method :post
* @time :2024/1/4 14:48
*/
public function getProductCategory(){
$product = new Product();
$num = 35;
while ($num > 0){
$list = $product->lists(['status'=>1],$num,1000);
foreach ($list['list'] as $k => $v){
if(empty($v['category_id'])){
continue;
}
$category_ids = $v['category_id'];
//产品分类关联
echo date('Y-m-d H:i:s') . '产品id--1:'.$v['id'] . PHP_EOL;
$this->saveRelated($v['id'], $category_ids);
echo date('Y-m-d H:i:s') . '产品id:'.$v['id'] . PHP_EOL;
}
$num--;
}
}
/**
* 关联产品分类
* @param $product_id
* @param $cate_ids
* @author zbj
* @date 2023/4/21
*/
public function saveRelated($product_id, $cate_ids)
{
if(!is_array($cate_ids)){
$cate_ids = array_filter(Arr::splitFilterToArray($cate_ids), 'intval');
}
//先删除
CategoryRelated::where('product_id', $product_id)->delete();
//批量保存
$data = [];
if(!empty($cate_ids)){
foreach ($cate_ids as $cate_id){
$data[] = [
'product_id' => $product_id,
'cate_id' => $cate_id,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s')
];
}
CategoryRelated::insert($data);
}
return true;
}
/**
* @remark :删除路由通知C端
* @name :curlDelRoute
* @author :lyh
... ...
... ... @@ -85,7 +85,6 @@ class FileController
'file.required'=>'必须填写',
]);
$files = $this->request->file('file');
if (empty($files)) {
$this->response('没有上传的文件!');
}
... ... @@ -306,6 +305,7 @@ class FileController
public function setUrl(){
//A端上传
if(isset($this->param['refer_type']) && $this->param['refer_type'] == 1){
@file_put_contents(storage_path('logs/lyh_error.log'), var_export('进入222', true) . PHP_EOL, FILE_APPEND);
$this->path = $this->uploads['path_a'].'/'.$this->file_type[$this->param['refer']].'/'.date('Y-m');
}else{
//B端上传,upload_method 为 1时 强制上传到本地
... ...
... ... @@ -150,7 +150,6 @@ class DomainInfoLogic extends BaseLogic
*/
public function setDomainSsl($initDomain,$domain,$rewrite,$other_domain)
{
$this->fail('当前功能,占时无法使用,如有紧急需要上线项目,请联系管理人员');
if($this->param['type'] == 2){
if(empty($this->param['key'])){
$this->fail('证书KEY值不能为空');
... ...
... ... @@ -173,6 +173,7 @@ class BaseLogic extends Logic
$data['project_id'] = $this->user['project_id'];
$str = http_build_query($data);
$url = $this->user['domain'].'api/delHtml/?'.$str;
// shell_exec($url);
curlGet($url);
return $this->success();
}
... ...