作者 赵彬吉
... ... @@ -21,23 +21,9 @@ class Kernel extends ConsoleKernel
// $schedule->command('inspire')->hourly();
$schedule->command('remain_day')->dailyAt('09:00')->withoutOverlapping(1); // 项目剩余服务时长
$schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务
// $schedule->command('rank_data')->dailyAt('07:00')->withoutOverlapping(1); // 排名数据,每天凌晨执行一次
// $schedule->command('rank_data')->dailyAt('08:00')->withoutOverlapping(1); // 排名数据,每天凌晨执行一次
// $schedule->command('rank_data_speed')->dailyAt('01:10')->withoutOverlapping(1); // 排名数据-测速数据,每周一凌晨执行一次
// $schedule->command('rank_data_external_links')->dailyAt('08:30')->withoutOverlapping(1); // 排名数据-外链,每周一凌晨执行一次
// $schedule->command('rank_data_external_links')->dailyAt('18:00')->withoutOverlapping(1); // 排名数据-外链,每周一凌晨执行一次
// $schedule->command('rank_data_indexed_pages')->dailyAt('07:30')->withoutOverlapping(1); // 排名数据-页面收录,每周一凌晨执行一次
// $schedule->command('rank_data_recomm_domain')->dailyAt('07:40')->withoutOverlapping(1); // 排名数据-引荐域名,每周一凌晨执行一次
// $schedule->command('rank_data_week')->weeklyOn([1,2], '08:30')->withoutOverlapping(1); // 排名数据,每周一、二早上执行一次
$schedule->command('service_count')->dailyAt('01:00')->withoutOverlapping(1); //服务器使用情况,每天凌晨1点执行一次
$schedule->command('web_traffic_special')->everyMinute()->withoutOverlapping(1); // 特殊引流
$schedule->command('web_traffic_russia_special')->everyMinute()->withoutOverlapping(1); // 特殊引流
// $schedule->command('web_traffic 1')->everyThirtyMinutes(); // 引流 1-3个月的项目,半小时一次
// $schedule->command('web_traffic 2')->cron('*/18 * * * *'); // 引流 4-8个月的项目,18分钟一次
// $schedule->command('web_traffic 3')->cron('*/12 * * * *'); // 引流 大于9个月的项目,12分钟一次
// $schedule->command('web_traffic_russia 1')->everyThirtyMinutes(); // 俄语站引流 1-3个月的项目,半小时一次
// $schedule->command('web_traffic_russia 2')->cron('*/18 * * * *'); // 俄语站引流 4-8个月的项目,18分钟一次
// $schedule->command('web_traffic_russia 3')->cron('*/12 * * * *'); // 俄语站引流 大于9个月的项目,12分钟一次
$schedule->command('sync_channel')->dailyAt('06:00')->withoutOverlapping(1); // 渠道信息,每天执行一次
$schedule->command('forward_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计转发询盘记录
$schedule->command('inquiry_delay')->everyMinute()->withoutOverlapping(1);//TODO::上线放开,转发询盘,每分钟执行一次
... ... @@ -48,10 +34,7 @@ class Kernel extends ConsoleKernel
$schedule->command('sync_manager')->dailyAt('01:00')->withoutOverlapping(1); //TODO::手机号码同步 每天执行一次
$schedule->command('update_keyword_route')->dailyAt('01:00')->withoutOverlapping(1); //升级项目--清除路由相同的关键字
$schedule->command('recommended_suppliers')->dailyAt('03:00')->withoutOverlapping(1); //每天凌晨1点执行一次生成推荐商
$schedule->command('update_keyword_content')->hourly()->withoutOverlapping(1);
// 每日推送视频任务
$schedule->command('video_task')->hourly()->withoutOverlapping(1);
// 每日推送已完成视频任务项目生成对应界面
$schedule->command('notice_c')->dailyAt('04:00')->withoutOverlapping(1);
}
... ...
... ... @@ -215,6 +215,26 @@ if (!function_exists('_get_child')) {
}
}
if (!function_exists('_get_all_sub')) {
/**
* 獲取所有子集id
* @param int
* @return array
*/
function _get_all_sub($my_id,$id_Arr)
{
$new_arr[] = $my_id;
foreach ($id_Arr as $v) {
if ($v['pid'] == $my_id) {
$new_arr[] = $v['id'];
// 递归查找子节点的子节点
$new_arr = array_merge($new_arr, _get_all_sub($v['id'], $id_Arr));
}
}
return $new_arr ? $new_arr : [];
}
}
if (!function_exists('checkDomain')) {
/**
... ...
... ... @@ -42,6 +42,7 @@ class PrivateController extends BaseController
->leftJoin('gl_domain_info as d', 'gl_project.id', '=', 'd.project_id')
->where('gl_project.type', Project::TYPE_TWO)
->where('gl_project.extend_type', 0) // 是否续费是由extend_type字段控制
->where('gl_project.delete_status', Project::IS_DEL_FALSE)
->where(function ($subQuery) {
$subQuery->orwhere('c.qa_status', OnlineCheck::STATUS_ONLINE_TRUE)->orwhere('gl_project.is_upgrade', Project::IS_UPGRADE_TRUE);
})
... ...
... ... @@ -4,6 +4,7 @@ namespace App\Http\Controllers\Aside;
use App\Enums\Common\Code;
use App\Enums\Common\Common;
use App\Exceptions\AsideGlobalException;
use App\Http\Controllers\Controller;
use App\Models\File\File;
use App\Models\File\Image;
... ... @@ -125,4 +126,15 @@ class BaseController extends Controller
throw new HttpResponseException($response);
}
/**
* @notes: 错误抛出
* @param string $code
* @param string $message
* @throws AsideGlobalException
*/
public function fail(string $message = "", string $code = Code::SYSTEM_ERROR)
{
throw new AsideGlobalException($code, $message);
}
}
... ...
... ... @@ -9,7 +9,8 @@
namespace App\Http\Controllers\Aside\Com;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Controllers\Aside\BaseController;
use App\Models\Com\CollectLog;
use App\Models\Com\UpdateLog;
use App\Models\Com\UpdateOldInfo;
use App\Models\Domain\DomainInfo;
... ... @@ -230,6 +231,17 @@ class UpdateController extends BaseController
$log->save();
}
//记录采集日志
$collect_log = new CollectLog();
$collect_log->add([
'user_id' => $this->uid,
'project_id' => $this->param['project_id'],
'type' => $this->param['type'],
'old_collect' => $this->param['old_collect'],
'collect_routes' => $this->param['collect_routes'] ?? '',
'test_domain' => $this->param['test_domain'] ?? '',
]);
$this->response('采集任务添加成功');
}
... ...
... ... @@ -39,13 +39,6 @@ class ATemplateTypeController extends BaseController
* @time :2023/7/10 15:49
*/
public function save(ATemplateTypeRequest $ATemplateTypeRequest,ATemplateTypeLogic $ATemplateTypeLogic){
if(isset($this->param['id']) && !empty($this->param['id'])){
$this->request->validate([
'id'=>'required'
],[
'id.required' => 'ID不能为空'
]);
}
$ATemplateTypeRequest->validated();
$ATemplateTypeLogic->typeSave();
$this->response('success');
... ...
... ... @@ -90,6 +90,7 @@ class MonthReportController extends BaseController
$info['remain_day'] = $this->user['remain_day'];//剩余服务天数
$info['speed'] = round((0.3 + mt_rand()/mt_getrandmax() * (1-0.3)),2);
$info['month_total'] = (int)$info['month_total'];
$this->response('success',Code::SUCCESS,$info);
}
}
... ...
... ... @@ -422,6 +422,11 @@ class ProductController extends BaseController
* @time :2023/8/21 18:33
*/
public function getStatusNumber(ProductLogic $logic){
$this->request->validate([
'featured_status'=>'numeric',
],[
'featured_status.numeric' => 'numeric为数字',
]);
$data = $logic->getStatusNumber();
$this->response('success',Code::SUCCESS,$data);
}
... ... @@ -536,10 +541,9 @@ class ProductController extends BaseController
$setNumModel = new SettingNum();
$info = $setNumModel->read(['type'=>$setNumModel::TYPE_PRODUCT_SORT]);
if($info === false){
$info = [];
}else{
$info['data'] = json_decode($info['data']);
$this->response('success');
}
$info['data'] = json_decode($info['data']);
$this->response('success',Code::SUCCESS,$info);
}
... ... @@ -580,4 +584,21 @@ class ProductController extends BaseController
}
$this->response('success',Code::SUCCESS,$productInfo);
}
/**
* @remark :搜索分类参数
* @name :searchCategory
* @author :lyh
* @method :post
* @time :2024/7/9 14:48
*/
public function getSearchCategoryList(ProductLogic $logic){
$this->request->validate([
'featured_status'=>'numeric',
],[
'featured_status.numeric' => 'numeric为数字',
]);
$data = $logic->getSearchCategoryList();
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
... ... @@ -37,15 +37,6 @@ class BaseLogic extends Logic
*/
public function getParam(){
$requestAll = $this->request->all();
foreach ($requestAll as $k => $v){
if(is_array($v)){
continue;
}else{
if(empty($v) && ($v == null)){
unset($requestAll[$k]);
}
}
}
return $this->success($requestAll);
}
}
... ...
... ... @@ -709,7 +709,7 @@ class BTemplateLogic extends BaseLogic
}
$route = RouteMap::getRoute($type,$source_id,$this->user['project_id']);
$this->addUpdateNotify($type,$route);
return $this->curlDelRoute(['route'=>$route,'new_route'=>$route]);
return $this->curlDelRoute(['old_route'=>$route,'new_route'=>$route]);
}
/**
... ...
... ... @@ -210,4 +210,5 @@ class BaseLogic extends Logic
];
return http_post($c_url, json_encode($param));
}
}
... ...
... ... @@ -179,16 +179,15 @@ class BlogLogic extends BaseLogic
public function paramProcessing($param){
if(isset($this->param['id'])){
$param['operator_id'] = $this->user['id'];
if(isset($param['category_id']) && !empty($param['category_id'])){
$param['category_id'] = $this->getCategory($param['category_id']);
}
}else{
$param['create_id'] = $this->user['id'];
$param['operator_id'] = $this->user['id'];
$param['project_id'] = $this->user['project_id'];
if(isset($param['category_id']) && !empty($param['category_id'])){
$param['category_id'] = $this->getCategory($param['category_id']);
}
}
if(isset($param['category_id']) && !empty($param['category_id'])){
$param['category_id'] = $this->getCategory($param['category_id']);
}else{
$param['category_id'] = '';
}
return $this->success($param);
}
... ... @@ -201,11 +200,8 @@ class BlogLogic extends BaseLogic
* @time :2023/10/20 9:02
*/
public function getCategory($category){
$str = '';
foreach ($category as $v){
$str .= $v.',';
}
return !empty(trim($str,',')) ? ','.$str.',' : '';
$str = implode(',',$category);
return !empty(trim(trim($str,','),',')) ? ','.$str.',' : '';
}
/**
... ...
... ... @@ -191,16 +191,15 @@ class NewsLogic extends BaseLogic
}
if(isset($this->param['id'])){
$param['operator_id'] = $this->user['id'];
if(isset($param['category_id']) && !empty($param['category_id'])){
$param['category_id'] = $this->getCategory($param['category_id']);
}
}else{
$param['create_id'] = $this->user['id'];
$param['operator_id'] = $this->user['id'];
$param['project_id'] = $this->user['project_id'];
if(isset($param['category_id']) && !empty($param['category_id'])){
$param['category_id'] = $this->getCategory($param['category_id']);
}
}
if(isset($param['category_id']) && !empty($param['category_id'])){
$param['category_id'] = $this->getCategory($param['category_id']);
}else{
$param['category_id'] = '';
}
return $this->success($param);
}
... ... @@ -213,11 +212,8 @@ class NewsLogic extends BaseLogic
* @time :2023/10/20 9:02
*/
public function getCategory($category){
$str = '';
foreach ($category as $v){
$str .= $v.',';
}
return !empty(trim($str,',')) ? ','.$str.',' : '';
$str = implode(',',$category);
return !empty(trim(trim($str,','),',')) ? ','.$str.',' : '';
}
/**
... ...
... ... @@ -334,22 +334,6 @@ class ProductLogic extends BaseLogic
/**
* @remark :编辑产品
* @name :editProduct
* @author :lyh
* @method :post
* @time :2023/9/7 10:02
*/
public function editProductRoute($id,$route){
$info = $this->model->read(['id'=>$id]);
if($info['route'] != $route){
$this->addUpdateNotify(RouteMap::SOURCE_PRODUCT,$route);
}
$this->curlDelRoute(['route'=>$info['route'],'new_route'=>$route]);
return $route;
}
/**
* @remark :删除数据
* @name :delete
* @author :lyh
... ... @@ -409,10 +393,28 @@ class ProductLogic extends BaseLogic
//三种状态 0:草稿 1:发布 2:回收站
$data = ['dra'=>0,'pub'=>1,'del'=>2,'tal'=>3];
foreach ($data as $k => $v){
$map = [];
$cateModel = new Category();
$cateList = $cateModel->list(['status'=>1],'id',['id','pid']);
$this->param['featured_status'] = $this->param['featured_status'] ?? 0;
if(!empty($cateList) && ($this->param['featured_status'] != $cateModel::STATUS_ACTIVE)){
$featured_ids = $cateModel->where('title', 'like', 'Featured%')->pluck('id')->toArray();
//获取当前的子集
$featured_arr = [];
foreach ($featured_ids as $id){
$featured_arr = array_merge($featured_arr,array_unique(_get_all_sub($id,$cateList)));
}
if(!empty($featured_arr)){
$cateRelated = new CategoryRelated();
$product_ids = $cateRelated->whereNotIn('cate_id',$featured_arr)->pluck('product_id')->unique()->toArray();
$map['id'] = ['in',$product_ids];
}
}
if($v == 3){
$data[$k] = $this->model->where(['project_id'=>$this->user['project_id']])->count();
$data[$k] = $this->model->formatQuery($map)->count();
}else{
$data[$k] = $this->model->where(['status'=>$v,'project_id'=>$this->user['project_id']])->count();
$map['status'] = $v;
$data[$k] = $this->model->formatQuery($map)->count();
}
}
return $this->success($data);
... ... @@ -847,4 +849,35 @@ class ProductLogic extends BaseLogic
}
return false;
}
/**
* @remark :产品列表搜索参数时分类列表
* @param :
* @name :getSearchCategoryList
* @author :lyh
* @method :post
* @time :2024/7/9 14:56
*/
public function getSearchCategoryList()
{
$categoryModel = new Category();
$this->param['deleted_at'] = null;
$this->param['featured_status'] = $this->param['featured_status'] ?? 0;
if(($this->param['featured_status'] != Category::STATUS_ACTIVE)) {
$this->param['title'] = ['not like','%Featured%'];
}
unset($this->param['featured_status']);
$list = $categoryModel->list($this->param, ['sort', 'id'], ['id', 'pid', 'title']);
if (!empty($list)) {
$data = [];
foreach ($list as $v) {
$v = (array)$v;
if ($v['pid'] == 0) {
$v['sub'] = _get_child($v['id'], $list);
$data[] = $v;
}
}
}
return $this->success($data);
}
}
... ...
... ... @@ -175,18 +175,21 @@ class Base extends Model
$query->where($k, $v[0], $v[1]);
}
break;
case 'not like':
$query->where($k, $v[0], $v[1]);
break;
case 'in':
// in查询 ['id'=>['in',[1,2,3]]]
$query->whereIn($k, $v[1]);
break;
case 'or':
// in查询 ['id'=>['or',[1,2,3]]]
$query->orWhere($k, $v[1]);
break;
case 'not in':
// in查询 ['id'=>['not in',[1,2,3]]]
$query->whereNotIn($k, $v[1]);
break;
case 'or':
// in查询 ['id'=>['or',[1,2,3]]]
$query->orWhere($k, $v[1]);
break;
case 'between':
// in查询 ['id'=>['between',[create1,create2]]]
$query->whereBetween($k, $v[1]);
... ...
<?php
namespace App\Models\Com;
use App\Models\Base;
class CollectLog extends Base
{
protected $table = 'gl_collect_log';
}
... ...
... ... @@ -255,6 +255,7 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/copyProduct', [\App\Http\Controllers\Bside\Product\ProductController::class, 'copyProduct'])->name('product_copyProduct');
Route::any('/batchSetCategory', [\App\Http\Controllers\Bside\Product\ProductController::class, 'batchSetCategory'])->name('product_batchSetCategory');
Route::any('/sendAiProduct', [\App\Http\Controllers\Bside\Product\ProductController::class, 'sendAiProduct'])->name('product_sendAiProduct');
Route::any('/getSearchCategoryList', [\App\Http\Controllers\Bside\Product\ProductController::class, 'getSearchCategoryList'])->name('product_getSearchCategoryList');
//产品分类
Route::get('category', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'index'])->name('product_category');
Route::get('category/info', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'info'])->name('product_category_info');
... ...