Merge remote-tracking branch 'origin/master' into akun
正在显示
44 个修改的文件
包含
484 行增加
和
73 行删除
| @@ -42,7 +42,7 @@ class Count extends Command | @@ -42,7 +42,7 @@ class Count extends Command | ||
| 42 | public function handle() | 42 | public function handle() |
| 43 | { | 43 | { |
| 44 | $list = DB::table('gl_project')->where('gl_project.extend_type','=',0) | 44 | $list = DB::table('gl_project')->where('gl_project.extend_type','=',0) |
| 45 | - ->where('gl_project.type','!=',0)->where('gl_project.delete_status',0) | 45 | + ->where('gl_project.type','!=',0) |
| 46 | ->leftJoin('gl_project_deploy_build', 'gl_project.id', '=', 'gl_project_deploy_build.project_id') | 46 | ->leftJoin('gl_project_deploy_build', 'gl_project.id', '=', 'gl_project_deploy_build.project_id') |
| 47 | ->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id') | 47 | ->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id') |
| 48 | ->select($this->selectParam())->get(); | 48 | ->select($this->selectParam())->get(); |
| @@ -33,7 +33,7 @@ class UpgradeProjectCount extends Command | @@ -33,7 +33,7 @@ class UpgradeProjectCount extends Command | ||
| 33 | protected $description = '升级项目统计'; | 33 | protected $description = '升级项目统计'; |
| 34 | 34 | ||
| 35 | public function handle(){ | 35 | public function handle(){ |
| 36 | - $project_id = 769; | 36 | + $project_id = 528; |
| 37 | ProjectServer::useProject($project_id); | 37 | ProjectServer::useProject($project_id); |
| 38 | $this->count($project_id); | 38 | $this->count($project_id); |
| 39 | DB::disconnect('custom_mysql'); | 39 | DB::disconnect('custom_mysql'); |
| @@ -38,7 +38,7 @@ class InquiryMonthlyCount extends Command | @@ -38,7 +38,7 @@ class InquiryMonthlyCount extends Command | ||
| 38 | */ | 38 | */ |
| 39 | public function handle(){ | 39 | public function handle(){ |
| 40 | $list = DB::table('gl_project')->where('gl_project.extend_type','=',0) | 40 | $list = DB::table('gl_project')->where('gl_project.extend_type','=',0) |
| 41 | - ->where('gl_project.type','!=',0)->where('gl_project.delete_status',0) | 41 | + ->where('gl_project.type','!=',0) |
| 42 | ->leftJoin('gl_project_deploy_build', 'gl_project.id', '=', 'gl_project_deploy_build.project_id') | 42 | ->leftJoin('gl_project_deploy_build', 'gl_project.id', '=', 'gl_project_deploy_build.project_id') |
| 43 | ->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id') | 43 | ->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id') |
| 44 | ->select($this->selectParam())->get()->toArray(); | 44 | ->select($this->selectParam())->get()->toArray(); |
| @@ -36,7 +36,7 @@ class UpgradeProjectCount extends Command | @@ -36,7 +36,7 @@ class UpgradeProjectCount extends Command | ||
| 36 | protected $description = '升级项目统计'; | 36 | protected $description = '升级项目统计'; |
| 37 | 37 | ||
| 38 | public function handle(){ | 38 | public function handle(){ |
| 39 | - $project_id = 769; | 39 | + $project_id = 528; |
| 40 | $oldModel = new UpdateOldInfo(); | 40 | $oldModel = new UpdateOldInfo(); |
| 41 | $info = $oldModel->read(['project_id'=>$project_id]); | 41 | $info = $oldModel->read(['project_id'=>$project_id]); |
| 42 | $url = $info['old_domain_online']; | 42 | $url = $info['old_domain_online']; |
| @@ -40,7 +40,7 @@ class RecommDomain extends BaseCommands | @@ -40,7 +40,7 @@ class RecommDomain extends BaseCommands | ||
| 40 | 40 | ||
| 41 | foreach ($list as $item) { | 41 | foreach ($list as $item) { |
| 42 | $rankDataLogic = new RankDataLogic(); | 42 | $rankDataLogic = new RankDataLogic(); |
| 43 | - $rankDataLogic->syncExternalLinks($item['api_no']); | 43 | + $rankDataLogic->syncRecommDomain($item['api_no']); |
| 44 | } | 44 | } |
| 45 | return true; | 45 | return true; |
| 46 | } | 46 | } |
app/Console/Commands/ServiceCount.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :ServiceCount.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2024/1/29 15:29 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Console\Commands; | ||
| 11 | + | ||
| 12 | +use App\Models\Devops\ServerConfig; | ||
| 13 | +use App\Models\Project\Project; | ||
| 14 | +use Illuminate\Console\Command; | ||
| 15 | + | ||
| 16 | +class ServiceCount extends Command | ||
| 17 | +{ | ||
| 18 | + /** | ||
| 19 | + * The name and signature of the console command. | ||
| 20 | + * | ||
| 21 | + * @var string | ||
| 22 | + */ | ||
| 23 | + protected $signature = 'service_count'; | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * The console command description. | ||
| 27 | + * | ||
| 28 | + * @var string | ||
| 29 | + */ | ||
| 30 | + protected $description = '服务器数据库使用统计'; | ||
| 31 | + | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * @remark :执行脚本 | ||
| 35 | + * @name :handle | ||
| 36 | + * @author :lyh | ||
| 37 | + * @method :post | ||
| 38 | + * @time :2024/1/29 15:31 | ||
| 39 | + */ | ||
| 40 | + public function handle(){ | ||
| 41 | + return $this->serverConfigCount(); | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * @remark :域名统计统计 | ||
| 46 | + * @name :domainCount | ||
| 47 | + * @author :lyh | ||
| 48 | + * @method :post | ||
| 49 | + * @time :2024/1/29 15:33 | ||
| 50 | + */ | ||
| 51 | + public function serverConfigCount(){ | ||
| 52 | + $model = new ServerConfig(); | ||
| 53 | + $list = $model->list(); | ||
| 54 | + $projectModel = new Project(); | ||
| 55 | + foreach ($list as $v){ | ||
| 56 | + if($v['type'] == 1){ | ||
| 57 | + $count = $projectModel->formatQuery(['serve_id'=>$v['id']])->count(); | ||
| 58 | + //服务器 | ||
| 59 | + }else{ | ||
| 60 | + $count = $projectModel->formatQuery(['mysql_id'=>$v['id']])->count(); | ||
| 61 | + //数据库 | ||
| 62 | + } | ||
| 63 | + $model->edit(['count'=>$count],['id'=>$v['id']]); | ||
| 64 | + } | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | +} |
| @@ -50,7 +50,7 @@ class UpdateProductCategory extends Command | @@ -50,7 +50,7 @@ class UpdateProductCategory extends Command | ||
| 50 | public function handle(){ | 50 | public function handle(){ |
| 51 | //获取所有项目 | 51 | //获取所有项目 |
| 52 | $projectModel = new Project(); | 52 | $projectModel = new Project(); |
| 53 | - $list = $projectModel->list(['id'=>['in',[218]]],'id',['id']); | 53 | + $list = $projectModel->list(['id'=>['in',[302]]],'id',['id']); |
| 54 | echo date('Y-m-d H:i:s') . ' start: ' . json_encode($list) . PHP_EOL; | 54 | echo date('Y-m-d H:i:s') . ' start: ' . json_encode($list) . PHP_EOL; |
| 55 | try { | 55 | try { |
| 56 | foreach ($list as $v) { | 56 | foreach ($list as $v) { |
| @@ -55,19 +55,12 @@ class UpdateRoute extends Command | @@ -55,19 +55,12 @@ class UpdateRoute extends Command | ||
| 55 | */ | 55 | */ |
| 56 | public function handle(){ | 56 | public function handle(){ |
| 57 | $projectModel = new Project(); | 57 | $projectModel = new Project(); |
| 58 | - $list = $projectModel->list(['id'=>206]); | 58 | + $list = $projectModel->list(['is_upgrade'=>0,'delete_status'=>0,'id'=>['<',500]]); |
| 59 | $data = []; | 59 | $data = []; |
| 60 | foreach ($list as $v){ | 60 | foreach ($list as $v){ |
| 61 | 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; |
| 62 | ProjectServer::useProject($v['id']); | 62 | ProjectServer::useProject($v['id']); |
| 63 | -// $this->delProductKeyword(); | ||
| 64 | -// $this->checkProduct($data,$v['id']); | ||
| 65 | -// $this->getProduct(); | ||
| 66 | $this->setProductKeyword(); | 63 | $this->setProductKeyword(); |
| 67 | -// $this->getRouteMap(); | ||
| 68 | -// $this->getProductCategory(); | ||
| 69 | -// $this->delRouteMap(); | ||
| 70 | -// $this->setCustomRoute($v['id']); | ||
| 71 | DB::disconnect('custom_mysql'); | 64 | DB::disconnect('custom_mysql'); |
| 72 | } | 65 | } |
| 73 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; | 66 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; |
| @@ -128,13 +121,12 @@ class UpdateRoute extends Command | @@ -128,13 +121,12 @@ class UpdateRoute extends Command | ||
| 128 | // $keywordModel->edit(['route'=>$route],['id'=>$v['id']]); | 121 | // $keywordModel->edit(['route'=>$route],['id'=>$v['id']]); |
| 129 | // } | 122 | // } |
| 130 | }else{ | 123 | }else{ |
| 131 | - echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL; | ||
| 132 | $route = Translate::tran($v['title'], 'en'); | 124 | $route = Translate::tran($v['title'], 'en'); |
| 133 | echo date('Y-m-d H:i:s') . 'route :'.$route . PHP_EOL; | 125 | echo date('Y-m-d H:i:s') . 'route :'.$route . PHP_EOL; |
| 134 | $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']); | 126 | $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']); |
| 135 | $keywordModel->edit(['route'=>$route],['id'=>$v['id']]); | 127 | $keywordModel->edit(['route'=>$route],['id'=>$v['id']]); |
| 136 | } | 128 | } |
| 137 | - echo date('Y-m-d H:i:s') . 'end :' . PHP_EOL; | 129 | +// echo date('Y-m-d H:i:s') . 'end :' . PHP_EOL; |
| 138 | } | 130 | } |
| 139 | } | 131 | } |
| 140 | } | 132 | } |
| @@ -178,6 +178,43 @@ class WebTraffic extends Command | @@ -178,6 +178,43 @@ class WebTraffic extends Command | ||
| 178 | } | 178 | } |
| 179 | //随机访问ip | 179 | //随机访问ip |
| 180 | $ips = $this->getIpAreas(count($need_project)); | 180 | $ips = $this->getIpAreas(count($need_project)); |
| 181 | + | ||
| 182 | + //特殊日期 降访问率 | ||
| 183 | + foreach ($need_project as $project_key => $project){ | ||
| 184 | + $diff = $ips[$project_key]['diff']; | ||
| 185 | + //当地时间 | ||
| 186 | + $w = date('w', strtotime($diff . 'hour')); | ||
| 187 | + $date = date('m-d', strtotime($diff . 'hour')); | ||
| 188 | + //元旦节和圣诞节按照周六的比例处理 | ||
| 189 | + if(in_array($date, ['01-01', '12-25'])){ | ||
| 190 | + $w = 6; | ||
| 191 | + } | ||
| 192 | + switch ($w){ | ||
| 193 | + case 0: | ||
| 194 | + //周日降70-80% | ||
| 195 | + $rate = rand(70, 80) * 10; | ||
| 196 | + $res = $this->get_rand([1000-$rate, $rate]); | ||
| 197 | + break; | ||
| 198 | + case 5: | ||
| 199 | + //周5降30-40% | ||
| 200 | + $rate = rand(30, 40) * 10; | ||
| 201 | + $res = $this->get_rand([1000-$rate, $rate]); | ||
| 202 | + break; | ||
| 203 | + case 6: | ||
| 204 | + //周6降60-70% | ||
| 205 | + $rate = rand(60, 70) * 10; | ||
| 206 | + $res = $this->get_rand([1000-$rate, $rate]); | ||
| 207 | + break; | ||
| 208 | + default: | ||
| 209 | + $res = 0; | ||
| 210 | + } | ||
| 211 | + //不访问 | ||
| 212 | + if($res == 1){ | ||
| 213 | + unset($need_project[$project_key]); | ||
| 214 | + unset($ips[$project_key]); | ||
| 215 | + } | ||
| 216 | + } | ||
| 217 | + | ||
| 181 | //最多10层深度 | 218 | //最多10层深度 |
| 182 | $client = new Client(['verify' => false]); | 219 | $client = new Client(['verify' => false]); |
| 183 | for ($j = 0; $j < 10; $j++) { | 220 | for ($j = 0; $j < 10; $j++) { |
| @@ -314,6 +351,7 @@ class WebTraffic extends Command | @@ -314,6 +351,7 @@ class WebTraffic extends Command | ||
| 314 | $h = date('H'); | 351 | $h = date('H'); |
| 315 | $areas = []; | 352 | $areas = []; |
| 316 | $list = DB::table('gl_area_timezone')->get(); | 353 | $list = DB::table('gl_area_timezone')->get(); |
| 354 | + $time_zones = []; | ||
| 317 | foreach ($list as $v) { | 355 | foreach ($list as $v) { |
| 318 | $v = (array)$v; | 356 | $v = (array)$v; |
| 319 | $country_hour = $h + $v['diff']; | 357 | $country_hour = $h + $v['diff']; |
| @@ -322,11 +360,16 @@ class WebTraffic extends Command | @@ -322,11 +360,16 @@ class WebTraffic extends Command | ||
| 322 | } | 360 | } |
| 323 | if ($country_hour >= 7 && $country_hour < 23) { | 361 | if ($country_hour >= 7 && $country_hour < 23) { |
| 324 | $areas[] = $v['name']; | 362 | $areas[] = $v['name']; |
| 363 | + $time_zones[$v['name']] = $v['diff']; | ||
| 325 | } | 364 | } |
| 326 | } | 365 | } |
| 327 | //根据地区随机取该地区的IP | 366 | //根据地区随机取该地区的IP |
| 328 | $data = DB::table('gl_xunpan_ipdata')->whereIn('ip_area', $areas)->inRandomOrder()->limit($num)->get(); | 367 | $data = DB::table('gl_xunpan_ipdata')->whereIn('ip_area', $areas)->inRandomOrder()->limit($num)->get(); |
| 329 | - return Arr::s2a(Arr::a2s($data)); | 368 | + $data = Arr::s2a(Arr::a2s($data)); |
| 369 | + foreach ($data as &$item){ | ||
| 370 | + $item['diff'] = $time_zones[$item['ip_area']]; | ||
| 371 | + } | ||
| 372 | + return $data; | ||
| 330 | } | 373 | } |
| 331 | 374 | ||
| 332 | /** | 375 | /** |
| @@ -26,6 +26,7 @@ class Kernel extends ConsoleKernel | @@ -26,6 +26,7 @@ class Kernel extends ConsoleKernel | ||
| 26 | $schedule->command('rank_data_week')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据,每周一凌晨执行一次 | 26 | $schedule->command('rank_data_week')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据,每周一凌晨执行一次 |
| 27 | // $schedule->command('share_user')->dailyAt('01:00')->withoutOverlapping(1); // 清除用户ayr_share数据,每天凌晨1点执行一次 | 27 | // $schedule->command('share_user')->dailyAt('01:00')->withoutOverlapping(1); // 清除用户ayr_share数据,每天凌晨1点执行一次 |
| 28 | $schedule->command('count')->dailyAt('01:00')->withoutOverlapping(1); //每天凌晨1点执行一次 | 28 | $schedule->command('count')->dailyAt('01:00')->withoutOverlapping(1); //每天凌晨1点执行一次 |
| 29 | + $schedule->command('service_count')->dailyAt('01:00')->withoutOverlapping(1); //服务器使用情况,每天凌晨1点执行一次 | ||
| 29 | $schedule->command('web_traffic 1')->everyThirtyMinutes(); // 引流 1-3个月的项目,半小时一次 | 30 | $schedule->command('web_traffic 1')->everyThirtyMinutes(); // 引流 1-3个月的项目,半小时一次 |
| 30 | $schedule->command('web_traffic 2')->cron('*/18 * * * *'); // 引流 4-8个月的项目,18分钟一次 | 31 | $schedule->command('web_traffic 2')->cron('*/18 * * * *'); // 引流 4-8个月的项目,18分钟一次 |
| 31 | $schedule->command('web_traffic 3')->cron('*/12 * * * *'); // 引流 大于9个月的项目,12分钟一次 | 32 | $schedule->command('web_traffic 3')->cron('*/12 * * * *'); // 引流 大于9个月的项目,12分钟一次 |
| @@ -100,12 +100,17 @@ if (!function_exists('http_get')) { | @@ -100,12 +100,17 @@ if (!function_exists('http_get')) { | ||
| 100 | curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true); | 100 | curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true); |
| 101 | curl_setopt($ch1, CURLOPT_ENCODING, ''); | 101 | curl_setopt($ch1, CURLOPT_ENCODING, ''); |
| 102 | curl_setopt($ch1, CURLOPT_MAXREDIRS, 10); | 102 | curl_setopt($ch1, CURLOPT_MAXREDIRS, 10); |
| 103 | + curl_setopt($ch1, CURLOPT_TIMEOUT, 120); | ||
| 103 | curl_setopt($ch1, CURLOPT_HTTPHEADER, $header); | 104 | curl_setopt($ch1, CURLOPT_HTTPHEADER, $header); |
| 104 | curl_setopt($ch1, CURLOPT_CONNECTTIMEOUT, $timeout); | 105 | curl_setopt($ch1, CURLOPT_CONNECTTIMEOUT, $timeout); |
| 105 | curl_setopt($ch1, CURLOPT_FOLLOWLOCATION, true); | 106 | curl_setopt($ch1, CURLOPT_FOLLOWLOCATION, true); |
| 106 | curl_setopt($ch1, CURLOPT_CUSTOMREQUEST, 'GET'); | 107 | curl_setopt($ch1, CURLOPT_CUSTOMREQUEST, 'GET'); |
| 107 | curl_setopt($ch1, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); | 108 | curl_setopt($ch1, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); |
| 108 | $access_txt = curl_exec($ch1); | 109 | $access_txt = curl_exec($ch1); |
| 110 | + if (curl_errno($ch1)) { | ||
| 111 | + $error_message = curl_error($ch1); | ||
| 112 | + @file_put_contents(storage_path('logs/lyh_error.log'), var_export($error_message, true) . PHP_EOL, FILE_APPEND); | ||
| 113 | + } | ||
| 109 | curl_close($ch1); | 114 | curl_close($ch1); |
| 110 | return json_decode($access_txt, true); | 115 | return json_decode($access_txt, true); |
| 111 | } | 116 | } |
| @@ -7,7 +7,10 @@ | @@ -7,7 +7,10 @@ | ||
| 7 | */ | 7 | */ |
| 8 | namespace App\Http\Controllers\Api; | 8 | namespace App\Http\Controllers\Api; |
| 9 | 9 | ||
| 10 | +use App\Enums\Common\Code; | ||
| 10 | use App\Http\Controllers\Controller; | 11 | use App\Http\Controllers\Controller; |
| 12 | +use Illuminate\Http\Exceptions\HttpResponseException; | ||
| 13 | +use Illuminate\Http\JsonResponse; | ||
| 11 | 14 | ||
| 12 | /** | 15 | /** |
| 13 | * Class BaseController | 16 | * Class BaseController |
| @@ -38,4 +41,23 @@ class BaseController extends Controller | @@ -38,4 +41,23 @@ class BaseController extends Controller | ||
| 38 | $array = compact('status', 'message', 'data'); | 41 | $array = compact('status', 'message', 'data'); |
| 39 | return json_encode($array, JSON_UNESCAPED_UNICODE); | 42 | return json_encode($array, JSON_UNESCAPED_UNICODE); |
| 40 | } | 43 | } |
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * @name :统一返回参数 | ||
| 47 | + * @return JsonResponse | ||
| 48 | + * @author :liyuhang | ||
| 49 | + * @method | ||
| 50 | + */ | ||
| 51 | + public function response($msg = null,string $code = Code::SUCCESS,$data = [],$result_code = 200,$type = 'application/json'): JsonResponse | ||
| 52 | + { | ||
| 53 | + $code = Code::fromValue($code); | ||
| 54 | + $result = [ | ||
| 55 | + 'code' => $code->value, | ||
| 56 | + 'data' => $data, | ||
| 57 | + 'message' => $msg == ' ' ? $code->description : $msg, | ||
| 58 | + ]; | ||
| 59 | + $header['Content-Type'] = $type; | ||
| 60 | + $response = response($result,$result_code,$header); | ||
| 61 | + throw new HttpResponseException($response); | ||
| 62 | + } | ||
| 41 | } | 63 | } |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Controllers\Api; | ||
| 4 | + | ||
| 5 | +use App\Enums\Common\Code; | ||
| 6 | +use App\Models\Product\Product; | ||
| 7 | +use App\Services\ProjectServer; | ||
| 8 | +use App\Utils\LogUtils; | ||
| 9 | +use Illuminate\Http\Request; | ||
| 10 | +use Illuminate\Support\Arr; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * Class ProductController | ||
| 14 | + * @package App\Http\Controllers\Api | ||
| 15 | + * @author zbj | ||
| 16 | + * @date 2024/2/1 | ||
| 17 | + */ | ||
| 18 | +class ProductController extends BaseController | ||
| 19 | +{ | ||
| 20 | + /** | ||
| 21 | + * 获取项目随机产品的图片 | ||
| 22 | + * @param Request $request | ||
| 23 | + * @return void | ||
| 24 | + */ | ||
| 25 | + public function getImages(Request $request) | ||
| 26 | + { | ||
| 27 | + $project_id = $request->input('project_id'); | ||
| 28 | + | ||
| 29 | + $project = ProjectServer::useProject($project_id); | ||
| 30 | + if (!$project) { | ||
| 31 | + $this->response('项目不存在', Code::SYSTEM_ERROR); | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + try { | ||
| 35 | + $gallery = Product::where('status', Product::STATUS_ON)->whereNotNull('gallery')->inRandomOrder()->value('gallery'); | ||
| 36 | + $gallery = array_map(function ($item) use ($project) { | ||
| 37 | + return getImageUrl($item, $project['storage_type'], $project['project_location']); | ||
| 38 | + }, Arr::pluck($gallery, 'url')); | ||
| 39 | + } catch (\Exception $e) { | ||
| 40 | + LogUtils::error('Project Id: ' . $project_id . ' getProductImages error:' . $e->getMessage()); | ||
| 41 | + $gallery = []; | ||
| 42 | + } | ||
| 43 | + $this->response('success', Code::SUCCESS, $gallery); | ||
| 44 | + } | ||
| 45 | +} |
| @@ -125,6 +125,9 @@ class ProjectController extends BaseController | @@ -125,6 +125,9 @@ class ProjectController extends BaseController | ||
| 125 | $query->whereIn('gl_project.type', [Project::TYPE_FOUR,Project::TYPE_SIX]); | 125 | $query->whereIn('gl_project.type', [Project::TYPE_FOUR,Project::TYPE_SIX]); |
| 126 | } | 126 | } |
| 127 | } | 127 | } |
| 128 | + if(isset($this->map['uptime']) && is_array($this->map['uptime'])){ | ||
| 129 | + $query->whereBetween('gl_project.uptime', $this->map['uptime']); | ||
| 130 | + } | ||
| 128 | return $query; | 131 | return $query; |
| 129 | } | 132 | } |
| 130 | 133 | ||
| @@ -153,6 +156,7 @@ class ProjectController extends BaseController | @@ -153,6 +156,7 @@ class ProjectController extends BaseController | ||
| 153 | 'gl_project.channel AS channel', | 156 | 'gl_project.channel AS channel', |
| 154 | 'gl_project.company AS company', | 157 | 'gl_project.company AS company', |
| 155 | 'gl_project.type AS type', | 158 | 'gl_project.type AS type', |
| 159 | + 'gl_project.is_upgrade AS is_upgrade', | ||
| 156 | 'gl_project.created_at AS created_at', | 160 | 'gl_project.created_at AS created_at', |
| 157 | 'gl_project.cooperate_date AS cooperate_date', | 161 | 'gl_project.cooperate_date AS cooperate_date', |
| 158 | 'gl_project_online_check.id AS online_check_id', | 162 | 'gl_project_online_check.id AS online_check_id', |
| @@ -27,8 +27,6 @@ class ATemplateModuleController extends BaseController | @@ -27,8 +27,6 @@ class ATemplateModuleController extends BaseController | ||
| 27 | public function lists(ATemplateModuleLogic $ATemplateModuleLogic){ | 27 | public function lists(ATemplateModuleLogic $ATemplateModuleLogic){ |
| 28 | if(isset($this->map['type']) && ($this->map['type'] == 99)){ | 28 | if(isset($this->map['type']) && ($this->map['type'] == 99)){ |
| 29 | $this->map['type'] = 99; | 29 | $this->map['type'] = 99; |
| 30 | - }else{ | ||
| 31 | - $this->map['project_id'] = 0; | ||
| 32 | } | 30 | } |
| 33 | $lists = $ATemplateModuleLogic->aTemplateModuleLists($this->map,$this->page,$this->row,$this->order); | 31 | $lists = $ATemplateModuleLogic->aTemplateModuleLists($this->map,$this->page,$this->row,$this->order); |
| 34 | $this->response('success',Code::SUCCESS,$lists); | 32 | $this->response('success',Code::SUCCESS,$lists); |
| @@ -69,20 +69,28 @@ class AyrReleaseController extends BaseController | @@ -69,20 +69,28 @@ class AyrReleaseController extends BaseController | ||
| 69 | } | 69 | } |
| 70 | //参数处理 | 70 | //参数处理 |
| 71 | $this->param['mediaUrls'] = $ayrReleaseLogic->image_file_param($data); | 71 | $this->param['mediaUrls'] = $ayrReleaseLogic->image_file_param($data); |
| 72 | - //时间处理 | ||
| 73 | - $datetime = new \DateTime($this->param['schedule_date'] ?? date('Y-m-d H:i:s')); | ||
| 74 | - $formattedTime = $datetime->format("Y-m-d\TH:i:s\Z"); | ||
| 75 | - //统一生成发布 | ||
| 76 | $param = [ | 72 | $param = [ |
| 77 | 'post'=>$this->param['content'], | 73 | 'post'=>$this->param['content'], |
| 78 | 'platforms'=>$this->param['platforms'], | 74 | 'platforms'=>$this->param['platforms'], |
| 79 | 'mediaUrls'=>$this->param['mediaUrls'],//参数处理 | 75 | 'mediaUrls'=>$this->param['mediaUrls'],//参数处理 |
| 80 | - 'scheduleDate'=>$formattedTime,//时间(如是过去时间,立即发布) | ||
| 81 | ]; | 76 | ]; |
| 77 | + //统一生成发布 | ||
| 78 | + foreach ($this->param['platforms'] as $value){ | ||
| 79 | + if($value == 'youtube'){ | ||
| 80 | + $param['youTubeOptions'] = ['title'=>$this->param['title']]; | ||
| 81 | + } | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + if(isset($this->param['schedule_date']) && !empty($this->param['schedule_date'])){ | ||
| 85 | + $datetime = new \DateTime($this->param['schedule_date'] ?? date('Y-m-d H:i:s')); | ||
| 86 | + $formattedTime = $datetime->format("Y-m-d\TH:i:s\Z"); | ||
| 87 | + $param['scheduleDate'] = $formattedTime;//时间(如是过去时间,立即发布) | ||
| 88 | + } | ||
| 82 | //发送请求发布社交文章 | 89 | //发送请求发布社交文章 |
| 83 | $res = $ayrShare->post_send_msg($param,$share_info['profile_key']); | 90 | $res = $ayrShare->post_send_msg($param,$share_info['profile_key']); |
| 84 | //保存数据库 | 91 | //保存数据库 |
| 85 | - $ayrReleaseLogic->release_add(); | 92 | + $ayrReleaseLogic->release_add($res); |
| 93 | + //保存返回的内容 | ||
| 86 | $this->response('success',Code::SUCCESS,json_decode($res)); | 94 | $this->response('success',Code::SUCCESS,json_decode($res)); |
| 87 | } | 95 | } |
| 88 | 96 |
| @@ -12,7 +12,10 @@ namespace App\Http\Controllers\Bside\CustomModule; | @@ -12,7 +12,10 @@ namespace App\Http\Controllers\Bside\CustomModule; | ||
| 12 | use App\Enums\Common\Code; | 12 | use App\Enums\Common\Code; |
| 13 | use App\Http\Controllers\Bside\BaseController; | 13 | use App\Http\Controllers\Bside\BaseController; |
| 14 | use App\Http\Logic\Bside\CustomModule\CustomModuleCategoryLogic; | 14 | use App\Http\Logic\Bside\CustomModule\CustomModuleCategoryLogic; |
| 15 | +use App\Models\CustomModule\CustomModule; | ||
| 15 | use App\Models\CustomModule\CustomModuleCategory; | 16 | use App\Models\CustomModule\CustomModuleCategory; |
| 17 | +use App\Models\Template\BTemplate; | ||
| 18 | +use App\Models\Template\Setting; | ||
| 16 | use App\Models\User\User; | 19 | use App\Models\User\User; |
| 17 | 20 | ||
| 18 | class CustomModuleCategoryController extends BaseController | 21 | class CustomModuleCategoryController extends BaseController |
| @@ -34,7 +37,9 @@ class CustomModuleCategoryController extends BaseController | @@ -34,7 +37,9 @@ class CustomModuleCategoryController extends BaseController | ||
| 34 | $this->map['status'] = 0; | 37 | $this->map['status'] = 0; |
| 35 | $list = $customModuleCategory->list($this->map,'sort'); | 38 | $list = $customModuleCategory->list($this->map,'sort'); |
| 36 | if(!empty($list)){ | 39 | if(!empty($list)){ |
| 40 | + $template_id = $this->getModuleTemplateId($this->param['module_id']); | ||
| 37 | foreach ($list as $k => $v){ | 41 | foreach ($list as $k => $v){ |
| 42 | + $v['is_renovation'] = $this->getIsRenovation($v['module_id'],BTemplate::IS_LIST,$template_id,$v['id'],BTemplate::IS_CUSTOM); | ||
| 38 | $v['url'] = $this->user['domain'].$v['route']; | 43 | $v['url'] = $this->user['domain'].$v['route']; |
| 39 | $list[$k] = $v; | 44 | $list[$k] = $v; |
| 40 | } | 45 | } |
| @@ -44,6 +49,25 @@ class CustomModuleCategoryController extends BaseController | @@ -44,6 +49,25 @@ class CustomModuleCategoryController extends BaseController | ||
| 44 | } | 49 | } |
| 45 | 50 | ||
| 46 | /** | 51 | /** |
| 52 | + * @remark :扩展模块获取模版id | ||
| 53 | + * @name :getTemplateId | ||
| 54 | + * @author :lyh | ||
| 55 | + * @method :post | ||
| 56 | + * @time :2024/1/31 16:47 | ||
| 57 | + */ | ||
| 58 | + public function getModuleTemplateId($module_id){ | ||
| 59 | + $template_id = 0; | ||
| 60 | + $moduleModel = new CustomModule(); | ||
| 61 | + $info = $moduleModel->read(['id'=>$module_id]); | ||
| 62 | + if($info['list_customized'] != 1){ | ||
| 63 | + $bSettingModel = new Setting(); | ||
| 64 | + $info = $bSettingModel->read(['project_id'=>$this->user['project_id']]); | ||
| 65 | + $template_id = $info['template_id']; | ||
| 66 | + } | ||
| 67 | + return $this->success($template_id); | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + /** | ||
| 47 | * @remark :无分页子集处理 | 71 | * @remark :无分页子集处理 |
| 48 | * @name :getListSon | 72 | * @name :getListSon |
| 49 | * @author :lyh | 73 | * @author :lyh |
| @@ -12,9 +12,12 @@ namespace App\Http\Controllers\Bside\CustomModule; | @@ -12,9 +12,12 @@ namespace App\Http\Controllers\Bside\CustomModule; | ||
| 12 | use App\Enums\Common\Code; | 12 | use App\Enums\Common\Code; |
| 13 | use App\Http\Controllers\Bside\BaseController; | 13 | use App\Http\Controllers\Bside\BaseController; |
| 14 | use App\Http\Logic\Bside\CustomModule\CustomModuleContentLogic; | 14 | use App\Http\Logic\Bside\CustomModule\CustomModuleContentLogic; |
| 15 | +use App\Models\CustomModule\CustomModule; | ||
| 15 | use App\Models\CustomModule\CustomModuleCategory; | 16 | use App\Models\CustomModule\CustomModuleCategory; |
| 16 | use App\Models\CustomModule\CustomModuleContent; | 17 | use App\Models\CustomModule\CustomModuleContent; |
| 17 | use App\Models\RouteMap\RouteMap; | 18 | use App\Models\RouteMap\RouteMap; |
| 19 | +use App\Models\Template\BTemplate; | ||
| 20 | +use App\Models\Template\Setting; | ||
| 18 | use App\Models\User\User; | 21 | use App\Models\User\User; |
| 19 | 22 | ||
| 20 | class CustomModuleContentController extends BaseController | 23 | class CustomModuleContentController extends BaseController |
| @@ -35,12 +38,14 @@ class CustomModuleContentController extends BaseController | @@ -35,12 +38,14 @@ class CustomModuleContentController extends BaseController | ||
| 35 | $this->map['project_id'] = $this->user['project_id']; | 38 | $this->map['project_id'] = $this->user['project_id']; |
| 36 | $lists = $customModuleContent->lists($this->map,$this->page,$this->row,$this->order = ['sort','id']); | 39 | $lists = $customModuleContent->lists($this->map,$this->page,$this->row,$this->order = ['sort','id']); |
| 37 | if(!empty($lists)){ | 40 | if(!empty($lists)){ |
| 41 | + $template_id = $this->getModuleTemplateId($this->param['module_id']); | ||
| 38 | $data = $this->getAllCategoryName(); | 42 | $data = $this->getAllCategoryName(); |
| 39 | foreach ($lists['list'] as $k=>$v){ | 43 | foreach ($lists['list'] as $k=>$v){ |
| 40 | $v['url'] = $this->getUrl($v); | 44 | $v['url'] = $this->getUrl($v); |
| 45 | + $v = $this->getHandleImageFile($v); | ||
| 41 | $v['category_name'] = $this->categoryName($v['category_id'],$data); | 46 | $v['category_name'] = $this->categoryName($v['category_id'],$data); |
| 42 | - $v['image_link'] = getImageUrl($v['image'],$this->user['storage_type'],$this->user['project_location']); | ||
| 43 | $v['operator_name'] = (new User())->getName($v['operator_id']); | 47 | $v['operator_name'] = (new User())->getName($v['operator_id']); |
| 48 | + $v['is_renovation'] = $this->getIsRenovation($v['module_id'],BTemplate::IS_DETAIL,$template_id,$v['id'],BTemplate::IS_CUSTOM); | ||
| 44 | $lists['list'][$k] = $v; | 49 | $lists['list'][$k] = $v; |
| 45 | } | 50 | } |
| 46 | } | 51 | } |
| @@ -48,6 +53,43 @@ class CustomModuleContentController extends BaseController | @@ -48,6 +53,43 @@ class CustomModuleContentController extends BaseController | ||
| 48 | } | 53 | } |
| 49 | 54 | ||
| 50 | /** | 55 | /** |
| 56 | + * @remark :扩展模块获取模版id | ||
| 57 | + * @name :getTemplateId | ||
| 58 | + * @author :lyh | ||
| 59 | + * @method :post | ||
| 60 | + * @time :2024/1/31 16:47 | ||
| 61 | + */ | ||
| 62 | + public function getModuleTemplateId($module_id){ | ||
| 63 | + $template_id = 0; | ||
| 64 | + $moduleModel = new CustomModule(); | ||
| 65 | + $info = $moduleModel->read(['id'=>$module_id]); | ||
| 66 | + if($info['detail_customized'] != 1){ | ||
| 67 | + $bSettingModel = new Setting(); | ||
| 68 | + $info = $bSettingModel->read(['project_id'=>$this->user['project_id']]); | ||
| 69 | + $template_id = $info['template_id']; | ||
| 70 | + } | ||
| 71 | + return $this->success($template_id); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + /** | ||
| 75 | + * @remark :获取时处理视频,图片,文件 | ||
| 76 | + * @name :getHandleImageFile | ||
| 77 | + * @author :lyh | ||
| 78 | + * @method :post | ||
| 79 | + * @time :2024/1/31 15:48 | ||
| 80 | + */ | ||
| 81 | + public function getHandleImageFile($v){ | ||
| 82 | + if(!empty($v['image'])){ | ||
| 83 | + $v['image_link'] = getImageUrl($v['image'],$this->user['storage_type'] ?? 0,$this->user['project_location']); | ||
| 84 | + } | ||
| 85 | + if(!empty($v['video'])){ | ||
| 86 | + $v['video']['url'] = getFileUrl($v['video']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location']); | ||
| 87 | + $v['video']['video_image'] = getImageUrl($v['video']['video_image'],$this->user['storage_type'] ?? 0,$this->user['project_location']); | ||
| 88 | + } | ||
| 89 | + return $this->success($v); | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + /** | ||
| 51 | * @remark :获取连接 | 93 | * @remark :获取连接 |
| 52 | * @name :getUrl | 94 | * @name :getUrl |
| 53 | * @author :lyh | 95 | * @author :lyh |
| @@ -141,6 +183,7 @@ class CustomModuleContentController extends BaseController | @@ -141,6 +183,7 @@ class CustomModuleContentController extends BaseController | ||
| 141 | 'id.required' => 'ID不能为空', | 183 | 'id.required' => 'ID不能为空', |
| 142 | ]); | 184 | ]); |
| 143 | $info = $logic->getContentInfo(); | 185 | $info = $logic->getContentInfo(); |
| 186 | + $info = $this->getHandleImageFile($info); | ||
| 144 | $this->response('success',Code::SUCCESS,$info); | 187 | $this->response('success',Code::SUCCESS,$info); |
| 145 | } | 188 | } |
| 146 | 189 |
| @@ -313,7 +313,7 @@ class NewsController extends BaseController | @@ -313,7 +313,7 @@ class NewsController extends BaseController | ||
| 313 | ],[ | 313 | ],[ |
| 314 | 'keyword.required' => 'keyword不能为空', | 314 | 'keyword.required' => 'keyword不能为空', |
| 315 | ]); | 315 | ]); |
| 316 | - $data = http_get('http://gnews.globalso.com/gnews_news.php?keyword='.$this->param['keyword']); | 316 | + $data = http_get('http://gnews.globalso.com/gnews_news.php?keyword='.$this->param['keyword'],['charset=utf-8']); |
| 317 | $this->response('success',Code::SUCCESS,$data); | 317 | $this->response('success',Code::SUCCESS,$data); |
| 318 | } | 318 | } |
| 319 | } | 319 | } |
| @@ -40,7 +40,7 @@ class CategoryController extends BaseController | @@ -40,7 +40,7 @@ class CategoryController extends BaseController | ||
| 40 | $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST);//获取模版id | 40 | $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST);//获取模版id |
| 41 | foreach ($list as $k =>$v){ | 41 | foreach ($list as $k =>$v){ |
| 42 | $v['url'] = $this->user['domain'] . $v['route'].'/'; | 42 | $v['url'] = $this->user['domain'] . $v['route'].'/'; |
| 43 | - $v['product_num'] = Category::getProductNum($v['id']); | 43 | + $v['product_num'] = $category->getProductNum($list,$v['id']); |
| 44 | $v['image_link'] = getImageUrl($v['image'],$this->user['storage_type'],$this->user['project_location']); | 44 | $v['image_link'] = getImageUrl($v['image'],$this->user['storage_type'],$this->user['project_location']); |
| 45 | $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST,$template_id,$v['id']); | 45 | $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST,$template_id,$v['id']); |
| 46 | $list[$k] = $v; | 46 | $list[$k] = $v; |
| @@ -135,7 +135,10 @@ class KeywordController extends BaseController | @@ -135,7 +135,10 @@ class KeywordController extends BaseController | ||
| 135 | 'title.array' => 'title为数组', | 135 | 'title.array' => 'title为数组', |
| 136 | 'title.max' => '批量操作不能超过1000条数据' | 136 | 'title.max' => '批量操作不能超过1000条数据' |
| 137 | ]); | 137 | ]); |
| 138 | - $logic->batchAdd(); | 138 | + $rs = $logic->batchAdd(); |
| 139 | + if($rs === false){ | ||
| 140 | + $this->response('创建任务添加关键词任务失败,请稍后重试!',Code::SYSTEM_ERROR); | ||
| 141 | + } | ||
| 139 | $this->response('关键词后台异步添加中,请稍后刷新查看!'); | 142 | $this->response('关键词后台异步添加中,请稍后刷新查看!'); |
| 140 | } | 143 | } |
| 141 | 144 |
| @@ -20,10 +20,12 @@ use App\Models\Product\Product; | @@ -20,10 +20,12 @@ use App\Models\Product\Product; | ||
| 20 | use App\Models\Template\Setting; | 20 | use App\Models\Template\Setting; |
| 21 | use App\Models\Template\BTemplate; | 21 | use App\Models\Template\BTemplate; |
| 22 | use App\Models\User\User; | 22 | use App\Models\User\User; |
| 23 | +use App\Models\WebSetting\SettingNum; | ||
| 23 | use App\Rules\Ids; | 24 | use App\Rules\Ids; |
| 24 | use Illuminate\Http\Request; | 25 | use Illuminate\Http\Request; |
| 25 | use Illuminate\Support\Facades\Cache; | 26 | use Illuminate\Support\Facades\Cache; |
| 26 | use Illuminate\Support\Facades\DB; | 27 | use Illuminate\Support\Facades\DB; |
| 28 | +use Illuminate\Support\Facades\Log; | ||
| 27 | 29 | ||
| 28 | /** | 30 | /** |
| 29 | * Class ProductController | 31 | * Class ProductController |
| @@ -92,11 +94,12 @@ class ProductController extends BaseController | @@ -92,11 +94,12 @@ class ProductController extends BaseController | ||
| 92 | $v['icon'][$icon_k] = $icon_v; | 94 | $v['icon'][$icon_k] = $icon_v; |
| 93 | } | 95 | } |
| 94 | } | 96 | } |
| 95 | - if(!empty($v['video']) && !empty($v['video']['url'])){ | ||
| 96 | - $v['video']['url'] = getImageUrl($v['video']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location']); | 97 | + if(!empty($v['video'])){ |
| 98 | + $v['video']['url'] = getFileUrl($v['video']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location']); | ||
| 99 | + $v['video']['video_image'] = getImageUrl($v['video']['video_image'] ?? '',$this->user['storage_type'] ?? 0,$this->user['project_location']); | ||
| 97 | } | 100 | } |
| 98 | if(!empty($v['files']) && !empty($v['files']['url'])){ | 101 | if(!empty($v['files']) && !empty($v['files']['url'])){ |
| 99 | - $v['files']['url'] = getImageUrl($v['files']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location']); | 102 | + $v['files']['url'] = getFileUrl($v['files']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location']); |
| 100 | } | 103 | } |
| 101 | return $this->success($v); | 104 | return $this->success($v); |
| 102 | } | 105 | } |
| @@ -111,7 +114,6 @@ class ProductController extends BaseController | @@ -111,7 +114,6 @@ class ProductController extends BaseController | ||
| 111 | public function searchParam(&$query){ | 114 | public function searchParam(&$query){ |
| 112 | $query = $query->where('project_id',$this->user['project_id']); | 115 | $query = $query->where('project_id',$this->user['project_id']); |
| 113 | if (isset($this->map['category_id']) && !empty($this->map['category_id'])) { | 116 | if (isset($this->map['category_id']) && !empty($this->map['category_id'])) { |
| 114 | - $str = []; | ||
| 115 | $str[] = $this->map['category_id']; | 117 | $str[] = $this->map['category_id']; |
| 116 | $this->getAllSub($this->map['category_id'],$str); | 118 | $this->getAllSub($this->map['category_id'],$str); |
| 117 | $query->where(function ($subQuery) use ($str) { | 119 | $query->where(function ($subQuery) use ($str) { |
| @@ -472,4 +474,54 @@ class ProductController extends BaseController | @@ -472,4 +474,54 @@ class ProductController extends BaseController | ||
| 472 | $logic->setAllSort(); | 474 | $logic->setAllSort(); |
| 473 | $this->response('success'); | 475 | $this->response('success'); |
| 474 | } | 476 | } |
| 477 | + | ||
| 478 | + /** | ||
| 479 | + * @remark :设置产品排序 | ||
| 480 | + * @name :setProductSort | ||
| 481 | + * @author :lyh | ||
| 482 | + * @method :post | ||
| 483 | + * @time :2024/1/31 10:14 | ||
| 484 | + */ | ||
| 485 | + public function setProductSort(){ | ||
| 486 | + $setNumModel = new SettingNum(); | ||
| 487 | + try { | ||
| 488 | + if(isset($this->param['id']) && !empty($this->param['id'])){ | ||
| 489 | + //执行编辑 | ||
| 490 | + $param = [ | ||
| 491 | + 'data'=>json_encode($this->param['data']), | ||
| 492 | + ]; | ||
| 493 | + $setNumModel->edit($param,['id'=>$this->param['id']]); | ||
| 494 | + }else{ | ||
| 495 | + //执行新增 | ||
| 496 | + $param = [ | ||
| 497 | + 'type'=>$setNumModel::TYPE_PRODUCT_SORT, | ||
| 498 | + 'project_id'=>$this->user['project_id'], | ||
| 499 | + 'data'=>json_encode($this->param['data']), | ||
| 500 | + ]; | ||
| 501 | + $setNumModel->add($param); | ||
| 502 | + } | ||
| 503 | + }catch (\Exception $e){ | ||
| 504 | + Log::info('error file: ' . __CLASS__ . __FUNCTION__ . $e->getMessage()); | ||
| 505 | + $this->response('设置排序失败,请稍后重试',Code::SYSTEM_ERROR); | ||
| 506 | + } | ||
| 507 | + $this->response('success'); | ||
| 508 | + } | ||
| 509 | + | ||
| 510 | + /** | ||
| 511 | + * @remark :获取产品排序 | ||
| 512 | + * @name :getProductSort | ||
| 513 | + * @author :lyh | ||
| 514 | + * @method :post | ||
| 515 | + * @time :2024/1/31 10:24 | ||
| 516 | + */ | ||
| 517 | + public function getProductSort(){ | ||
| 518 | + $setNumModel = new SettingNum(); | ||
| 519 | + $info = $setNumModel->read(['type'=>$setNumModel::TYPE_PRODUCT_SORT]); | ||
| 520 | + if($info === false){ | ||
| 521 | + $info = []; | ||
| 522 | + }else{ | ||
| 523 | + $info['data'] = json_decode($info['data']); | ||
| 524 | + } | ||
| 525 | + $this->response('success',Code::SUCCESS,$info); | ||
| 526 | + } | ||
| 475 | } | 527 | } |
| @@ -251,11 +251,11 @@ class DomainInfoLogic extends BaseLogic | @@ -251,11 +251,11 @@ class DomainInfoLogic extends BaseLogic | ||
| 251 | foreach ($output as $line){ | 251 | foreach ($output as $line){ |
| 252 | if($line){ | 252 | if($line){ |
| 253 | $checkA = strpos($line, $server_info['host']) !== false; | 253 | $checkA = strpos($line, $server_info['host']) !== false; |
| 254 | - } | ||
| 255 | - } | ||
| 256 | if($checkA){ | 254 | if($checkA){ |
| 257 | return $domain; | 255 | return $domain; |
| 258 | } | 256 | } |
| 257 | + } | ||
| 258 | + } | ||
| 259 | 259 | ||
| 260 | //是否cname | 260 | //是否cname |
| 261 | $process = new Process(['nslookup', '-qt=cname', $domain]); | 261 | $process = new Process(['nslookup', '-qt=cname', $domain]); |
| @@ -264,11 +264,10 @@ class DomainInfoLogic extends BaseLogic | @@ -264,11 +264,10 @@ class DomainInfoLogic extends BaseLogic | ||
| 264 | foreach ($output as $line){ | 264 | foreach ($output as $line){ |
| 265 | if($line){ | 265 | if($line){ |
| 266 | $checkCname = (strpos($line, $server_info['init_domain']) !== false); | 266 | $checkCname = (strpos($line, $server_info['init_domain']) !== false); |
| 267 | - } | ||
| 268 | - } | ||
| 269 | if($checkCname){ | 267 | if($checkCname){ |
| 270 | return $domain; | 268 | return $domain; |
| 271 | - | 269 | + } |
| 270 | + } | ||
| 272 | } | 271 | } |
| 273 | return false; | 272 | return false; |
| 274 | } | 273 | } |
| @@ -46,9 +46,16 @@ class OnlineCheckLogic extends BaseLogic | @@ -46,9 +46,16 @@ class OnlineCheckLogic extends BaseLogic | ||
| 46 | if(($info['qa_mid'] != 0) && ($info['qa_mid'] != $this->manager['id'])){ | 46 | if(($info['qa_mid'] != 0) && ($info['qa_mid'] != $this->manager['id'])){ |
| 47 | $this->fail('你无权限提交审核'); | 47 | $this->fail('你无权限提交审核'); |
| 48 | } | 48 | } |
| 49 | - if(isset($this->param['project_type']) && !empty($this->param['project_type'])){ | ||
| 50 | $projectModel = new Project(); | 49 | $projectModel = new Project(); |
| 51 | - $projectModel->edit(['type'=>$this->param['project_type']],['id'=>$this->param['id']]); | 50 | + $projectInfo = $projectModel->read(['id'=>$this->param['id']]); |
| 51 | + if(!empty($projectInfo['uptime'])){ | ||
| 52 | + $param['uptime'] = date('Y-m-d H:i:s'); | ||
| 53 | + } | ||
| 54 | + if(isset($this->param['project_type']) && !empty($this->param['project_type'])){ | ||
| 55 | + $param['type'] = $this->param['project_type']; | ||
| 56 | + } | ||
| 57 | + if(isset($param)){ | ||
| 58 | + $projectModel->edit($param,['id'=>$this->param['id']]); | ||
| 52 | } | 59 | } |
| 53 | } | 60 | } |
| 54 | $data = [ | 61 | $data = [ |
| @@ -133,6 +133,7 @@ class ProjectLogic extends BaseLogic | @@ -133,6 +133,7 @@ class ProjectLogic extends BaseLogic | ||
| 133 | public function projectSave(){ | 133 | public function projectSave(){ |
| 134 | DB::beginTransaction(); | 134 | DB::beginTransaction(); |
| 135 | try { | 135 | try { |
| 136 | + $this->param['project_location'] = 0;//TODO::图片文件存储不同地方,上线后删除 | ||
| 136 | if($this->param['type'] == Project::TYPE_SEVEN){ | 137 | if($this->param['type'] == Project::TYPE_SEVEN){ |
| 137 | //错误单直接返回,单独处理 | 138 | //错误单直接返回,单独处理 |
| 138 | $this->setTypeSevenEdit($this->param); | 139 | $this->setTypeSevenEdit($this->param); |
| @@ -55,9 +55,9 @@ class UserLogic extends BaseLogic | @@ -55,9 +55,9 @@ class UserLogic extends BaseLogic | ||
| 55 | $this->param = $this->editPassword($this->param); | 55 | $this->param = $this->editPassword($this->param); |
| 56 | $rs = $this->model->edit($this->param, ['id' => $this->param['id']]); | 56 | $rs = $this->model->edit($this->param, ['id' => $this->param['id']]); |
| 57 | } else { | 57 | } else { |
| 58 | - $mobileModel = new Mobile(); | ||
| 59 | - //查看当前手机号码是否存在于手机号码库 | ||
| 60 | - $mobileInfo = $mobileModel->read(['mobile'=>$this->param['mobile']]); | 58 | +// $mobileModel = new Mobile(); |
| 59 | +// //查看当前手机号码是否存在于手机号码库 | ||
| 60 | +// $mobileInfo = $mobileModel->read(['mobile'=>$this->param['mobile']]); | ||
| 61 | $this->param['password'] = base64_encode(md5($this->param['password'])); | 61 | $this->param['password'] = base64_encode(md5($this->param['password'])); |
| 62 | $rs = $this->model->add($this->param); | 62 | $rs = $this->model->add($this->param); |
| 63 | } | 63 | } |
| @@ -37,12 +37,13 @@ class AyrReleaseLogic extends BaseLogic | @@ -37,12 +37,13 @@ class AyrReleaseLogic extends BaseLogic | ||
| 37 | * @method :post | 37 | * @method :post |
| 38 | * @time :2023/5/9 9:38 | 38 | * @time :2023/5/9 9:38 |
| 39 | */ | 39 | */ |
| 40 | - public function release_add(){ | 40 | + public function release_add($res){ |
| 41 | $this->param['project_id'] = $this->user['project_id']; | 41 | $this->param['project_id'] = $this->user['project_id']; |
| 42 | $this->param['operator_id'] = $this->user['id']; | 42 | $this->param['operator_id'] = $this->user['id']; |
| 43 | if(isset($this->param['images']) && !empty($this->param['images'])){ | 43 | if(isset($this->param['images']) && !empty($this->param['images'])){ |
| 44 | $this->param['images'] = implode(',',$this->param['images']); | 44 | $this->param['images'] = implode(',',$this->param['images']); |
| 45 | } | 45 | } |
| 46 | + $this->param['result_data'] = $res; | ||
| 46 | $this->param['platforms'] = json_encode($this->param['platforms']); | 47 | $this->param['platforms'] = json_encode($this->param['platforms']); |
| 47 | $rs = $this->model->add($this->param); | 48 | $rs = $this->model->add($this->param); |
| 48 | if($rs === false){ | 49 | if($rs === false){ |
| @@ -60,18 +61,16 @@ class AyrReleaseLogic extends BaseLogic | @@ -60,18 +61,16 @@ class AyrReleaseLogic extends BaseLogic | ||
| 60 | $arr = []; | 61 | $arr = []; |
| 61 | foreach ($data as $k => $v){ | 62 | foreach ($data as $k => $v){ |
| 62 | if($k == 'images'){ | 63 | if($k == 'images'){ |
| 63 | - $images = $v; | ||
| 64 | - $imageModel = new Image(); | ||
| 65 | - $list = $imageModel->list(['path'=>['in',$images]],'id'); | ||
| 66 | - foreach ($list as $v1){ | ||
| 67 | - $arr[] = getImageUrl($v1['path'],$this->user['storage_type'],$this->user['project_location']); | 64 | + foreach ($v as $v1){ |
| 65 | + $v1 = 'https://file.globalso.com'.str_replace_url($v1); | ||
| 66 | + $arr[] = $v1; | ||
| 68 | } | 67 | } |
| 69 | }else{ | 68 | }else{ |
| 70 | - $fileModel = new File(); | ||
| 71 | - $info = $fileModel->read(['path'=>$v]); | ||
| 72 | - $arr[] = getFileUrl($info['path'],$this->user['storage_type'],$this->user['project_location']); | 69 | + $v = 'https://file.globalso.com'.str_replace_url($v); |
| 70 | + $arr[] = $v; | ||
| 73 | } | 71 | } |
| 74 | } | 72 | } |
| 73 | + @file_put_contents(storage_path('logs/lyh_error.log'), var_export($arr, true) . PHP_EOL, FILE_APPEND); | ||
| 75 | return $this->success($arr); | 74 | return $this->success($arr); |
| 76 | } | 75 | } |
| 77 | 76 |
| @@ -65,7 +65,11 @@ class CustomTemplateLogic extends BaseLogic | @@ -65,7 +65,11 @@ class CustomTemplateLogic extends BaseLogic | ||
| 65 | public function customTemplateSave(){ | 65 | public function customTemplateSave(){ |
| 66 | $this->param['url'] = str_replace_url($this->param['url']); | 66 | $this->param['url'] = str_replace_url($this->param['url']); |
| 67 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 67 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 68 | + $is_upgrade = $this->param['is_upgrade'] ?? 0;//1:5.0数据 0:6.0 | ||
| 69 | + $six_read = $this->param['six_read'] ?? 0;//5.0数据时,是否按6.0显示 | ||
| 70 | + if($is_upgrade == 0 || $six_read == 1) { | ||
| 68 | $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $this->param['id'], $this->user['project_id']); | 71 | $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $this->param['id'], $this->user['project_id']); |
| 72 | + } | ||
| 69 | $this->editCustomRoute($this->param['url']); | 73 | $this->editCustomRoute($this->param['url']); |
| 70 | $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); | 74 | $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); |
| 71 | }else{ | 75 | }else{ |
| @@ -34,7 +34,11 @@ class BlogLogic extends BaseLogic | @@ -34,7 +34,11 @@ class BlogLogic extends BaseLogic | ||
| 34 | try { | 34 | try { |
| 35 | $this->param = $this->paramProcessing($this->param); | 35 | $this->param = $this->paramProcessing($this->param); |
| 36 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 36 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 37 | + $is_upgrade = $this->param['is_upgrade'] ?? 0;//1:5.0数据 0:6.0 | ||
| 38 | + $six_read = $this->param['six_read'] ?? 0;//是否按6.0显示 | ||
| 39 | + if($is_upgrade == 0 || $six_read == 1){ | ||
| 37 | $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $this->param['id'], $this->user['project_id']); | 40 | $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $this->param['id'], $this->user['project_id']); |
| 41 | + } | ||
| 38 | $route = $this->param['url']; | 42 | $route = $this->param['url']; |
| 39 | $this->edit($this->param,['id'=>$this->param['id']]); | 43 | $this->edit($this->param,['id'=>$this->param['id']]); |
| 40 | }else{ | 44 | }else{ |
| @@ -195,7 +199,7 @@ class BlogLogic extends BaseLogic | @@ -195,7 +199,7 @@ class BlogLogic extends BaseLogic | ||
| 195 | foreach ($category as $v){ | 199 | foreach ($category as $v){ |
| 196 | $str .= $v.','; | 200 | $str .= $v.','; |
| 197 | } | 201 | } |
| 198 | - return !empty($str) ? ','.$str : ''; | 202 | + return !empty(trim($str,',')) ? ','.$str.',' : ''; |
| 199 | } | 203 | } |
| 200 | 204 | ||
| 201 | /** | 205 | /** |
| @@ -150,6 +150,7 @@ class CustomModuleCategoryLogic extends BaseLogic | @@ -150,6 +150,7 @@ class CustomModuleCategoryLogic extends BaseLogic | ||
| 150 | * @time :2023/12/5 10:55 | 150 | * @time :2023/12/5 10:55 |
| 151 | */ | 151 | */ |
| 152 | public function categoryEdit(){ | 152 | public function categoryEdit(){ |
| 153 | + | ||
| 153 | $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE_CATE, | 154 | $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE_CATE, |
| 154 | $this->param['id'], $this->user['project_id']); | 155 | $this->param['id'], $this->user['project_id']); |
| 155 | $this->editRoute($this->param['id'],$route); | 156 | $this->editRoute($this->param['id'],$route); |
| @@ -9,6 +9,7 @@ | @@ -9,6 +9,7 @@ | ||
| 9 | 9 | ||
| 10 | namespace App\Http\Logic\Bside\CustomModule; | 10 | namespace App\Http\Logic\Bside\CustomModule; |
| 11 | 11 | ||
| 12 | +use App\Helper\Arr; | ||
| 12 | use App\Http\Logic\Bside\BaseLogic; | 13 | use App\Http\Logic\Bside\BaseLogic; |
| 13 | use App\Models\CustomModule\CustomModuleCategory; | 14 | use App\Models\CustomModule\CustomModuleCategory; |
| 14 | use App\Models\CustomModule\CustomModuleContent; | 15 | use App\Models\CustomModule\CustomModuleContent; |
| @@ -39,7 +40,6 @@ class CustomModuleContentLogic extends BaseLogic | @@ -39,7 +40,6 @@ class CustomModuleContentLogic extends BaseLogic | ||
| 39 | if($info === false){ | 40 | if($info === false){ |
| 40 | $this->fail('当前数据不存在或已被删除'); | 41 | $this->fail('当前数据不存在或已被删除'); |
| 41 | } | 42 | } |
| 42 | - $info['image'] = getImageUrl($info['image'],$this->user['storage_type'],$this->user['project_location']); | ||
| 43 | $info['extend'] = $this->getExtendInfo($info['module_id'],$info['id']); | 43 | $info['extend'] = $this->getExtendInfo($info['module_id'],$info['id']); |
| 44 | return $this->success($info); | 44 | return $this->success($info); |
| 45 | } | 45 | } |
| @@ -186,9 +186,12 @@ class CustomModuleContentLogic extends BaseLogic | @@ -186,9 +186,12 @@ class CustomModuleContentLogic extends BaseLogic | ||
| 186 | * @time :2023/12/7 15:04 | 186 | * @time :2023/12/7 15:04 |
| 187 | */ | 187 | */ |
| 188 | public function contentEdit(){ | 188 | public function contentEdit(){ |
| 189 | - $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE, | ||
| 190 | - $this->param['id'], $this->user['project_id']); | ||
| 191 | - $this->editRoute($this->param['id'],$route); | 189 | + $is_upgrade = $this->param['is_upgrade'] ?? 0;//5.0数据 1:6.0 |
| 190 | + $six_read = $this->param['six_read'] ?? 0;//是否按6.0显示 | ||
| 191 | + if($is_upgrade == 0 || $six_read == 1) { | ||
| 192 | + $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE, $this->param['id'], $this->user['project_id']); | ||
| 193 | + } | ||
| 194 | + $this->editRoute($this->param['id'],$this->param['route']); | ||
| 192 | $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); | 195 | $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); |
| 193 | if($rs === false){ | 196 | if($rs === false){ |
| 194 | $this->fail('系统错误,请连续管理员'); | 197 | $this->fail('系统错误,请连续管理员'); |
| @@ -214,6 +217,11 @@ class CustomModuleContentLogic extends BaseLogic | @@ -214,6 +217,11 @@ class CustomModuleContentLogic extends BaseLogic | ||
| 214 | if(isset($param['image']) && !empty($param['image'])){ | 217 | if(isset($param['image']) && !empty($param['image'])){ |
| 215 | $param['image'] = str_replace_url($param['image']); | 218 | $param['image'] = str_replace_url($param['image']); |
| 216 | } | 219 | } |
| 220 | + if(isset($param['video'])){ | ||
| 221 | + $param['video']['url'] = str_replace_url($param['video']['url']); | ||
| 222 | + $param['video']['video_image'] = str_replace_url($param['video']['video_image']); | ||
| 223 | + $param['video'] = Arr::a2s($param['video'] ?? []); | ||
| 224 | + } | ||
| 217 | return $this->success($param); | 225 | return $this->success($param); |
| 218 | } | 226 | } |
| 219 | 227 |
| @@ -64,7 +64,11 @@ class NewsLogic extends BaseLogic | @@ -64,7 +64,11 @@ class NewsLogic extends BaseLogic | ||
| 64 | try { | 64 | try { |
| 65 | $this->param = $this->paramProcessing($this->param); | 65 | $this->param = $this->paramProcessing($this->param); |
| 66 | if (isset($this->param['id']) && !empty($this->param['id'])) { | 66 | if (isset($this->param['id']) && !empty($this->param['id'])) { |
| 67 | + $is_upgrade = $this->param['is_upgrade'] ?? 0;//1:5.0数据 0:6.0 | ||
| 68 | + $six_read = $this->param['six_read'] ?? 0;//是否按6.0显示 | ||
| 69 | + if($is_upgrade == 0 || $six_read == 1) { | ||
| 67 | $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $this->param['id'], $this->user['project_id']); | 70 | $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $this->param['id'], $this->user['project_id']); |
| 71 | + } | ||
| 68 | //是否更新路由 | 72 | //是否更新路由 |
| 69 | $route = $this->param['url']; | 73 | $route = $this->param['url']; |
| 70 | $this->edit($this->param, ['id' => $this->param['id']]); | 74 | $this->edit($this->param, ['id' => $this->param['id']]); |
| @@ -213,7 +217,7 @@ class NewsLogic extends BaseLogic | @@ -213,7 +217,7 @@ class NewsLogic extends BaseLogic | ||
| 213 | foreach ($category as $v){ | 217 | foreach ($category as $v){ |
| 214 | $str .= $v.','; | 218 | $str .= $v.','; |
| 215 | } | 219 | } |
| 216 | - return !empty($str) ? ','.$str : ''; | 220 | + return !empty(trim($str,',')) ? ','.$str.',' : ''; |
| 217 | } | 221 | } |
| 218 | 222 | ||
| 219 | /** | 223 | /** |
| @@ -196,7 +196,9 @@ class CategoryLogic extends BaseLogic | @@ -196,7 +196,9 @@ class CategoryLogic extends BaseLogic | ||
| 196 | RouteMap::delRoute(RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']); | 196 | RouteMap::delRoute(RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']); |
| 197 | //生成一条删除路由记录 | 197 | //生成一条删除路由记录 |
| 198 | $info = $this->model->read(['id'=>$id],['id','route']); | 198 | $info = $this->model->read(['id'=>$id],['id','route']); |
| 199 | + if($info !== false){ | ||
| 199 | $this->curlDelRoute(['route'=>$info['route']]); | 200 | $this->curlDelRoute(['route'=>$info['route']]); |
| 201 | + } | ||
| 200 | return $this->success(); | 202 | return $this->success(); |
| 201 | } | 203 | } |
| 202 | 204 | ||
| @@ -248,7 +250,7 @@ class CategoryLogic extends BaseLogic | @@ -248,7 +250,7 @@ class CategoryLogic extends BaseLogic | ||
| 248 | $str .= $v.','; | 250 | $str .= $v.','; |
| 249 | } | 251 | } |
| 250 | } | 252 | } |
| 251 | - return !empty($str) ? ','.$str : ''; | 253 | + return !empty(trim($str,',')) ? ','.$str.',' : ''; |
| 252 | } | 254 | } |
| 253 | 255 | ||
| 254 | /** | 256 | /** |
| @@ -145,10 +145,10 @@ class KeywordLogic extends BaseLogic | @@ -145,10 +145,10 @@ class KeywordLogic extends BaseLogic | ||
| 145 | $this->model->insertGetId($param); | 145 | $this->model->insertGetId($param); |
| 146 | } | 146 | } |
| 147 | } | 147 | } |
| 148 | - NoticeLog::createLog(NoticeLog::TYPE_INIT_KEYWORD, ['project_id' => $this->user['project_id']]); | ||
| 149 | }catch (\Exception $e){ | 148 | }catch (\Exception $e){ |
| 150 | - $this->fail('创建任务添加关键词任务失败,请稍后重试!'); | 149 | + return false; |
| 151 | } | 150 | } |
| 151 | + NoticeLog::createLog(NoticeLog::TYPE_INIT_KEYWORD, ['project_id' => $this->user['project_id']]); | ||
| 152 | return $this->success(); | 152 | return $this->success(); |
| 153 | } | 153 | } |
| 154 | 154 |
| @@ -14,6 +14,7 @@ use App\Models\RouteMap\RouteMap; | @@ -14,6 +14,7 @@ use App\Models\RouteMap\RouteMap; | ||
| 14 | use App\Models\Template\BTemplate; | 14 | use App\Models\Template\BTemplate; |
| 15 | use App\Services\CosService; | 15 | use App\Services\CosService; |
| 16 | use Illuminate\Support\Facades\DB; | 16 | use Illuminate\Support\Facades\DB; |
| 17 | +use Illuminate\Support\Facades\Log; | ||
| 17 | 18 | ||
| 18 | /** | 19 | /** |
| 19 | * Class ProductLogic | 20 | * Class ProductLogic |
| @@ -46,7 +47,11 @@ class ProductLogic extends BaseLogic | @@ -46,7 +47,11 @@ class ProductLogic extends BaseLogic | ||
| 46 | $this->param = $this->handleSaveParam($this->param); | 47 | $this->param = $this->handleSaveParam($this->param); |
| 47 | try { | 48 | try { |
| 48 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 49 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 50 | + $is_upgrade = $this->param['is_upgrade'] ?? 0;//1:5.0数据 0:6.0 | ||
| 51 | + $six_read = $this->param['six_read'] ?? 0;//是否按6.0显示 | ||
| 52 | + if($is_upgrade == 0 || $six_read == 1){ | ||
| 49 | $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']); | 53 | $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']); |
| 54 | + } | ||
| 50 | $route = $this->param['route']; | 55 | $route = $this->param['route']; |
| 51 | $this->model->edit($this->param,['id'=>$this->param['id']]); | 56 | $this->model->edit($this->param,['id'=>$this->param['id']]); |
| 52 | $id = $this->param['id']; | 57 | $id = $this->param['id']; |
| @@ -62,6 +67,7 @@ class ProductLogic extends BaseLogic | @@ -62,6 +67,7 @@ class ProductLogic extends BaseLogic | ||
| 62 | //保存扩展字段 | 67 | //保存扩展字段 |
| 63 | $this->saveExtendInfo($id,$extend); | 68 | $this->saveExtendInfo($id,$extend); |
| 64 | }catch (\Exception $e){ | 69 | }catch (\Exception $e){ |
| 70 | + Log::info('错误信息---'.$e->getMessage()); | ||
| 65 | $this->fail('系统错误请联系管理员'); | 71 | $this->fail('系统错误请联系管理员'); |
| 66 | } | 72 | } |
| 67 | $this->addUpdateNotify(RouteMap::SOURCE_PRODUCT,$route); | 73 | $this->addUpdateNotify(RouteMap::SOURCE_PRODUCT,$route); |
| @@ -193,6 +199,7 @@ class ProductLogic extends BaseLogic | @@ -193,6 +199,7 @@ class ProductLogic extends BaseLogic | ||
| 193 | * @time :2023/10/26 9:49 | 199 | * @time :2023/10/26 9:49 |
| 194 | */ | 200 | */ |
| 195 | public function editList(){ | 201 | public function editList(){ |
| 202 | + $category_ids = $this->param['category_id']; | ||
| 196 | $this->param['category_id'] = $this->handleListCategory($this->param['category_id']); | 203 | $this->param['category_id'] = $this->handleListCategory($this->param['category_id']); |
| 197 | $this->param['keyword_id'] = $this->saveKeyword($this->param['keyword_id']); | 204 | $this->param['keyword_id'] = $this->saveKeyword($this->param['keyword_id']); |
| 198 | if(isset($this->param['gallery']) && !empty($this->param['gallery'])){ | 205 | if(isset($this->param['gallery']) && !empty($this->param['gallery'])){ |
| @@ -208,9 +215,11 @@ class ProductLogic extends BaseLogic | @@ -208,9 +215,11 @@ class ProductLogic extends BaseLogic | ||
| 208 | try { | 215 | try { |
| 209 | if(isset($this->param['route']) && !empty($this->param['route'])){ | 216 | if(isset($this->param['route']) && !empty($this->param['route'])){ |
| 210 | $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']); | 217 | $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']); |
| 211 | - $this->editProductRoute($this->param['id'],$this->param['route']); | 218 | +// $this->editProductRoute($this->param['id'],$this->param['route']); |
| 212 | } | 219 | } |
| 213 | $this->model->edit($this->param,['id'=>$this->param['id']]); | 220 | $this->model->edit($this->param,['id'=>$this->param['id']]); |
| 221 | + //产品分类关联 | ||
| 222 | + CategoryRelated::saveRelated($this->param['id'], $category_ids); | ||
| 214 | }catch (\Exception $e){ | 223 | }catch (\Exception $e){ |
| 215 | $this->fail('系统错误,请连续管理员'); | 224 | $this->fail('系统错误,请连续管理员'); |
| 216 | } | 225 | } |
| @@ -278,6 +287,7 @@ class ProductLogic extends BaseLogic | @@ -278,6 +287,7 @@ class ProductLogic extends BaseLogic | ||
| 278 | } | 287 | } |
| 279 | if(isset($param['video'])){ | 288 | if(isset($param['video'])){ |
| 280 | $param['video']['url'] = str_replace_url($param['video']['url']); | 289 | $param['video']['url'] = str_replace_url($param['video']['url']); |
| 290 | + $param['video']['video_image'] = str_replace_url($param['video']['video_image']); | ||
| 281 | $param['video'] = Arr::a2s($param['video'] ?? []); | 291 | $param['video'] = Arr::a2s($param['video'] ?? []); |
| 282 | } | 292 | } |
| 283 | if(isset($param['keyword_id']) && !empty($param['keyword_id'])){ | 293 | if(isset($param['keyword_id']) && !empty($param['keyword_id'])){ |
| @@ -313,7 +323,7 @@ class ProductLogic extends BaseLogic | @@ -313,7 +323,7 @@ class ProductLogic extends BaseLogic | ||
| 313 | $str .= $v.','; | 323 | $str .= $v.','; |
| 314 | } | 324 | } |
| 315 | } | 325 | } |
| 316 | - return !empty($str) ? ','.$str : ''; | 326 | + return !empty(trim($str,',')) ? ','.$str.',' : ''; |
| 317 | } | 327 | } |
| 318 | 328 | ||
| 319 | /** | 329 | /** |
| @@ -28,6 +28,7 @@ use App\Models\RankData\Speed; | @@ -28,6 +28,7 @@ use App\Models\RankData\Speed; | ||
| 28 | use App\Models\RankData\Speed as GoogleSpeedModel; | 28 | use App\Models\RankData\Speed as GoogleSpeedModel; |
| 29 | use App\Utils\HttpUtils; | 29 | use App\Utils\HttpUtils; |
| 30 | use GuzzleHttp\Exception\GuzzleException; | 30 | use GuzzleHttp\Exception\GuzzleException; |
| 31 | +use Illuminate\Support\Collection; | ||
| 31 | use Illuminate\Support\Facades\Cache; | 32 | use Illuminate\Support\Facades\Cache; |
| 32 | use Illuminate\Support\Facades\Log; | 33 | use Illuminate\Support\Facades\Log; |
| 33 | use Illuminate\Support\Str; | 34 | use Illuminate\Support\Str; |
| @@ -110,9 +111,10 @@ class RankDataLogic extends BaseLogic | @@ -110,9 +111,10 @@ class RankDataLogic extends BaseLogic | ||
| 110 | 111 | ||
| 111 | //外链引荐域名 | 112 | //外链引荐域名 |
| 112 | $recomm_domain = $recomm_domain ? $recomm_domain->toArray() : []; | 113 | $recomm_domain = $recomm_domain ? $recomm_domain->toArray() : []; |
| 114 | + $recomm_domain['data'] = Collection::make($recomm_domain['data'] ?? [])->sortBy('backlinks_num')->all(); | ||
| 113 | $data['external_links_domain_chat'] = [ | 115 | $data['external_links_domain_chat'] = [ |
| 114 | 'labels' => array_map(function ($item) { | 116 | 'labels' => array_map(function ($item) { |
| 115 | - return Str::substrReplace($item, '***', 2, 3); | 117 | + return mb_substr($item, 0, 2) . '***' . mb_substr($item, 5); |
| 116 | }, Arr::pluck($recomm_domain['data'] ?? [], 'domain')), | 118 | }, Arr::pluck($recomm_domain['data'] ?? [], 'domain')), |
| 117 | 'data' => Arr::pluck($recomm_domain['data'] ?? [], 'backlinks_num'), | 119 | 'data' => Arr::pluck($recomm_domain['data'] ?? [], 'backlinks_num'), |
| 118 | 'list_date' => $recomm_domain['updated_at'] ?? '', | 120 | 'list_date' => $recomm_domain['updated_at'] ?? '', |
| @@ -611,7 +613,6 @@ class RankDataLogic extends BaseLogic | @@ -611,7 +613,6 @@ class RankDataLogic extends BaseLogic | ||
| 611 | //外链引荐域名 | 613 | //外链引荐域名 |
| 612 | $domain = (new DomainInfo())->getDomain($domain); | 614 | $domain = (new DomainInfo())->getDomain($domain); |
| 613 | $semrushApi = new SemrushApi(); | 615 | $semrushApi = new SemrushApi(); |
| 614 | - $domain = (new DomainInfo())->getDomain($domain); | ||
| 615 | $data = $semrushApi->backlinks_refdomains($domain); | 616 | $data = $semrushApi->backlinks_refdomains($domain); |
| 616 | } | 617 | } |
| 617 | 618 |
| @@ -21,4 +21,18 @@ class CustomModuleContent extends Base | @@ -21,4 +21,18 @@ class CustomModuleContent extends Base | ||
| 21 | public function getCategoryIdAttribute($value){ | 21 | public function getCategoryIdAttribute($value){ |
| 22 | return explode(',',trim($value,',')); | 22 | return explode(',',trim($value,',')); |
| 23 | } | 23 | } |
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * @remark :视频 | ||
| 27 | + * @name :getVideoAttribute | ||
| 28 | + * @author :lyh | ||
| 29 | + * @method :post | ||
| 30 | + * @time :2024/1/23 14:31 | ||
| 31 | + */ | ||
| 32 | + public function getVideoAttribute($value){ | ||
| 33 | + if(!empty($value)){ | ||
| 34 | + $value = Arr::s2a($value); | ||
| 35 | + } | ||
| 36 | + return $value; | ||
| 37 | + } | ||
| 24 | } | 38 | } |
| @@ -5,6 +5,7 @@ namespace App\Models\Inquiry; | @@ -5,6 +5,7 @@ namespace App\Models\Inquiry; | ||
| 5 | use App\Models\Base; | 5 | use App\Models\Base; |
| 6 | use Illuminate\Database\Eloquent\SoftDeletes; | 6 | use Illuminate\Database\Eloquent\SoftDeletes; |
| 7 | use Illuminate\Support\Facades\Cache; | 7 | use Illuminate\Support\Facades\Cache; |
| 8 | +use Illuminate\Support\Str; | ||
| 8 | 9 | ||
| 9 | /** | 10 | /** |
| 10 | * Class InquiryForm | 11 | * Class InquiryForm |
| @@ -36,10 +37,11 @@ class InquiryForm extends Base | @@ -36,10 +37,11 @@ class InquiryForm extends Base | ||
| 36 | 'phone' => '电话', | 37 | 'phone' => '电话', |
| 37 | 'mobile' => '电话', | 38 | 'mobile' => '电话', |
| 38 | 'message' => '询盘内容', | 39 | 'message' => '询盘内容', |
| 39 | - 'company' => '公司名称' | 40 | + 'company' => '公司名称', |
| 41 | + 'file' => '文件' | ||
| 40 | ]; | 42 | ]; |
| 41 | if($field){ | 43 | if($field){ |
| 42 | - return $map[$field] ?? $field; | 44 | + return $map[Str::lower($field)] ?? Str::studly($field); |
| 43 | } | 45 | } |
| 44 | return $map; | 46 | return $map; |
| 45 | } | 47 | } |
| @@ -70,6 +72,13 @@ class InquiryForm extends Base | @@ -70,6 +72,13 @@ class InquiryForm extends Base | ||
| 70 | unset($data['globalso-domain']); | 72 | unset($data['globalso-domain']); |
| 71 | unset($data['globalso-edition']); | 73 | unset($data['globalso-edition']); |
| 72 | unset($data['globalso-date']); | 74 | unset($data['globalso-date']); |
| 75 | + | ||
| 76 | + foreach ($data as $k => $v){ | ||
| 77 | + if(in_array($k, ['name', 'email', 'message']) && empty($v)){ | ||
| 78 | + unset($data[$k]); | ||
| 79 | + } | ||
| 80 | + } | ||
| 81 | + | ||
| 73 | ksort($data); | 82 | ksort($data); |
| 74 | $field = array_keys($data); | 83 | $field = array_keys($data); |
| 75 | $sign = md5(json_encode($field)); | 84 | $sign = md5(json_encode($field)); |
| @@ -41,7 +41,22 @@ class Category extends Base | @@ -41,7 +41,22 @@ class Category extends Base | ||
| 41 | return $ids; | 41 | return $ids; |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | - | 44 | + /** |
| 45 | + * @remark :获取当前id下所有子集 | ||
| 46 | + * @name :getAllSub | ||
| 47 | + * @author :lyh | ||
| 48 | + * @method :post | ||
| 49 | + * @time :2023/10/18 15:10 | ||
| 50 | + */ | ||
| 51 | + public function getAllSub($list,$id,&$str = []){ | ||
| 52 | + foreach ($list as $k =>$v){ | ||
| 53 | + if($v['pid'] == $id){ | ||
| 54 | + $str[] = $v['id']; | ||
| 55 | + $this->getAllSub($list,$v['id'],$str); | ||
| 56 | + } | ||
| 57 | + } | ||
| 58 | + return $str; | ||
| 59 | + } | ||
| 45 | 60 | ||
| 46 | /** | 61 | /** |
| 47 | * 关联产品数量 | 62 | * 关联产品数量 |
| @@ -50,10 +65,11 @@ class Category extends Base | @@ -50,10 +65,11 @@ class Category extends Base | ||
| 50 | * @author zbj | 65 | * @author zbj |
| 51 | * @date 2023/4/28 | 66 | * @date 2023/4/28 |
| 52 | */ | 67 | */ |
| 53 | - public static function getProductNum($cate_id){ | ||
| 54 | - $cate_ids = self::getChildIdsArr($cate_id); | ||
| 55 | - $count = CategoryRelated::whereIn('cate_id',$cate_ids)->count(); | ||
| 56 | -// $str = 0; | 68 | + public function getProductNum($list,$cate_id){ |
| 69 | + $str[] = $cate_id; | ||
| 70 | + $cate_ids = $this->getAllSub($list,$cate_id,$str); | ||
| 71 | + $productArr = CategoryRelated::whereIn('cate_id',$cate_ids)->pluck('product_id')->unique()->toArray(); | ||
| 72 | + $count = count($productArr); | ||
| 57 | return $count; | 73 | return $count; |
| 58 | } | 74 | } |
| 59 | } | 75 | } |
| @@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
| 3 | namespace App\Models\Project; | 3 | namespace App\Models\Project; |
| 4 | 4 | ||
| 5 | use App\Helper\Arr; | 5 | use App\Helper\Arr; |
| 6 | +use App\Helper\Translate; | ||
| 6 | use App\Models\Base; | 7 | use App\Models\Base; |
| 7 | use App\Models\Devops\ServerConfig; | 8 | use App\Models\Devops\ServerConfig; |
| 8 | use App\Models\Optimize\Process; | 9 | use App\Models\Optimize\Process; |
| @@ -320,6 +321,14 @@ class Project extends Base | @@ -320,6 +321,14 @@ class Project extends Base | ||
| 320 | $project_id = DeployBuild::where('test_domain', 'https://' . $domain . '/')->value('project_id'); | 321 | $project_id = DeployBuild::where('test_domain', 'https://' . $domain . '/')->value('project_id'); |
| 321 | //是否正式域名 | 322 | //是否正式域名 |
| 322 | if (!$project_id) { | 323 | if (!$project_id) { |
| 324 | + //是否小语种域名 | ||
| 325 | + $domainPrefix = explode(".",$domain); | ||
| 326 | + if (!empty($domainPrefix)){ | ||
| 327 | + $isLang = Translate::getTls($domainPrefix[0]); | ||
| 328 | + if ($isLang) { | ||
| 329 | + $domain = "www.".$domainPrefix[1].".".$domainPrefix[2]; | ||
| 330 | + } | ||
| 331 | + } | ||
| 323 | $project_id = \App\Models\Domain\DomainInfo::where('domain', $domain)->value('project_id'); | 332 | $project_id = \App\Models\Domain\DomainInfo::where('domain', $domain)->value('project_id'); |
| 324 | } | 333 | } |
| 325 | $project = self::find($project_id ?: 0); | 334 | $project = self::find($project_id ?: 0); |
| @@ -20,6 +20,8 @@ use App\Models\Base; | @@ -20,6 +20,8 @@ use App\Models\Base; | ||
| 20 | */ | 20 | */ |
| 21 | class SettingNum extends Base | 21 | class SettingNum extends Base |
| 22 | { | 22 | { |
| 23 | + const TYPE_PRODUCT_SORT = 10;//c端显示排序 | ||
| 24 | + | ||
| 23 | protected $table = 'gl_setting_num'; | 25 | protected $table = 'gl_setting_num'; |
| 24 | //连接数据库 | 26 | //连接数据库 |
| 25 | protected $connection = 'custom_mysql'; | 27 | protected $connection = 'custom_mysql'; |
| @@ -70,6 +70,9 @@ class SyncSubmitTaskService | @@ -70,6 +70,9 @@ class SyncSubmitTaskService | ||
| 70 | 70 | ||
| 71 | $this->inquiryFilter($data['project_id'], $data); | 71 | $this->inquiryFilter($data['project_id'], $data); |
| 72 | 72 | ||
| 73 | + //数组key转为小写 | ||
| 74 | + $data['data'] = array_change_key_case($data['data'], CASE_LOWER); | ||
| 75 | + | ||
| 73 | $form_id = InquiryForm::getFromId($data['data']); | 76 | $form_id = InquiryForm::getFromId($data['data']); |
| 74 | 77 | ||
| 75 | InquiryFormData::saveData($form_id, $data['domain'], $data['ip'], $data['country'], $data['referer'], $data['user_agent'], $data['submit_at'], $data['data']); | 78 | InquiryFormData::saveData($form_id, $data['domain'], $data['ip'], $data['country'], $data['referer'], $data['user_agent'], $data['submit_at'], $data['data']); |
| @@ -92,7 +95,14 @@ class SyncSubmitTaskService | @@ -92,7 +95,14 @@ class SyncSubmitTaskService | ||
| 92 | { | 95 | { |
| 93 | 96 | ||
| 94 | $visit_data = $data['data']; | 97 | $visit_data = $data['data']; |
| 95 | - $visit_data['referrer_url'] = $data['data']['referrer_url']??''; | 98 | + $referrer_url = ''; |
| 99 | + if($data['data']['referrer_url']){ | ||
| 100 | + $url_arr = parse_url($data['data']['referrer_url']); | ||
| 101 | + if(!empty($url_arr['scheme']) && !empty($url_arr['host'])){ | ||
| 102 | + $referrer_url = $url_arr['scheme'] . '://' . $url_arr['host'] . '/'; | ||
| 103 | + } | ||
| 104 | + } | ||
| 105 | + $visit_data['referrer_url'] = $referrer_url; | ||
| 96 | $visit_data['device_port'] = $data['data']['device_port']??''; | 106 | $visit_data['device_port'] = $data['data']['device_port']??''; |
| 97 | $visit_data['url'] = $data['data']['url']??''; | 107 | $visit_data['url'] = $data['data']['url']??''; |
| 98 | $visit_data['domain'] = $data['domain']??''; | 108 | $visit_data['domain'] = $data['domain']??''; |
| @@ -21,3 +21,5 @@ Route::middleware('auth:sanctum')->get('/user', function (Request $request) { | @@ -21,3 +21,5 @@ Route::middleware('auth:sanctum')->get('/user', function (Request $request) { | ||
| 21 | Route::any('traffic_visit', [\App\Http\Controllers\Api\NoticeController::class, 'trafficVisit'])->name('api.traffic_visit'); | 21 | Route::any('traffic_visit', [\App\Http\Controllers\Api\NoticeController::class, 'trafficVisit'])->name('api.traffic_visit'); |
| 22 | Route::get('optimize_project_list', [\App\Http\Controllers\Api\PrivateController::class, 'optimizeProjectList'])->name('api.optimize_project_list'); | 22 | Route::get('optimize_project_list', [\App\Http\Controllers\Api\PrivateController::class, 'optimizeProjectList'])->name('api.optimize_project_list'); |
| 23 | Route::get('get_project_route', [\App\Http\Controllers\Api\PrivateController::class, 'getProjectRoute'])->name('api.get_project_route'); | 23 | Route::get('get_project_route', [\App\Http\Controllers\Api\PrivateController::class, 'getProjectRoute'])->name('api.get_project_route'); |
| 24 | +Route::any('get_product_images', [\App\Http\Controllers\Api\ProductController::class, 'getImages'])->name('api.get_product_images'); | ||
| 25 | + |
| @@ -223,6 +223,8 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -223,6 +223,8 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 223 | Route::post('/editList', [\App\Http\Controllers\Bside\Product\ProductController::class, 'editList'])->name('product_editList'); | 223 | Route::post('/editList', [\App\Http\Controllers\Bside\Product\ProductController::class, 'editList'])->name('product_editList'); |
| 224 | Route::post('/sort', [\App\Http\Controllers\Bside\Product\ProductController::class, 'sort'])->name('product_sort'); | 224 | Route::post('/sort', [\App\Http\Controllers\Bside\Product\ProductController::class, 'sort'])->name('product_sort'); |
| 225 | Route::post('/allSort', [\App\Http\Controllers\Bside\Product\ProductController::class, 'allSort'])->name('product_allSort'); | 225 | Route::post('/allSort', [\App\Http\Controllers\Bside\Product\ProductController::class, 'allSort'])->name('product_allSort'); |
| 226 | + Route::post('/setProductSort', [\App\Http\Controllers\Bside\Product\ProductController::class, 'setProductSort'])->name('product_setProductSort'); | ||
| 227 | + Route::post('/getProductSort', [\App\Http\Controllers\Bside\Product\ProductController::class, 'getProductSort'])->name('product_getProductSort'); | ||
| 226 | Route::any('/delete', [\App\Http\Controllers\Bside\Product\ProductController::class, 'delete'])->name('product_delete'); | 228 | Route::any('/delete', [\App\Http\Controllers\Bside\Product\ProductController::class, 'delete'])->name('product_delete'); |
| 227 | Route::any('/statusNum', [\App\Http\Controllers\Bside\Product\ProductController::class, 'getStatusNumber'])->name('product_statusNum'); | 229 | Route::any('/statusNum', [\App\Http\Controllers\Bside\Product\ProductController::class, 'getStatusNumber'])->name('product_statusNum'); |
| 228 | Route::any('/copyProduct', [\App\Http\Controllers\Bside\Product\ProductController::class, 'copyProduct'])->name('product_copyProduct'); | 230 | Route::any('/copyProduct', [\App\Http\Controllers\Bside\Product\ProductController::class, 'copyProduct'])->name('product_copyProduct'); |
-
请 注册 或 登录 后发表评论