作者 李宇航

合并分支 'master-server' 到 'master'

更新不需要分类Master server



查看合并请求 !662
@@ -21,14 +21,6 @@ class Kernel extends ConsoleKernel @@ -21,14 +21,6 @@ class Kernel extends ConsoleKernel
21 // $schedule->command('inspire')->hourly(); 21 // $schedule->command('inspire')->hourly();
22 $schedule->command('remain_day')->dailyAt('09:00')->withoutOverlapping(1); // 项目剩余服务时长 22 $schedule->command('remain_day')->dailyAt('09:00')->withoutOverlapping(1); // 项目剩余服务时长
23 $schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务 23 $schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务
24 -// $schedule->command('rank_data')->dailyAt('07:00')->withoutOverlapping(1); // 排名数据,每天凌晨执行一次  
25 -// $schedule->command('rank_data')->dailyAt('08:00')->withoutOverlapping(1); // 排名数据,每天凌晨执行一次  
26 -// $schedule->command('rank_data_speed')->dailyAt('01:10')->withoutOverlapping(1); // 排名数据-测速数据,每周一凌晨执行一次  
27 -// $schedule->command('rank_data_external_links')->dailyAt('08:30')->withoutOverlapping(1); // 排名数据-外链,每周一凌晨执行一次  
28 -// $schedule->command('rank_data_external_links')->dailyAt('18:00')->withoutOverlapping(1); // 排名数据-外链,每周一凌晨执行一次  
29 -// $schedule->command('rank_data_indexed_pages')->dailyAt('07:30')->withoutOverlapping(1); // 排名数据-页面收录,每周一凌晨执行一次  
30 -// $schedule->command('rank_data_recomm_domain')->dailyAt('07:40')->withoutOverlapping(1); // 排名数据-引荐域名,每周一凌晨执行一次  
31 -// $schedule->command('rank_data_week')->weeklyOn([1,2], '08:30')->withoutOverlapping(1); // 排名数据,每周一、二早上执行一次  
32 $schedule->command('service_count')->dailyAt('01:00')->withoutOverlapping(1); //服务器使用情况,每天凌晨1点执行一次 24 $schedule->command('service_count')->dailyAt('01:00')->withoutOverlapping(1); //服务器使用情况,每天凌晨1点执行一次
33 $schedule->command('web_traffic_special')->everyMinute()->withoutOverlapping(1); // 特殊引流 25 $schedule->command('web_traffic_special')->everyMinute()->withoutOverlapping(1); // 特殊引流
34 $schedule->command('web_traffic_russia_special')->everyMinute()->withoutOverlapping(1); // 特殊引流 26 $schedule->command('web_traffic_russia_special')->everyMinute()->withoutOverlapping(1); // 特殊引流
@@ -43,8 +35,6 @@ class Kernel extends ConsoleKernel @@ -43,8 +35,6 @@ class Kernel extends ConsoleKernel
43 $schedule->command('update_keyword_route')->dailyAt('01:00')->withoutOverlapping(1); //升级项目--清除路由相同的关键字 35 $schedule->command('update_keyword_route')->dailyAt('01:00')->withoutOverlapping(1); //升级项目--清除路由相同的关键字
44 $schedule->command('recommended_suppliers')->dailyAt('03:00')->withoutOverlapping(1); //每天凌晨1点执行一次生成推荐商 36 $schedule->command('recommended_suppliers')->dailyAt('03:00')->withoutOverlapping(1); //每天凌晨1点执行一次生成推荐商
45 $schedule->command('update_keyword_content')->hourly()->withoutOverlapping(1); 37 $schedule->command('update_keyword_content')->hourly()->withoutOverlapping(1);
46 - // 每日推送视频任务  
47 -// $schedule->command('video_task')->hourly()->withoutOverlapping(1);  
48 // 每日推送已完成视频任务项目生成对应界面 38 // 每日推送已完成视频任务项目生成对应界面
49 $schedule->command('notice_c')->dailyAt('04:00')->withoutOverlapping(1); 39 $schedule->command('notice_c')->dailyAt('04:00')->withoutOverlapping(1);
50 } 40 }
@@ -215,6 +215,26 @@ if (!function_exists('_get_child')) { @@ -215,6 +215,26 @@ if (!function_exists('_get_child')) {
215 } 215 }
216 } 216 }
217 217
  218 +if (!function_exists('_get_all_sub')) {
  219 + /**
  220 + * 獲取所有子集id
  221 + * @param int
  222 + * @return array
  223 + */
  224 + function _get_all_sub($my_id,$id_Arr)
  225 + {
  226 + $new_arr = array();
  227 + foreach ($id_Arr as $v) {
  228 + if ($v['pid'] == $my_id) {
  229 + $new_arr[] = $v['id'];
  230 + // 递归查找子节点的子节点
  231 + $new_arr = array_merge($new_arr, _get_all_sub($v['id'], $id_Arr));
  232 + }
  233 + }
  234 + return $new_arr ? $new_arr : [];
  235 + }
  236 +}
  237 +
218 238
219 if (!function_exists('checkDomain')) { 239 if (!function_exists('checkDomain')) {
220 /** 240 /**
@@ -422,6 +422,11 @@ class ProductController extends BaseController @@ -422,6 +422,11 @@ class ProductController extends BaseController
422 * @time :2023/8/21 18:33 422 * @time :2023/8/21 18:33
423 */ 423 */
424 public function getStatusNumber(ProductLogic $logic){ 424 public function getStatusNumber(ProductLogic $logic){
  425 + $this->request->validate([
  426 + 'featured_status'=>'numeric',
  427 + ],[
  428 + 'featured_status.numeric' => 'numeric为数字',
  429 + ]);
425 $data = $logic->getStatusNumber(); 430 $data = $logic->getStatusNumber();
426 $this->response('success',Code::SUCCESS,$data); 431 $this->response('success',Code::SUCCESS,$data);
427 } 432 }
@@ -536,10 +541,9 @@ class ProductController extends BaseController @@ -536,10 +541,9 @@ class ProductController extends BaseController
536 $setNumModel = new SettingNum(); 541 $setNumModel = new SettingNum();
537 $info = $setNumModel->read(['type'=>$setNumModel::TYPE_PRODUCT_SORT]); 542 $info = $setNumModel->read(['type'=>$setNumModel::TYPE_PRODUCT_SORT]);
538 if($info === false){ 543 if($info === false){
539 - $info = [];  
540 - }else{  
541 - $info['data'] = json_decode($info['data']); 544 + $this->response('success');
542 } 545 }
  546 + $info['data'] = json_decode($info['data']);
543 $this->response('success',Code::SUCCESS,$info); 547 $this->response('success',Code::SUCCESS,$info);
544 } 548 }
545 549
@@ -580,4 +584,21 @@ class ProductController extends BaseController @@ -580,4 +584,21 @@ class ProductController extends BaseController
580 } 584 }
581 $this->response('success',Code::SUCCESS,$productInfo); 585 $this->response('success',Code::SUCCESS,$productInfo);
582 } 586 }
  587 +
  588 + /**
  589 + * @remark :搜索分类参数
  590 + * @name :searchCategory
  591 + * @author :lyh
  592 + * @method :post
  593 + * @time :2024/7/9 14:48
  594 + */
  595 + public function getSearchCategoryList(ProductLogic $logic){
  596 + $this->request->validate([
  597 + 'featured_status'=>'numeric',
  598 + ],[
  599 + 'featured_status.numeric' => 'numeric为数字',
  600 + ]);
  601 + $data = $logic->getSearchCategoryList();
  602 + $this->response('success',Code::SUCCESS,$data);
  603 + }
583 } 604 }
@@ -41,7 +41,7 @@ class BaseLogic extends Logic @@ -41,7 +41,7 @@ class BaseLogic extends Logic
41 if(is_array($v)){ 41 if(is_array($v)){
42 continue; 42 continue;
43 }else{ 43 }else{
44 - if(empty($v) && ($v == null)){ 44 + if($v == null){
45 unset($requestAll[$k]); 45 unset($requestAll[$k]);
46 } 46 }
47 } 47 }
@@ -210,4 +210,5 @@ class BaseLogic extends Logic @@ -210,4 +210,5 @@ class BaseLogic extends Logic
210 ]; 210 ];
211 return http_post($c_url, json_encode($param)); 211 return http_post($c_url, json_encode($param));
212 } 212 }
  213 +
213 } 214 }
@@ -334,22 +334,6 @@ class ProductLogic extends BaseLogic @@ -334,22 +334,6 @@ class ProductLogic extends BaseLogic
334 334
335 335
336 /** 336 /**
337 - * @remark :编辑产品  
338 - * @name :editProduct  
339 - * @author :lyh  
340 - * @method :post  
341 - * @time :2023/9/7 10:02  
342 - */  
343 - public function editProductRoute($id,$route){  
344 - $info = $this->model->read(['id'=>$id]);  
345 - if($info['route'] != $route){  
346 - $this->addUpdateNotify(RouteMap::SOURCE_PRODUCT,$route);  
347 - }  
348 - $this->curlDelRoute(['route'=>$info['route'],'new_route'=>$route]);  
349 - return $route;  
350 - }  
351 -  
352 - /**  
353 * @remark :删除数据 337 * @remark :删除数据
354 * @name :delete 338 * @name :delete
355 * @author :lyh 339 * @author :lyh
@@ -406,13 +390,32 @@ class ProductLogic extends BaseLogic @@ -406,13 +390,32 @@ class ProductLogic extends BaseLogic
406 * @time :2023/8/9 10:17 390 * @time :2023/8/9 10:17
407 */ 391 */
408 public function getStatusNumber(){ 392 public function getStatusNumber(){
  393 + $map = [];
409 //三种状态 0:草稿 1:发布 2:回收站 394 //三种状态 0:草稿 1:发布 2:回收站
410 $data = ['dra'=>0,'pub'=>1,'del'=>2,'tal'=>3]; 395 $data = ['dra'=>0,'pub'=>1,'del'=>2,'tal'=>3];
411 foreach ($data as $k => $v){ 396 foreach ($data as $k => $v){
  397 + //查詢所有分類
  398 + $cateModel = new Category();
  399 + $cateList = $cateModel->list(['status'=>1],'id',['id','pid']);
  400 + $this->param['featured_status'] = $this->param['featured_status'] ?? 0;
  401 + if(!empty($cateList) && ($this->param['featured_status'] != $cateModel::STATUS_ACTIVE)){
  402 + $featured_ids = $cateModel->where('title', 'like', '%Featured%')->pluck('id')->toArray();
  403 + //获取当前的子集
  404 + $featured_arr = [];
  405 + foreach ($featured_ids as $id){
  406 + $featured_arr = array_values(array_unique(_get_all_sub($id,$cateList)));
  407 + }
  408 + if(!empty($featured_arr)){
  409 + $cateRelated = new CategoryRelated();
  410 + $product_ids = $cateRelated->whereNotIn('cate_id',$featured_arr)->pluck('product_id')->unique()->toArray();
  411 + $map['id'] = ['in',$product_ids];
  412 + }
  413 + }
412 if($v == 3){ 414 if($v == 3){
413 - $data[$k] = $this->model->where(['project_id'=>$this->user['project_id']])->count(); 415 + $data[$k] = $this->model->formatQuery($map)->count();
414 }else{ 416 }else{
415 - $data[$k] = $this->model->where(['status'=>$v,'project_id'=>$this->user['project_id']])->count(); 417 + $map['status'] = $v;
  418 + $data[$k] = $this->model->formatQuery($map)->count();
416 } 419 }
417 } 420 }
418 return $this->success($data); 421 return $this->success($data);
@@ -847,4 +850,34 @@ class ProductLogic extends BaseLogic @@ -847,4 +850,34 @@ class ProductLogic extends BaseLogic
847 } 850 }
848 return false; 851 return false;
849 } 852 }
  853 +
  854 + /**
  855 + * @remark :产品列表搜索参数时分类列表
  856 + * @param :
  857 + * @name :getSearchCategoryList
  858 + * @author :lyh
  859 + * @method :post
  860 + * @time :2024/7/9 14:56
  861 + */
  862 + public function getSearchCategoryList()
  863 + {
  864 + $categoryModel = new Category();
  865 + $this->param['deleted_at'] = null;
  866 + $this->param['featured_status'] = $this->param['featured_status'] ?? 0;
  867 + if(($this->param['featured_status'] != Category::STATUS_ACTIVE)) {
  868 + $this->param['title'] = ['not like','%Featured%'];
  869 + }
  870 + $list = $categoryModel->list($this->param, ['sort', 'id'], ['id', 'pid', 'title']);
  871 + if (!empty($list)) {
  872 + $data = [];
  873 + foreach ($list as $v) {
  874 + $v = (array)$v;
  875 + if ($v['pid'] == 0) {
  876 + $v['sub'] = _get_child($v['id'], $list);
  877 + $data[] = $v;
  878 + }
  879 + }
  880 + }
  881 + return $this->success($data);
  882 + }
850 } 883 }
@@ -175,18 +175,21 @@ class Base extends Model @@ -175,18 +175,21 @@ class Base extends Model
175 $query->where($k, $v[0], $v[1]); 175 $query->where($k, $v[0], $v[1]);
176 } 176 }
177 break; 177 break;
  178 + case 'not like':
  179 + $query->where($k, $v[0], $v[1]);
  180 + break;
178 case 'in': 181 case 'in':
179 // in查询 ['id'=>['in',[1,2,3]]] 182 // in查询 ['id'=>['in',[1,2,3]]]
180 $query->whereIn($k, $v[1]); 183 $query->whereIn($k, $v[1]);
181 break; 184 break;
182 - case 'or':  
183 - // in查询 ['id'=>['or',[1,2,3]]]  
184 - $query->orWhere($k, $v[1]);  
185 - break;  
186 case 'not in': 185 case 'not in':
187 // in查询 ['id'=>['not in',[1,2,3]]] 186 // in查询 ['id'=>['not in',[1,2,3]]]
188 $query->whereNotIn($k, $v[1]); 187 $query->whereNotIn($k, $v[1]);
189 break; 188 break;
  189 + case 'or':
  190 + // in查询 ['id'=>['or',[1,2,3]]]
  191 + $query->orWhere($k, $v[1]);
  192 + break;
190 case 'between': 193 case 'between':
191 // in查询 ['id'=>['between',[create1,create2]]] 194 // in查询 ['id'=>['between',[create1,create2]]]
192 $query->whereBetween($k, $v[1]); 195 $query->whereBetween($k, $v[1]);
@@ -255,6 +255,7 @@ Route::middleware(['bloginauth'])->group(function () { @@ -255,6 +255,7 @@ Route::middleware(['bloginauth'])->group(function () {
255 Route::any('/copyProduct', [\App\Http\Controllers\Bside\Product\ProductController::class, 'copyProduct'])->name('product_copyProduct'); 255 Route::any('/copyProduct', [\App\Http\Controllers\Bside\Product\ProductController::class, 'copyProduct'])->name('product_copyProduct');
256 Route::any('/batchSetCategory', [\App\Http\Controllers\Bside\Product\ProductController::class, 'batchSetCategory'])->name('product_batchSetCategory'); 256 Route::any('/batchSetCategory', [\App\Http\Controllers\Bside\Product\ProductController::class, 'batchSetCategory'])->name('product_batchSetCategory');
257 Route::any('/sendAiProduct', [\App\Http\Controllers\Bside\Product\ProductController::class, 'sendAiProduct'])->name('product_sendAiProduct'); 257 Route::any('/sendAiProduct', [\App\Http\Controllers\Bside\Product\ProductController::class, 'sendAiProduct'])->name('product_sendAiProduct');
  258 + Route::any('/getSearchCategoryList', [\App\Http\Controllers\Bside\Product\ProductController::class, 'getSearchCategoryList'])->name('product_getSearchCategoryList');
258 //产品分类 259 //产品分类
259 Route::get('category', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'index'])->name('product_category'); 260 Route::get('category', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'index'])->name('product_category');
260 Route::get('category/info', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'info'])->name('product_category_info'); 261 Route::get('category/info', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'info'])->name('product_category_info');