Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
17 个修改的文件
包含
156 行增加
和
82 行删除
| @@ -21,23 +21,9 @@ class Kernel extends ConsoleKernel | @@ -21,23 +21,9 @@ 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); // 特殊引流 |
| 35 | -// $schedule->command('web_traffic 1')->everyThirtyMinutes(); // 引流 1-3个月的项目,半小时一次 | ||
| 36 | -// $schedule->command('web_traffic 2')->cron('*/18 * * * *'); // 引流 4-8个月的项目,18分钟一次 | ||
| 37 | -// $schedule->command('web_traffic 3')->cron('*/12 * * * *'); // 引流 大于9个月的项目,12分钟一次 | ||
| 38 | -// $schedule->command('web_traffic_russia 1')->everyThirtyMinutes(); // 俄语站引流 1-3个月的项目,半小时一次 | ||
| 39 | -// $schedule->command('web_traffic_russia 2')->cron('*/18 * * * *'); // 俄语站引流 4-8个月的项目,18分钟一次 | ||
| 40 | -// $schedule->command('web_traffic_russia 3')->cron('*/12 * * * *'); // 俄语站引流 大于9个月的项目,12分钟一次 | ||
| 41 | $schedule->command('sync_channel')->dailyAt('06:00')->withoutOverlapping(1); // 渠道信息,每天执行一次 | 27 | $schedule->command('sync_channel')->dailyAt('06:00')->withoutOverlapping(1); // 渠道信息,每天执行一次 |
| 42 | $schedule->command('forward_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计转发询盘记录 | 28 | $schedule->command('forward_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计转发询盘记录 |
| 43 | $schedule->command('inquiry_delay')->everyMinute()->withoutOverlapping(1);//TODO::上线放开,转发询盘,每分钟执行一次 | 29 | $schedule->command('inquiry_delay')->everyMinute()->withoutOverlapping(1);//TODO::上线放开,转发询盘,每分钟执行一次 |
| @@ -48,10 +34,7 @@ class Kernel extends ConsoleKernel | @@ -48,10 +34,7 @@ class Kernel extends ConsoleKernel | ||
| 48 | $schedule->command('sync_manager')->dailyAt('01:00')->withoutOverlapping(1); //TODO::手机号码同步 每天执行一次 | 34 | $schedule->command('sync_manager')->dailyAt('01:00')->withoutOverlapping(1); //TODO::手机号码同步 每天执行一次 |
| 49 | $schedule->command('update_keyword_route')->dailyAt('01:00')->withoutOverlapping(1); //升级项目--清除路由相同的关键字 | 35 | $schedule->command('update_keyword_route')->dailyAt('01:00')->withoutOverlapping(1); //升级项目--清除路由相同的关键字 |
| 50 | $schedule->command('recommended_suppliers')->dailyAt('03:00')->withoutOverlapping(1); //每天凌晨1点执行一次生成推荐商 | 36 | $schedule->command('recommended_suppliers')->dailyAt('03:00')->withoutOverlapping(1); //每天凌晨1点执行一次生成推荐商 |
| 51 | - | ||
| 52 | $schedule->command('update_keyword_content')->hourly()->withoutOverlapping(1); | 37 | $schedule->command('update_keyword_content')->hourly()->withoutOverlapping(1); |
| 53 | - // 每日推送视频任务 | ||
| 54 | - $schedule->command('video_task')->hourly()->withoutOverlapping(1); | ||
| 55 | // 每日推送已完成视频任务项目生成对应界面 | 38 | // 每日推送已完成视频任务项目生成对应界面 |
| 56 | $schedule->command('notice_c')->dailyAt('04:00')->withoutOverlapping(1); | 39 | $schedule->command('notice_c')->dailyAt('04:00')->withoutOverlapping(1); |
| 57 | } | 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[] = $my_id; | ||
| 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 | /** |
| @@ -42,6 +42,7 @@ class PrivateController extends BaseController | @@ -42,6 +42,7 @@ class PrivateController extends BaseController | ||
| 42 | ->leftJoin('gl_domain_info as d', 'gl_project.id', '=', 'd.project_id') | 42 | ->leftJoin('gl_domain_info as d', 'gl_project.id', '=', 'd.project_id') |
| 43 | ->where('gl_project.type', Project::TYPE_TWO) | 43 | ->where('gl_project.type', Project::TYPE_TWO) |
| 44 | ->where('gl_project.extend_type', 0) // 是否续费是由extend_type字段控制 | 44 | ->where('gl_project.extend_type', 0) // 是否续费是由extend_type字段控制 |
| 45 | + ->where('gl_project.delete_status', Project::IS_DEL_FALSE) | ||
| 45 | ->where(function ($subQuery) { | 46 | ->where(function ($subQuery) { |
| 46 | $subQuery->orwhere('c.qa_status', OnlineCheck::STATUS_ONLINE_TRUE)->orwhere('gl_project.is_upgrade', Project::IS_UPGRADE_TRUE); | 47 | $subQuery->orwhere('c.qa_status', OnlineCheck::STATUS_ONLINE_TRUE)->orwhere('gl_project.is_upgrade', Project::IS_UPGRADE_TRUE); |
| 47 | }) | 48 | }) |
| @@ -4,6 +4,7 @@ namespace App\Http\Controllers\Aside; | @@ -4,6 +4,7 @@ namespace App\Http\Controllers\Aside; | ||
| 4 | 4 | ||
| 5 | use App\Enums\Common\Code; | 5 | use App\Enums\Common\Code; |
| 6 | use App\Enums\Common\Common; | 6 | use App\Enums\Common\Common; |
| 7 | +use App\Exceptions\AsideGlobalException; | ||
| 7 | use App\Http\Controllers\Controller; | 8 | use App\Http\Controllers\Controller; |
| 8 | use App\Models\File\File; | 9 | use App\Models\File\File; |
| 9 | use App\Models\File\Image; | 10 | use App\Models\File\Image; |
| @@ -125,4 +126,15 @@ class BaseController extends Controller | @@ -125,4 +126,15 @@ class BaseController extends Controller | ||
| 125 | throw new HttpResponseException($response); | 126 | throw new HttpResponseException($response); |
| 126 | } | 127 | } |
| 127 | 128 | ||
| 129 | + /** | ||
| 130 | + * @notes: 错误抛出 | ||
| 131 | + * @param string $code | ||
| 132 | + * @param string $message | ||
| 133 | + * @throws AsideGlobalException | ||
| 134 | + */ | ||
| 135 | + public function fail(string $message = "", string $code = Code::SYSTEM_ERROR) | ||
| 136 | + { | ||
| 137 | + throw new AsideGlobalException($code, $message); | ||
| 138 | + } | ||
| 139 | + | ||
| 128 | } | 140 | } |
| @@ -9,7 +9,8 @@ | @@ -9,7 +9,8 @@ | ||
| 9 | 9 | ||
| 10 | namespace App\Http\Controllers\Aside\Com; | 10 | namespace App\Http\Controllers\Aside\Com; |
| 11 | 11 | ||
| 12 | -use App\Http\Controllers\Bside\BaseController; | 12 | +use App\Http\Controllers\Aside\BaseController; |
| 13 | +use App\Models\Com\CollectLog; | ||
| 13 | use App\Models\Com\UpdateLog; | 14 | use App\Models\Com\UpdateLog; |
| 14 | use App\Models\Com\UpdateOldInfo; | 15 | use App\Models\Com\UpdateOldInfo; |
| 15 | use App\Models\Domain\DomainInfo; | 16 | use App\Models\Domain\DomainInfo; |
| @@ -230,6 +231,17 @@ class UpdateController extends BaseController | @@ -230,6 +231,17 @@ class UpdateController extends BaseController | ||
| 230 | $log->save(); | 231 | $log->save(); |
| 231 | } | 232 | } |
| 232 | 233 | ||
| 234 | + //记录采集日志 | ||
| 235 | + $collect_log = new CollectLog(); | ||
| 236 | + $collect_log->add([ | ||
| 237 | + 'user_id' => $this->uid, | ||
| 238 | + 'project_id' => $this->param['project_id'], | ||
| 239 | + 'type' => $this->param['type'], | ||
| 240 | + 'old_collect' => $this->param['old_collect'], | ||
| 241 | + 'collect_routes' => $this->param['collect_routes'] ?? '', | ||
| 242 | + 'test_domain' => $this->param['test_domain'] ?? '', | ||
| 243 | + ]); | ||
| 244 | + | ||
| 233 | $this->response('采集任务添加成功'); | 245 | $this->response('采集任务添加成功'); |
| 234 | } | 246 | } |
| 235 | 247 |
| @@ -39,13 +39,6 @@ class ATemplateTypeController extends BaseController | @@ -39,13 +39,6 @@ class ATemplateTypeController extends BaseController | ||
| 39 | * @time :2023/7/10 15:49 | 39 | * @time :2023/7/10 15:49 |
| 40 | */ | 40 | */ |
| 41 | public function save(ATemplateTypeRequest $ATemplateTypeRequest,ATemplateTypeLogic $ATemplateTypeLogic){ | 41 | public function save(ATemplateTypeRequest $ATemplateTypeRequest,ATemplateTypeLogic $ATemplateTypeLogic){ |
| 42 | - if(isset($this->param['id']) && !empty($this->param['id'])){ | ||
| 43 | - $this->request->validate([ | ||
| 44 | - 'id'=>'required' | ||
| 45 | - ],[ | ||
| 46 | - 'id.required' => 'ID不能为空' | ||
| 47 | - ]); | ||
| 48 | - } | ||
| 49 | $ATemplateTypeRequest->validated(); | 42 | $ATemplateTypeRequest->validated(); |
| 50 | $ATemplateTypeLogic->typeSave(); | 43 | $ATemplateTypeLogic->typeSave(); |
| 51 | $this->response('success'); | 44 | $this->response('success'); |
| @@ -90,6 +90,7 @@ class MonthReportController extends BaseController | @@ -90,6 +90,7 @@ class MonthReportController extends BaseController | ||
| 90 | 90 | ||
| 91 | $info['remain_day'] = $this->user['remain_day'];//剩余服务天数 | 91 | $info['remain_day'] = $this->user['remain_day'];//剩余服务天数 |
| 92 | $info['speed'] = round((0.3 + mt_rand()/mt_getrandmax() * (1-0.3)),2); | 92 | $info['speed'] = round((0.3 + mt_rand()/mt_getrandmax() * (1-0.3)),2); |
| 93 | + $info['month_total'] = (int)$info['month_total']; | ||
| 93 | $this->response('success',Code::SUCCESS,$info); | 94 | $this->response('success',Code::SUCCESS,$info); |
| 94 | } | 95 | } |
| 95 | } | 96 | } |
| @@ -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 | } |
| @@ -37,15 +37,6 @@ class BaseLogic extends Logic | @@ -37,15 +37,6 @@ class BaseLogic extends Logic | ||
| 37 | */ | 37 | */ |
| 38 | public function getParam(){ | 38 | public function getParam(){ |
| 39 | $requestAll = $this->request->all(); | 39 | $requestAll = $this->request->all(); |
| 40 | - foreach ($requestAll as $k => $v){ | ||
| 41 | - if(is_array($v)){ | ||
| 42 | - continue; | ||
| 43 | - }else{ | ||
| 44 | - if(empty($v) && ($v == null)){ | ||
| 45 | - unset($requestAll[$k]); | ||
| 46 | - } | ||
| 47 | - } | ||
| 48 | - } | ||
| 49 | return $this->success($requestAll); | 40 | return $this->success($requestAll); |
| 50 | } | 41 | } |
| 51 | } | 42 | } |
| @@ -709,7 +709,7 @@ class BTemplateLogic extends BaseLogic | @@ -709,7 +709,7 @@ class BTemplateLogic extends BaseLogic | ||
| 709 | } | 709 | } |
| 710 | $route = RouteMap::getRoute($type,$source_id,$this->user['project_id']); | 710 | $route = RouteMap::getRoute($type,$source_id,$this->user['project_id']); |
| 711 | $this->addUpdateNotify($type,$route); | 711 | $this->addUpdateNotify($type,$route); |
| 712 | - return $this->curlDelRoute(['route'=>$route,'new_route'=>$route]); | 712 | + return $this->curlDelRoute(['old_route'=>$route,'new_route'=>$route]); |
| 713 | } | 713 | } |
| 714 | 714 | ||
| 715 | /** | 715 | /** |
| @@ -179,16 +179,15 @@ class BlogLogic extends BaseLogic | @@ -179,16 +179,15 @@ class BlogLogic extends BaseLogic | ||
| 179 | public function paramProcessing($param){ | 179 | public function paramProcessing($param){ |
| 180 | if(isset($this->param['id'])){ | 180 | if(isset($this->param['id'])){ |
| 181 | $param['operator_id'] = $this->user['id']; | 181 | $param['operator_id'] = $this->user['id']; |
| 182 | - if(isset($param['category_id']) && !empty($param['category_id'])){ | ||
| 183 | - $param['category_id'] = $this->getCategory($param['category_id']); | ||
| 184 | - } | ||
| 185 | }else{ | 182 | }else{ |
| 186 | $param['create_id'] = $this->user['id']; | 183 | $param['create_id'] = $this->user['id']; |
| 187 | $param['operator_id'] = $this->user['id']; | 184 | $param['operator_id'] = $this->user['id']; |
| 188 | $param['project_id'] = $this->user['project_id']; | 185 | $param['project_id'] = $this->user['project_id']; |
| 189 | - if(isset($param['category_id']) && !empty($param['category_id'])){ | ||
| 190 | - $param['category_id'] = $this->getCategory($param['category_id']); | ||
| 191 | - } | 186 | + } |
| 187 | + if(isset($param['category_id']) && !empty($param['category_id'])){ | ||
| 188 | + $param['category_id'] = $this->getCategory($param['category_id']); | ||
| 189 | + }else{ | ||
| 190 | + $param['category_id'] = ''; | ||
| 192 | } | 191 | } |
| 193 | return $this->success($param); | 192 | return $this->success($param); |
| 194 | } | 193 | } |
| @@ -201,11 +200,8 @@ class BlogLogic extends BaseLogic | @@ -201,11 +200,8 @@ class BlogLogic extends BaseLogic | ||
| 201 | * @time :2023/10/20 9:02 | 200 | * @time :2023/10/20 9:02 |
| 202 | */ | 201 | */ |
| 203 | public function getCategory($category){ | 202 | public function getCategory($category){ |
| 204 | - $str = ''; | ||
| 205 | - foreach ($category as $v){ | ||
| 206 | - $str .= $v.','; | ||
| 207 | - } | ||
| 208 | - return !empty(trim($str,',')) ? ','.$str.',' : ''; | 203 | + $str = implode(',',$category); |
| 204 | + return !empty(trim(trim($str,','),',')) ? ','.$str.',' : ''; | ||
| 209 | } | 205 | } |
| 210 | 206 | ||
| 211 | /** | 207 | /** |
| @@ -191,16 +191,15 @@ class NewsLogic extends BaseLogic | @@ -191,16 +191,15 @@ class NewsLogic extends BaseLogic | ||
| 191 | } | 191 | } |
| 192 | if(isset($this->param['id'])){ | 192 | if(isset($this->param['id'])){ |
| 193 | $param['operator_id'] = $this->user['id']; | 193 | $param['operator_id'] = $this->user['id']; |
| 194 | - if(isset($param['category_id']) && !empty($param['category_id'])){ | ||
| 195 | - $param['category_id'] = $this->getCategory($param['category_id']); | ||
| 196 | - } | ||
| 197 | }else{ | 194 | }else{ |
| 198 | $param['create_id'] = $this->user['id']; | 195 | $param['create_id'] = $this->user['id']; |
| 199 | $param['operator_id'] = $this->user['id']; | 196 | $param['operator_id'] = $this->user['id']; |
| 200 | $param['project_id'] = $this->user['project_id']; | 197 | $param['project_id'] = $this->user['project_id']; |
| 201 | - if(isset($param['category_id']) && !empty($param['category_id'])){ | ||
| 202 | - $param['category_id'] = $this->getCategory($param['category_id']); | ||
| 203 | - } | 198 | + } |
| 199 | + if(isset($param['category_id']) && !empty($param['category_id'])){ | ||
| 200 | + $param['category_id'] = $this->getCategory($param['category_id']); | ||
| 201 | + }else{ | ||
| 202 | + $param['category_id'] = ''; | ||
| 204 | } | 203 | } |
| 205 | return $this->success($param); | 204 | return $this->success($param); |
| 206 | } | 205 | } |
| @@ -213,11 +212,8 @@ class NewsLogic extends BaseLogic | @@ -213,11 +212,8 @@ class NewsLogic extends BaseLogic | ||
| 213 | * @time :2023/10/20 9:02 | 212 | * @time :2023/10/20 9:02 |
| 214 | */ | 213 | */ |
| 215 | public function getCategory($category){ | 214 | public function getCategory($category){ |
| 216 | - $str = ''; | ||
| 217 | - foreach ($category as $v){ | ||
| 218 | - $str .= $v.','; | ||
| 219 | - } | ||
| 220 | - return !empty(trim($str,',')) ? ','.$str.',' : ''; | 215 | + $str = implode(',',$category); |
| 216 | + return !empty(trim(trim($str,','),',')) ? ','.$str.',' : ''; | ||
| 221 | } | 217 | } |
| 222 | 218 | ||
| 223 | /** | 219 | /** |
| @@ -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 |
| @@ -409,10 +393,28 @@ class ProductLogic extends BaseLogic | @@ -409,10 +393,28 @@ class ProductLogic extends BaseLogic | ||
| 409 | //三种状态 0:草稿 1:发布 2:回收站 | 393 | //三种状态 0:草稿 1:发布 2:回收站 |
| 410 | $data = ['dra'=>0,'pub'=>1,'del'=>2,'tal'=>3]; | 394 | $data = ['dra'=>0,'pub'=>1,'del'=>2,'tal'=>3]; |
| 411 | foreach ($data as $k => $v){ | 395 | foreach ($data as $k => $v){ |
| 396 | + $map = []; | ||
| 397 | + $cateModel = new Category(); | ||
| 398 | + $cateList = $cateModel->list(['status'=>1],'id',['id','pid']); | ||
| 399 | + $this->param['featured_status'] = $this->param['featured_status'] ?? 0; | ||
| 400 | + if(!empty($cateList) && ($this->param['featured_status'] != $cateModel::STATUS_ACTIVE)){ | ||
| 401 | + $featured_ids = $cateModel->where('title', 'like', 'Featured%')->pluck('id')->toArray(); | ||
| 402 | + //获取当前的子集 | ||
| 403 | + $featured_arr = []; | ||
| 404 | + foreach ($featured_ids as $id){ | ||
| 405 | + $featured_arr = array_merge($featured_arr,array_unique(_get_all_sub($id,$cateList))); | ||
| 406 | + } | ||
| 407 | + if(!empty($featured_arr)){ | ||
| 408 | + $cateRelated = new CategoryRelated(); | ||
| 409 | + $product_ids = $cateRelated->whereNotIn('cate_id',$featured_arr)->pluck('product_id')->unique()->toArray(); | ||
| 410 | + $map['id'] = ['in',$product_ids]; | ||
| 411 | + } | ||
| 412 | + } | ||
| 412 | if($v == 3){ | 413 | if($v == 3){ |
| 413 | - $data[$k] = $this->model->where(['project_id'=>$this->user['project_id']])->count(); | 414 | + $data[$k] = $this->model->formatQuery($map)->count(); |
| 414 | }else{ | 415 | }else{ |
| 415 | - $data[$k] = $this->model->where(['status'=>$v,'project_id'=>$this->user['project_id']])->count(); | 416 | + $map['status'] = $v; |
| 417 | + $data[$k] = $this->model->formatQuery($map)->count(); | ||
| 416 | } | 418 | } |
| 417 | } | 419 | } |
| 418 | return $this->success($data); | 420 | return $this->success($data); |
| @@ -847,4 +849,35 @@ class ProductLogic extends BaseLogic | @@ -847,4 +849,35 @@ class ProductLogic extends BaseLogic | ||
| 847 | } | 849 | } |
| 848 | return false; | 850 | return false; |
| 849 | } | 851 | } |
| 852 | + | ||
| 853 | + /** | ||
| 854 | + * @remark :产品列表搜索参数时分类列表 | ||
| 855 | + * @param : | ||
| 856 | + * @name :getSearchCategoryList | ||
| 857 | + * @author :lyh | ||
| 858 | + * @method :post | ||
| 859 | + * @time :2024/7/9 14:56 | ||
| 860 | + */ | ||
| 861 | + public function getSearchCategoryList() | ||
| 862 | + { | ||
| 863 | + $categoryModel = new Category(); | ||
| 864 | + $this->param['deleted_at'] = null; | ||
| 865 | + $this->param['featured_status'] = $this->param['featured_status'] ?? 0; | ||
| 866 | + if(($this->param['featured_status'] != Category::STATUS_ACTIVE)) { | ||
| 867 | + $this->param['title'] = ['not like','%Featured%']; | ||
| 868 | + } | ||
| 869 | + unset($this->param['featured_status']); | ||
| 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]); |
app/Models/Com/CollectLog.php
0 → 100644
| @@ -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'); |
-
请 注册 或 登录 后发表评论