Merge remote-tracking branch 'origin/master' into akun
正在显示
8 个修改的文件
包含
162 行增加
和
3 行删除
app/Console/Commands/Product/SendProduct.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :SendProduct.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2024/8/30 14:41 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Console\Commands\Product; | ||
| 11 | + | ||
| 12 | +use App\Models\Blog\Blog; | ||
| 13 | +use App\Models\Domain\DomainInfo; | ||
| 14 | +use App\Models\News\News; | ||
| 15 | +use App\Models\Product\Product; | ||
| 16 | +use App\Models\Project\Project; | ||
| 17 | +use App\Services\ProjectServer; | ||
| 18 | +use Illuminate\Console\Command; | ||
| 19 | +use Illuminate\Support\Facades\DB; | ||
| 20 | + | ||
| 21 | +class SendProduct extends Command | ||
| 22 | +{ | ||
| 23 | + /** | ||
| 24 | + * The name and signature of the console command. | ||
| 25 | + * | ||
| 26 | + * @var string | ||
| 27 | + */ | ||
| 28 | + protected $signature = 'send_product'; | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * The console command description. | ||
| 32 | + * | ||
| 33 | + * @var string | ||
| 34 | + */ | ||
| 35 | + protected $description = '根据发布时间发布产品'; | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * @remark :发布 | ||
| 39 | + * @name :handle | ||
| 40 | + * @author :lyh | ||
| 41 | + * @method :post | ||
| 42 | + * @time :2024/8/30 14:42 | ||
| 43 | + */ | ||
| 44 | + public function handle(){ | ||
| 45 | + $projectModel = new Project(); | ||
| 46 | + $list = $projectModel->list(['deleted_status'=>0]); | ||
| 47 | + $data = []; | ||
| 48 | + foreach ($list as $v){ | ||
| 49 | + echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; | ||
| 50 | + ProjectServer::useProject($v['id']); | ||
| 51 | + $domainModel = new DomainInfo(); | ||
| 52 | + $domain = $domainModel->getProjectIdDomain($v['id']); | ||
| 53 | + if(empty($domain)){ | ||
| 54 | + continue; | ||
| 55 | + } | ||
| 56 | + $arr1 = $this->sendProduct(); | ||
| 57 | + $arr2 = $this->sendBlog(); | ||
| 58 | + $arr3 = $this->sendNews(); | ||
| 59 | + $c_url = $domain.'api/update_page/'; | ||
| 60 | + $param = [ | ||
| 61 | + 'project_id' => $this->user['project_id'], | ||
| 62 | + 'type' => 1, | ||
| 63 | + 'route' => 3, | ||
| 64 | + 'url' => array_merge($arr1,$arr2,$arr3), | ||
| 65 | + 'language'=> [], | ||
| 66 | + 'is_sitemap' => 0 | ||
| 67 | + ]; | ||
| 68 | + http_post($c_url, json_encode($param)); | ||
| 69 | + //TODO::通知C端生成界面 | ||
| 70 | + DB::disconnect('custom_mysql'); | ||
| 71 | + } | ||
| 72 | + echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + /** | ||
| 76 | + * @remark :发布产品 | ||
| 77 | + * @name :sendProduct | ||
| 78 | + * @author :lyh | ||
| 79 | + * @method :post | ||
| 80 | + * @time :2024/8/30 14:44 | ||
| 81 | + */ | ||
| 82 | + public function sendProduct(){ | ||
| 83 | + $start_date = date('Y-m-d H:i:s'); | ||
| 84 | + $end_date = date('Y-m-d 23:59:59'); | ||
| 85 | + $productModel = new Product(); | ||
| 86 | + $arr = $productModel->formatQuery(['send_time'=>['between',[$start_date,$end_date]],'status'=>3])->pluck('route'); | ||
| 87 | + $productModel->edit(['status'=>1],['send_time'=>['between',[$start_date,$end_date]],'status'=>3]); | ||
| 88 | + return $arr; | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + /** | ||
| 92 | + * @remark :定时发布博客 | ||
| 93 | + * @name :sendBlog | ||
| 94 | + * @author :lyh | ||
| 95 | + * @method :post | ||
| 96 | + * @time :2024/8/30 15:19 | ||
| 97 | + */ | ||
| 98 | + public function sendBlog(){ | ||
| 99 | + $start_date = date('Y-m-d H:i:s'); | ||
| 100 | + $end_date = date('Y-m-d 23:59:59'); | ||
| 101 | + $blogModel = new Blog(); | ||
| 102 | + $arr = $blogModel->formatQuery(['send_time'=>['between',[$start_date,$end_date]],'status'=>3])->pluck('url'); | ||
| 103 | + $blogModel->edit(['status'=>1],['release_at'=>['between',[$start_date,$end_date]],'status'=>3]); | ||
| 104 | + return $arr; | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + /** | ||
| 108 | + * @remark :定时发布新闻 | ||
| 109 | + * @name :sendNews | ||
| 110 | + * @author :lyh | ||
| 111 | + * @method :post | ||
| 112 | + * @time :2024/8/30 15:19 | ||
| 113 | + */ | ||
| 114 | + public function sendNews(){ | ||
| 115 | + $start_date = date('Y-m-d H:i:s'); | ||
| 116 | + $end_date = date('Y-m-d 23:59:59'); | ||
| 117 | + $newsModel = new News(); | ||
| 118 | + $arr = $newsModel->formatQuery(['send_time'=>['between',[$start_date,$end_date]],'status'=>3])->pluck('url'); | ||
| 119 | + $newsModel->edit(['status'=>1],['release_at'=>['between',[$start_date,$end_date]],'status'=>3]); | ||
| 120 | + return $arr; | ||
| 121 | + } | ||
| 122 | +} |
| @@ -30,7 +30,7 @@ class Kernel extends ConsoleKernel | @@ -30,7 +30,7 @@ class Kernel extends ConsoleKernel | ||
| 30 | $schedule->command('inquiry_delay')->everyMinute()->withoutOverlapping(1);//TODO::上线放开,转发询盘,每分钟执行一次 | 30 | $schedule->command('inquiry_delay')->everyMinute()->withoutOverlapping(1);//TODO::上线放开,转发询盘,每分钟执行一次 |
| 31 | $schedule->command('inquiry_count')->dailyAt('01:00')->withoutOverlapping(1); // 询盘统计数据,每天凌晨执行一次 | 31 | $schedule->command('inquiry_count')->dailyAt('01:00')->withoutOverlapping(1); // 询盘统计数据,每天凌晨执行一次 |
| 32 | // $schedule->command('domain_info')->dailyAt('01:20')->withoutOverlapping(1);// 更新域名|证书结束时间,每天凌晨1点执行一次 | 32 | // $schedule->command('domain_info')->dailyAt('01:20')->withoutOverlapping(1);// 更新域名|证书结束时间,每天凌晨1点执行一次 |
| 33 | - $schedule->command('share_user')->dailyAt('01:20')->withoutOverlapping(1);// 每天凌晨1点执行一次 | 33 | + $schedule->command('share_user')->dailyAt('01:20')->withoutOverlapping(1);// 每天凌晨1点执行一次 |
| 34 | $schedule->command('last_inquiry')->dailyAt('04:00')->withoutOverlapping(1);// 最近一次询盘信息 | 34 | $schedule->command('last_inquiry')->dailyAt('04:00')->withoutOverlapping(1);// 最近一次询盘信息 |
| 35 | $schedule->command('update_seo_tdk_crontab')->dailyAt('20:00')->withoutOverlapping(1); //更新上线项目TDK | 35 | $schedule->command('update_seo_tdk_crontab')->dailyAt('20:00')->withoutOverlapping(1); //更新上线项目TDK |
| 36 | $schedule->command('sync_manager')->dailyAt('01:00')->withoutOverlapping(1); //TODO::手机号码同步 每天执行一次 | 36 | $schedule->command('sync_manager')->dailyAt('01:00')->withoutOverlapping(1); //TODO::手机号码同步 每天执行一次 |
| @@ -278,7 +278,7 @@ class OptimizeController extends BaseController | @@ -278,7 +278,7 @@ class OptimizeController extends BaseController | ||
| 278 | if(isset($this->map['test_domain']) && !empty($this->map['test_domain'])){ | 278 | if(isset($this->map['test_domain']) && !empty($this->map['test_domain'])){ |
| 279 | $query = $query->where('gl_project_deploy_build.test_domain','like','%'.$this->map['test_domain'].'%'); | 279 | $query = $query->where('gl_project_deploy_build.test_domain','like','%'.$this->map['test_domain'].'%'); |
| 280 | } | 280 | } |
| 281 | - $query = $query->where('gl_project.type',2);//TODO::2,4代表优化项目; 2024-06-05修改项目中台只显示为类型为2 | 281 | + $query = $query->where('gl_project.type',2)->where('gl_project.extend_type','!=',5);//TODO::2,4代表优化项目; 2024-06-05修改项目中台只显示为类型为2 |
| 282 | $query->where(function ($subQuery) { | 282 | $query->where(function ($subQuery) { |
| 283 | $subQuery->orwhere('gl_project_online_check.qa_status',1)->orwhere('gl_project.is_upgrade',1); | 283 | $subQuery->orwhere('gl_project_online_check.qa_status',1)->orwhere('gl_project.is_upgrade',1); |
| 284 | }); | 284 | }); |
| @@ -164,7 +164,11 @@ class ProductController extends BaseController | @@ -164,7 +164,11 @@ class ProductController extends BaseController | ||
| 164 | $query = $query->where('title','like','%'.$this->map['title'].'%'); | 164 | $query = $query->where('title','like','%'.$this->map['title'].'%'); |
| 165 | } | 165 | } |
| 166 | if(isset($this->map['status'])){ | 166 | if(isset($this->map['status'])){ |
| 167 | - $query = $query->where('status',$this->map['status']); | 167 | + if($this->map['status'] == 0){ |
| 168 | + $query = $query->whereIn('status',[0,3]); | ||
| 169 | + }else{ | ||
| 170 | + $query = $query->where('status',$this->map['status']); | ||
| 171 | + } | ||
| 168 | } | 172 | } |
| 169 | if(isset($this->map['created_uid'])){ | 173 | if(isset($this->map['created_uid'])){ |
| 170 | $query = $query->where('created_uid',$this->map['created_uid']); | 174 | $query = $query->where('created_uid',$this->map['created_uid']); |
| @@ -721,4 +725,21 @@ class ProductController extends BaseController | @@ -721,4 +725,21 @@ class ProductController extends BaseController | ||
| 721 | $typeModel->del(['project_id'=>$this->user['project_id'],'name'=>$this->param['name']]); | 725 | $typeModel->del(['project_id'=>$this->user['project_id'],'name'=>$this->param['name']]); |
| 722 | $this->response('success'); | 726 | $this->response('success'); |
| 723 | } | 727 | } |
| 728 | + | ||
| 729 | + /** | ||
| 730 | + * @remark :获取按钮 | ||
| 731 | + * @name :getButton | ||
| 732 | + * @author :lyh | ||
| 733 | + * @method :post | ||
| 734 | + * @time :2024/8/30 16:29 | ||
| 735 | + */ | ||
| 736 | + public function getButton(){ | ||
| 737 | + $data = [ | ||
| 738 | + '0'=>'草稿', | ||
| 739 | + '1'=>'发布', | ||
| 740 | + '2'=>'回收站', | ||
| 741 | + '3'=>'待发布' | ||
| 742 | + ]; | ||
| 743 | + $this->response('success',Code::SUCCESS,$data); | ||
| 744 | + } | ||
| 724 | } | 745 | } |
| @@ -182,6 +182,11 @@ class BlogLogic extends BaseLogic | @@ -182,6 +182,11 @@ class BlogLogic extends BaseLogic | ||
| 182 | }else{ | 182 | }else{ |
| 183 | $param['category_id'] = ''; | 183 | $param['category_id'] = ''; |
| 184 | } | 184 | } |
| 185 | + if(isset($this->param['release_at']) && !empty(($this->param['release_at'])) && ($this->param['status'] == 3)){ | ||
| 186 | + if($this->param['release_at'] < date('Y-m-d 23:59:59')){ | ||
| 187 | + $this->fail('发布时间需大于当天'); | ||
| 188 | + } | ||
| 189 | + } | ||
| 185 | return $this->success($param); | 190 | return $this->success($param); |
| 186 | } | 191 | } |
| 187 | 192 |
| @@ -201,6 +201,11 @@ class NewsLogic extends BaseLogic | @@ -201,6 +201,11 @@ class NewsLogic extends BaseLogic | ||
| 201 | }else{ | 201 | }else{ |
| 202 | $param['category_id'] = ''; | 202 | $param['category_id'] = ''; |
| 203 | } | 203 | } |
| 204 | + if(isset($this->param['release_at']) && !empty(($this->param['release_at'])) && ($this->param['status'] == 3)){ | ||
| 205 | + if($this->param['release_at'] < date('Y-m-d 23:59:59')){ | ||
| 206 | + $this->fail('发布时间需大于当天'); | ||
| 207 | + } | ||
| 208 | + } | ||
| 204 | return $this->success($param); | 209 | return $this->success($param); |
| 205 | } | 210 | } |
| 206 | 211 |
| @@ -315,6 +315,11 @@ class ProductLogic extends BaseLogic | @@ -315,6 +315,11 @@ class ProductLogic extends BaseLogic | ||
| 315 | }else{ | 315 | }else{ |
| 316 | $param['icon'] = Arr::a2s([]); | 316 | $param['icon'] = Arr::a2s([]); |
| 317 | } | 317 | } |
| 318 | + if(isset($this->param['send_time']) && !empty(($this->param['send_time'])) && ($this->param['status'] == 3)){ | ||
| 319 | + if($this->param['send_time'] < date('Y-m-d 23:59:59')){ | ||
| 320 | + $this->fail('发布时间需大于当天'); | ||
| 321 | + } | ||
| 322 | + } | ||
| 318 | $param['created_uid'] = $this->user['id']; | 323 | $param['created_uid'] = $this->user['id']; |
| 319 | return $param; | 324 | return $param; |
| 320 | } | 325 | } |
| @@ -260,6 +260,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -260,6 +260,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 260 | Route::any('/getProductType', [\App\Http\Controllers\Bside\Product\ProductController::class, 'getProductType'])->name('product_getProductType'); | 260 | Route::any('/getProductType', [\App\Http\Controllers\Bside\Product\ProductController::class, 'getProductType'])->name('product_getProductType'); |
| 261 | Route::any('/saveType', [\App\Http\Controllers\Bside\Product\ProductController::class, 'saveType'])->name('product_saveType'); | 261 | Route::any('/saveType', [\App\Http\Controllers\Bside\Product\ProductController::class, 'saveType'])->name('product_saveType'); |
| 262 | Route::any('/delProductType', [\App\Http\Controllers\Bside\Product\ProductController::class, 'delProductType'])->name('product_delProductType'); | 262 | Route::any('/delProductType', [\App\Http\Controllers\Bside\Product\ProductController::class, 'delProductType'])->name('product_delProductType'); |
| 263 | + Route::any('/getButton', [\App\Http\Controllers\Bside\Product\ProductController::class, 'getButton'])->name('product_getButton'); | ||
| 263 | //产品分类 | 264 | //产品分类 |
| 264 | Route::get('category', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'index'])->name('product_category'); | 265 | Route::get('category', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'index'])->name('product_category'); |
| 265 | Route::get('category/info', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'info'])->name('product_category_info'); | 266 | Route::get('category/info', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'info'])->name('product_category_info'); |
-
请 注册 或 登录 后发表评论