作者 刘锟

Merge remote-tracking branch 'origin' into akun

@@ -9,11 +9,13 @@ @@ -9,11 +9,13 @@
9 9
10 namespace App\Console\Commands; 10 namespace App\Console\Commands;
11 11
  12 +use App\Helper\Arr;
12 use App\Models\Blog\Blog; 13 use App\Models\Blog\Blog;
13 use App\Models\Blog\BlogCategory; 14 use App\Models\Blog\BlogCategory;
14 use App\Models\News\News; 15 use App\Models\News\News;
15 use App\Models\News\NewsCategory; 16 use App\Models\News\NewsCategory;
16 use App\Models\Product\Category; 17 use App\Models\Product\Category;
  18 +use App\Models\Product\CategoryRelated;
17 use App\Models\Product\Keyword; 19 use App\Models\Product\Keyword;
18 use App\Models\Product\Product; 20 use App\Models\Product\Product;
19 use App\Models\Project\Project; 21 use App\Models\Project\Project;
@@ -54,13 +56,14 @@ class UpdateRoute extends Command @@ -54,13 +56,14 @@ class UpdateRoute extends Command
54 */ 56 */
55 public function handle(){ 57 public function handle(){
56 $projectModel = new Project(); 58 $projectModel = new Project();
57 - $list = $projectModel->list(['id'=>['in',[627]]]); 59 + $list = $projectModel->list(['id'=>['in',[475]]]);
58 foreach ($list as $v){ 60 foreach ($list as $v){
59 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; 61 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
60 ProjectServer::useProject($v['id']); 62 ProjectServer::useProject($v['id']);
61 // $this->getProduct(); 63 // $this->getProduct();
62 // $this->setProductKeyword(); 64 // $this->setProductKeyword();
63 - $this->getRouteMap(); 65 +// $this->getRouteMap();
  66 + $this->getProductCategory();
64 DB::disconnect('custom_mysql'); 67 DB::disconnect('custom_mysql');
65 } 68 }
66 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; 69 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
@@ -157,6 +160,62 @@ class UpdateRoute extends Command @@ -157,6 +160,62 @@ class UpdateRoute extends Command
157 } 160 }
158 161
159 /** 162 /**
  163 + * @remark :更新产品关联表
  164 + * @name :getProductCategory
  165 + * @author :lyh
  166 + * @method :post
  167 + * @time :2024/1/4 14:48
  168 + */
  169 + public function getProductCategory(){
  170 + $product = new Product();
  171 + $num = 35;
  172 + while ($num > 0){
  173 + $list = $product->lists(['status'=>1],$num,1000);
  174 + foreach ($list['list'] as $k => $v){
  175 + if(empty($v['category_id'])){
  176 + continue;
  177 + }
  178 + $category_ids = $v['category_id'];
  179 + //产品分类关联
  180 + echo date('Y-m-d H:i:s') . '产品id--1:'.$v['id'] . PHP_EOL;
  181 + $this->saveRelated($v['id'], $category_ids);
  182 + echo date('Y-m-d H:i:s') . '产品id:'.$v['id'] . PHP_EOL;
  183 + }
  184 + $num--;
  185 + }
  186 + }
  187 +
  188 + /**
  189 + * 关联产品分类
  190 + * @param $product_id
  191 + * @param $cate_ids
  192 + * @author zbj
  193 + * @date 2023/4/21
  194 + */
  195 + public function saveRelated($product_id, $cate_ids)
  196 + {
  197 + if(!is_array($cate_ids)){
  198 + $cate_ids = array_filter(Arr::splitFilterToArray($cate_ids), 'intval');
  199 + }
  200 + //先删除
  201 + CategoryRelated::where('product_id', $product_id)->delete();
  202 + //批量保存
  203 + $data = [];
  204 + if(!empty($cate_ids)){
  205 + foreach ($cate_ids as $cate_id){
  206 + $data[] = [
  207 + 'product_id' => $product_id,
  208 + 'cate_id' => $cate_id,
  209 + 'created_at'=>date('Y-m-d H:i:s'),
  210 + 'updated_at'=>date('Y-m-d H:i:s')
  211 + ];
  212 + }
  213 + CategoryRelated::insert($data);
  214 + }
  215 + return true;
  216 + }
  217 +
  218 + /**
160 * @remark :删除路由通知C端 219 * @remark :删除路由通知C端
161 * @name :curlDelRoute 220 * @name :curlDelRoute
162 * @author :lyh 221 * @author :lyh
@@ -85,7 +85,6 @@ class FileController @@ -85,7 +85,6 @@ class FileController
85 'file.required'=>'必须填写', 85 'file.required'=>'必须填写',
86 ]); 86 ]);
87 $files = $this->request->file('file'); 87 $files = $this->request->file('file');
88 -  
89 if (empty($files)) { 88 if (empty($files)) {
90 $this->response('没有上传的文件!'); 89 $this->response('没有上传的文件!');
91 } 90 }
@@ -306,6 +305,7 @@ class FileController @@ -306,6 +305,7 @@ class FileController
306 public function setUrl(){ 305 public function setUrl(){
307 //A端上传 306 //A端上传
308 if(isset($this->param['refer_type']) && $this->param['refer_type'] == 1){ 307 if(isset($this->param['refer_type']) && $this->param['refer_type'] == 1){
  308 + @file_put_contents(storage_path('logs/lyh_error.log'), var_export('进入222', true) . PHP_EOL, FILE_APPEND);
309 $this->path = $this->uploads['path_a'].'/'.$this->file_type[$this->param['refer']].'/'.date('Y-m'); 309 $this->path = $this->uploads['path_a'].'/'.$this->file_type[$this->param['refer']].'/'.date('Y-m');
310 }else{ 310 }else{
311 //B端上传,upload_method 为 1时 强制上传到本地 311 //B端上传,upload_method 为 1时 强制上传到本地
@@ -150,7 +150,6 @@ class DomainInfoLogic extends BaseLogic @@ -150,7 +150,6 @@ class DomainInfoLogic extends BaseLogic
150 */ 150 */
151 public function setDomainSsl($initDomain,$domain,$rewrite,$other_domain) 151 public function setDomainSsl($initDomain,$domain,$rewrite,$other_domain)
152 { 152 {
153 - $this->fail('当前功能,占时无法使用,如有紧急需要上线项目,请联系管理人员');  
154 if($this->param['type'] == 2){ 153 if($this->param['type'] == 2){
155 if(empty($this->param['key'])){ 154 if(empty($this->param['key'])){
156 $this->fail('证书KEY值不能为空'); 155 $this->fail('证书KEY值不能为空');
@@ -173,6 +173,7 @@ class BaseLogic extends Logic @@ -173,6 +173,7 @@ class BaseLogic extends Logic
173 $data['project_id'] = $this->user['project_id']; 173 $data['project_id'] = $this->user['project_id'];
174 $str = http_build_query($data); 174 $str = http_build_query($data);
175 $url = $this->user['domain'].'api/delHtml/?'.$str; 175 $url = $this->user['domain'].'api/delHtml/?'.$str;
  176 +// shell_exec($url);
176 curlGet($url); 177 curlGet($url);
177 return $this->success(); 178 return $this->success();
178 } 179 }