Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
17 个修改的文件
包含
443 行增加
和
39 行删除
| @@ -71,30 +71,32 @@ class RemainDay extends Command | @@ -71,30 +71,32 @@ class RemainDay extends Command | ||
| 71 | if($item['type'] != Project::TYPE_THREE){ | 71 | if($item['type'] != Project::TYPE_THREE){ |
| 72 | $item->pause_days = $item->pause_days + 1; | 72 | $item->pause_days = $item->pause_days + 1; |
| 73 | } | 73 | } |
| 74 | - } | ||
| 75 | - if(in_array($item->id,$this->projectId)){//已开始优化的时间结算 | ||
| 76 | - $optimizeModel = new DeployOptimize(); | ||
| 77 | - $opInfo = $optimizeModel->read(['project_id'=>$item->id],['start_date']); | ||
| 78 | - if($opInfo === false){ | ||
| 79 | - continue; | ||
| 80 | - } | ||
| 81 | - $diff = time() - strtotime($opInfo['start_date'] ?? $item->uptime); | ||
| 82 | - $remain_day = $item['deploy_build']['service_duration'] - floor($diff / (60 * 60 * 24)); | ||
| 83 | }else{ | 74 | }else{ |
| 84 | - if($item['type'] == Project::TYPE_TWO){ | ||
| 85 | - $compliance_day = ($item->finish_remain_day ?? 0); | ||
| 86 | - $remain_day = $item['deploy_build']['service_duration'] - $compliance_day; | 75 | + if(in_array($item->id,$this->projectId)){//已开始优化的时间结算 |
| 76 | + $optimizeModel = new DeployOptimize(); | ||
| 77 | + $opInfo = $optimizeModel->read(['project_id'=>$item->id],['start_date']); | ||
| 78 | + if($opInfo === false){ | ||
| 79 | + continue; | ||
| 80 | + } | ||
| 81 | + $diff = time() - strtotime($opInfo['start_date'] ?? $item->uptime); | ||
| 82 | + $remain_day = $item['deploy_build']['service_duration'] - floor($diff / (60 * 60 * 24)); | ||
| 87 | }else{ | 83 | }else{ |
| 88 | - if($item->uptime){ | ||
| 89 | - $diff = time() - strtotime($item->uptime); | ||
| 90 | - $item->finish_remain_day = floor($diff / (60 * 60 * 24)); | ||
| 91 | - $remain_day = $item['deploy_build']['service_duration'] - floor($diff / (60 * 60 * 24)); | 84 | + if($item['type'] == Project::TYPE_TWO){ |
| 85 | + $compliance_day = ($item->finish_remain_day ?? 0); | ||
| 86 | + $remain_day = $item['deploy_build']['service_duration'] - $compliance_day; | ||
| 92 | }else{ | 87 | }else{ |
| 93 | - $remain_day = $item['deploy_build']['service_duration']; | 88 | + if($item->uptime){ |
| 89 | + $diff = time() - strtotime($item->uptime); | ||
| 90 | + $item->finish_remain_day = floor($diff / (60 * 60 * 24)); | ||
| 91 | + $remain_day = $item['deploy_build']['service_duration'] - floor($diff / (60 * 60 * 24)); | ||
| 92 | + }else{ | ||
| 93 | + $remain_day = $item['deploy_build']['service_duration']; | ||
| 94 | + } | ||
| 94 | } | 95 | } |
| 95 | } | 96 | } |
| 97 | + $item->remain_day = ($remain_day > 0 ? $remain_day : 0); | ||
| 96 | } | 98 | } |
| 97 | - $item->remain_day = ($remain_day > 0 ? $remain_day : 0); | 99 | + $item->save(); |
| 98 | // if($item->remain_day == 0){ | 100 | // if($item->remain_day == 0){ |
| 99 | // $item->extend_type = Project::TYPE_FIVE; | 101 | // $item->extend_type = Project::TYPE_FIVE; |
| 100 | // $item->site_status = Project::TYPE_ONE;//关闭站点 | 102 | // $item->site_status = Project::TYPE_ONE;//关闭站点 |
| @@ -105,7 +107,6 @@ class RemainDay extends Command | @@ -105,7 +107,6 @@ class RemainDay extends Command | ||
| 105 | // curl_get('https://'.$domainInfos['domain'].'/api/stop_or_start_website/'); | 107 | // curl_get('https://'.$domainInfos['domain'].'/api/stop_or_start_website/'); |
| 106 | // } | 108 | // } |
| 107 | // } | 109 | // } |
| 108 | - $item->save(); | ||
| 109 | } | 110 | } |
| 110 | } | 111 | } |
| 111 | } | 112 | } |
| @@ -34,15 +34,13 @@ class CountAllProject extends Command | @@ -34,15 +34,13 @@ class CountAllProject extends Command | ||
| 34 | 34 | ||
| 35 | 35 | ||
| 36 | public function handle(){ | 36 | public function handle(){ |
| 37 | - $countAllModel = new AllProject; | ||
| 38 | AllProject::truncate(); | 37 | AllProject::truncate(); |
| 39 | -// $noSixData = []; | ||
| 40 | - $noSixData = $this->NoSixProject(); | ||
| 41 | - $countAllModel->insert($noSixData); | ||
| 42 | - $sixData = $this->sixProject(); | ||
| 43 | - $countAllModel->insert($sixData); | ||
| 44 | - $data = array_merge($noSixData ?? [],$sixData ?? []); | ||
| 45 | - echo 'success:' .count($data) . PHP_EOL . date('Y-m-d H:i:s'); | 38 | + $noSixCount = $this->NoSixProject(); |
| 39 | + echo 'success:' .$noSixCount . PHP_EOL . date('Y-m-d H:i:s'); | ||
| 40 | + $sixCount = $this->sixProject(); | ||
| 41 | + echo 'success:' .$sixCount . PHP_EOL . date('Y-m-d H:i:s'); | ||
| 42 | + $data = $noSixCount + $sixCount; | ||
| 43 | + echo 'success:' .$data . PHP_EOL . date('Y-m-d H:i:s'); | ||
| 46 | return true; | 44 | return true; |
| 47 | } | 45 | } |
| 48 | 46 | ||
| @@ -54,16 +52,16 @@ class CountAllProject extends Command | @@ -54,16 +52,16 @@ class CountAllProject extends Command | ||
| 54 | * @time :2024/11/11 15:21 | 52 | * @time :2024/11/11 15:21 |
| 55 | */ | 53 | */ |
| 56 | public function NoSixProject(){ | 54 | public function NoSixProject(){ |
| 57 | - $res_data = []; | 55 | + $count = 0; |
| 58 | $i = 1; | 56 | $i = 1; |
| 59 | while (true) { | 57 | while (true) { |
| 60 | - $url = 'https://quanqiusou.cn/extend_api/api/projects.php?page=' . $i . '&pagesize=50'; | 58 | + $url = 'https://quanqiusou.cn/extend_api/api/projects.php?page=' . $i . '&pagesize=500'; |
| 61 | $result = $this->httpGetProxy($url); | 59 | $result = $this->httpGetProxy($url); |
| 62 | // 检查结果是否成功,并且结构符合预期 | 60 | // 检查结果是否成功,并且结构符合预期 |
| 63 | if (isset($result['data']['data']) && is_array($result['data']['data'])) { | 61 | if (isset($result['data']['data']) && is_array($result['data']['data'])) { |
| 64 | $data = $result['data']['data']; | 62 | $data = $result['data']['data']; |
| 65 | // 如果当前页没有数据,跳出循环 | 63 | // 如果当前页没有数据,跳出循环 |
| 66 | - if ($i == 2) { | 64 | + if (empty($data)) { |
| 67 | break; | 65 | break; |
| 68 | } | 66 | } |
| 69 | foreach ($data as $k => $v){ | 67 | foreach ($data as $k => $v){ |
| @@ -81,7 +79,9 @@ class CountAllProject extends Command | @@ -81,7 +79,9 @@ class CountAllProject extends Command | ||
| 81 | $data[$k] = $v; | 79 | $data[$k] = $v; |
| 82 | } | 80 | } |
| 83 | echo '执行页数:' . $i . PHP_EOL . date('Y-m-d H:i:s') . PHP_EOL; | 81 | echo '执行页数:' . $i . PHP_EOL . date('Y-m-d H:i:s') . PHP_EOL; |
| 84 | - $res_data = array_merge($res_data, $data); | 82 | + $count = $count + count($data); |
| 83 | + $countAllModel = new AllProject; | ||
| 84 | + $countAllModel->insert($data); | ||
| 85 | $i++; | 85 | $i++; |
| 86 | // 每次请求后增加 1 秒延迟,防止请求过于频繁 | 86 | // 每次请求后增加 1 秒延迟,防止请求过于频繁 |
| 87 | sleep(1); | 87 | sleep(1); |
| @@ -91,7 +91,7 @@ class CountAllProject extends Command | @@ -91,7 +91,7 @@ class CountAllProject extends Command | ||
| 91 | break; | 91 | break; |
| 92 | } | 92 | } |
| 93 | } | 93 | } |
| 94 | - return $res_data; | 94 | + return $count; |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | public function httpGetProxy($url){ | 97 | public function httpGetProxy($url){ |
| @@ -115,6 +115,7 @@ class CountAllProject extends Command | @@ -115,6 +115,7 @@ class CountAllProject extends Command | ||
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | public function sixProject(){ | 117 | public function sixProject(){ |
| 118 | + $count = 0; | ||
| 118 | $projectModel = new Project(); | 119 | $projectModel = new Project(); |
| 119 | $manageModel = new ManageHr(); | 120 | $manageModel = new ManageHr(); |
| 120 | $i = 1; | 121 | $i = 1; |
| @@ -127,6 +128,7 @@ class CountAllProject extends Command | @@ -127,6 +128,7 @@ class CountAllProject extends Command | ||
| 127 | if(empty($lists) || empty($lists['list'])){ | 128 | if(empty($lists) || empty($lists['list'])){ |
| 128 | break; | 129 | break; |
| 129 | } | 130 | } |
| 131 | + $data = []; | ||
| 130 | echo '执行页数:' . $i . PHP_EOL . date('Y-m-d H:i:s') . PHP_EOL; | 132 | echo '执行页数:' . $i . PHP_EOL . date('Y-m-d H:i:s') . PHP_EOL; |
| 131 | foreach ($lists['list'] as $k => $v){ | 133 | foreach ($lists['list'] as $k => $v){ |
| 132 | $data[] = [ | 134 | $data[] = [ |
| @@ -157,9 +159,13 @@ class CountAllProject extends Command | @@ -157,9 +159,13 @@ class CountAllProject extends Command | ||
| 157 | 'updated_at'=>date('Y-m-d H:i:s'), | 159 | 'updated_at'=>date('Y-m-d H:i:s'), |
| 158 | ]; | 160 | ]; |
| 159 | } | 161 | } |
| 162 | + $count = $count + count($data); | ||
| 163 | + $countAllModel = new AllProject; | ||
| 164 | + $countAllModel->insert($data); | ||
| 165 | + sleep(1); | ||
| 160 | $i++; | 166 | $i++; |
| 161 | } | 167 | } |
| 162 | - return $data; | 168 | + return $count; |
| 163 | } | 169 | } |
| 164 | 170 | ||
| 165 | /** | 171 | /** |
| @@ -57,12 +57,13 @@ class UpdateRoute extends Command | @@ -57,12 +57,13 @@ class UpdateRoute extends Command | ||
| 57 | */ | 57 | */ |
| 58 | public function handle(){ | 58 | public function handle(){ |
| 59 | $projectModel = new Project(); | 59 | $projectModel = new Project(); |
| 60 | - $list = $projectModel->list(['id'=>['=',475]]); | 60 | + $list = $projectModel->list(['id'=>['=',2503]]); |
| 61 | $data = []; | 61 | $data = []; |
| 62 | foreach ($list as $v){ | 62 | foreach ($list as $v){ |
| 63 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; | 63 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; |
| 64 | ProjectServer::useProject($v['id']); | 64 | ProjectServer::useProject($v['id']); |
| 65 | - $this->updateProduct(); | 65 | + $this->getProduct(); |
| 66 | +// $this->updateProduct(); | ||
| 66 | DB::disconnect('custom_mysql'); | 67 | DB::disconnect('custom_mysql'); |
| 67 | } | 68 | } |
| 68 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; | 69 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; |
| @@ -9,7 +9,9 @@ namespace App\Http\Controllers\Api; | @@ -9,7 +9,9 @@ namespace App\Http\Controllers\Api; | ||
| 9 | 9 | ||
| 10 | use App\Enums\Common\Code; | 10 | use App\Enums\Common\Code; |
| 11 | use App\Http\Logic\Bside\User\UserLoginLogic; | 11 | use App\Http\Logic\Bside\User\UserLoginLogic; |
| 12 | +use App\Models\Blog\Blog; | ||
| 12 | use App\Models\Domain\DomainInfo; | 13 | use App\Models\Domain\DomainInfo; |
| 14 | +use App\Models\News\News; | ||
| 13 | use App\Models\Product\Category; | 15 | use App\Models\Product\Category; |
| 14 | use App\Models\Product\CategoryRelated; | 16 | use App\Models\Product\CategoryRelated; |
| 15 | use App\Models\Product\Keyword; | 17 | use App\Models\Product\Keyword; |
| @@ -283,4 +285,54 @@ class PrivateController extends BaseController | @@ -283,4 +285,54 @@ class PrivateController extends BaseController | ||
| 283 | } | 285 | } |
| 284 | return $this->success($projects); | 286 | return $this->success($projects); |
| 285 | } | 287 | } |
| 288 | + | ||
| 289 | + /** | ||
| 290 | + * 获取有效时间内 新增有效URL | ||
| 291 | + * 用于自动提交Google收录 | ||
| 292 | + * @param Request $request | ||
| 293 | + * @return false|string | ||
| 294 | + */ | ||
| 295 | + public function projectNewUrl(Request $request) | ||
| 296 | + { | ||
| 297 | + $domain = trim($request->input('domain')); | ||
| 298 | + $domain_parse = parse_url($domain); | ||
| 299 | + $domain = $domain_parse['host'] ?? $domain; | ||
| 300 | + $date = trim($request->input('date')); | ||
| 301 | + | ||
| 302 | + if (empty($domain) || empty($date)) { | ||
| 303 | + return $this->error('非法参数!'); | ||
| 304 | + } | ||
| 305 | + | ||
| 306 | + $project = Project::getProjectByDomain($domain); | ||
| 307 | + if (empty($project)) { | ||
| 308 | + return $this->error('未找到当前域名对应的项目!'); | ||
| 309 | + } | ||
| 310 | + | ||
| 311 | + ProjectServer::useProject($project->id); | ||
| 312 | + $result = []; | ||
| 313 | + // 查询有效时间后 有效的产品、新闻、博客、聚合页 链接 | ||
| 314 | + $product = Product::where(['status' => Product::STATUS_ON])->where('created_at', '>=', $date)->pluck('route'); | ||
| 315 | + $news = News::where(['status' => News::STATUS_ONE])->where('release_at', '>', $date)->pluck('url'); | ||
| 316 | + $blog = Blog::where(['status' => Blog::STATUS_ONE])->where('release_at', '>', $date)->pluck('url'); | ||
| 317 | + $keyword = Keyword::where('created_at', '>', $date)->pluck('route'); | ||
| 318 | + | ||
| 319 | + // 组装链接 | ||
| 320 | + foreach ($product as $item) { | ||
| 321 | + $url = 'https://' . $domain . '/' . $item; | ||
| 322 | + array_push($result, $url); | ||
| 323 | + } | ||
| 324 | + foreach ($keyword as $item) { | ||
| 325 | + $url = 'https://' . $domain . '/' . $item; | ||
| 326 | + array_push($result, $url); | ||
| 327 | + } | ||
| 328 | + foreach ($news as $item) { | ||
| 329 | + $url = 'https://' . $domain . '/news/' . $item; | ||
| 330 | + array_push($result, $url); | ||
| 331 | + } | ||
| 332 | + foreach ($blog as $item) { | ||
| 333 | + $url = 'https://' . $domain . '/blogs/' . $item; | ||
| 334 | + array_push($result, $url); | ||
| 335 | + } | ||
| 336 | + return $this->success($result); | ||
| 337 | + } | ||
| 286 | } | 338 | } |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :AllProjectController.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2024/11/12 9:34 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Controllers\Aside\Project; | ||
| 11 | + | ||
| 12 | +use App\Enums\Common\Code; | ||
| 13 | +use App\Http\Controllers\Aside\BaseController; | ||
| 14 | +use App\Models\Project\CountAllProject; | ||
| 15 | + | ||
| 16 | +/** | ||
| 17 | + * @remark :统计所有项目(4.0,5.0,6.0) | ||
| 18 | + * @name :AllProjectController | ||
| 19 | + * @author :lyh | ||
| 20 | + * @method :post | ||
| 21 | + * @time :2024/11/12 9:34 | ||
| 22 | + */ | ||
| 23 | +class AllProjectController extends BaseController | ||
| 24 | +{ | ||
| 25 | + /** | ||
| 26 | + * @remark :统计所有项目列表 | ||
| 27 | + * @name :lists | ||
| 28 | + * @author :lyh | ||
| 29 | + * @method :post | ||
| 30 | + * @time :2024/11/12 9:35 | ||
| 31 | + */ | ||
| 32 | + public function lists(CountAllProject $allProject){ | ||
| 33 | + $data = $allProject->lists($this->map,$this->page,$this->row); | ||
| 34 | + $this->response('success',Code::SUCCESS,$data); | ||
| 35 | + } | ||
| 36 | +} |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :DetailController.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2024/11/12 14:55 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Controllers\Bside\Product; | ||
| 11 | + | ||
| 12 | +use App\Enums\Common\Code; | ||
| 13 | +use App\Http\Controllers\Bside\BaseController; | ||
| 14 | +use App\Http\Logic\Bside\Product\DetailLogic; | ||
| 15 | +use App\Models\Product\Column; | ||
| 16 | +use App\Models\Product\Detail; | ||
| 17 | + | ||
| 18 | +class DetailController extends BaseController | ||
| 19 | +{ | ||
| 20 | + /** | ||
| 21 | + * @remark :获取产品描述页所有详情 | ||
| 22 | + * @name :getType | ||
| 23 | + * @author :lyh | ||
| 24 | + * @method :post | ||
| 25 | + * @time :2024/11/12 14:57 | ||
| 26 | + */ | ||
| 27 | + public function getType(Detail $detail){ | ||
| 28 | + $data = [ | ||
| 29 | + 'text_type' => $detail->text_type(), | ||
| 30 | + 'line_two_type' => $detail->line_two_type(), | ||
| 31 | + 'image_two_type' => $detail->image_two_type(), | ||
| 32 | + 'three_type' => $detail->three_type(), | ||
| 33 | + 'image_three_type' => $detail->image_three_type(), | ||
| 34 | + ]; | ||
| 35 | + $this->response('success',Code::SUCCESS,$data); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * @remark :获取产品描述栏目 | ||
| 40 | + * @name :getColumn | ||
| 41 | + * @author :lyh | ||
| 42 | + * @method :post | ||
| 43 | + * @time :2024/11/12 15:07 | ||
| 44 | + */ | ||
| 45 | + public function getColumn(Column $column){ | ||
| 46 | + $data = $column->list($this->map,'id',['*'],'asc'); | ||
| 47 | + $this->response('success',Code::SUCCESS,$data); | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + /** | ||
| 51 | + * @remark :保存切换栏 | ||
| 52 | + * @name :saveColumn | ||
| 53 | + * @author :lyh | ||
| 54 | + * @method :post | ||
| 55 | + * @time :2024/11/12 15:13 | ||
| 56 | + */ | ||
| 57 | + public function saveColumn(DetailLogic $logic){ | ||
| 58 | + $this->request->validate([ | ||
| 59 | + 'column_name'=>'required' | ||
| 60 | + ],[ | ||
| 61 | + 'column_name.required' => '栏目名称不能为空' | ||
| 62 | + ]); | ||
| 63 | + $data = $logic->saveColumn(); | ||
| 64 | + $this->response('success',Code::SUCCESS,$data); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + /** | ||
| 68 | + * @remark :保存数据 | ||
| 69 | + * @name :saveDetail | ||
| 70 | + * @author :lyh | ||
| 71 | + * @method :post | ||
| 72 | + * @time :2024/11/12 16:24 | ||
| 73 | + */ | ||
| 74 | + public function saveDetail(){ | ||
| 75 | + $this->request->validate([ | ||
| 76 | + 'product_id'=>'required', | ||
| 77 | + 'data'=>'required', | ||
| 78 | + ],[ | ||
| 79 | + 'product_id.required' => '产品id不能为空', | ||
| 80 | + 'data.required' => 'data不能为空', | ||
| 81 | + ]); | ||
| 82 | + | ||
| 83 | + | ||
| 84 | + } | ||
| 85 | +} |
| @@ -160,6 +160,9 @@ class FileController | @@ -160,6 +160,9 @@ class FileController | ||
| 160 | $suffix = array_pop($nameArr) ?? 'jpg'; | 160 | $suffix = array_pop($nameArr) ?? 'jpg'; |
| 161 | $nameStr = implode('-', $nameArr); | 161 | $nameStr = implode('-', $nameArr); |
| 162 | $enName = generateRoute(Translate::tran($nameStr, 'en')); | 162 | $enName = generateRoute(Translate::tran($nameStr, 'en')); |
| 163 | + if(substr($enName, 0, 1) === '-'){ | ||
| 164 | + $enName = md5(uniqid().$project_id.rand(1,1000)); | ||
| 165 | + } | ||
| 163 | $fileName = $enName; | 166 | $fileName = $enName; |
| 164 | $i=1; | 167 | $i=1; |
| 165 | while($this->onlyName($enName.'.'.$suffix,$project_id)){ | 168 | while($this->onlyName($enName.'.'.$suffix,$project_id)){ |
| @@ -229,9 +229,13 @@ class ImageController extends Controller | @@ -229,9 +229,13 @@ class ImageController extends Controller | ||
| 229 | $nameArr = explode('.',$name); | 229 | $nameArr = explode('.',$name); |
| 230 | $suffix = array_pop($nameArr) ?? 'jpg'; | 230 | $suffix = array_pop($nameArr) ?? 'jpg'; |
| 231 | $nameStr = implode('-', $nameArr); | 231 | $nameStr = implode('-', $nameArr); |
| 232 | - $enName = generateRoute(Translate::tran($nameStr, 'en')); | 232 | + $tran_name = Translate::tran($nameStr, 'en'); |
| 233 | + if(is_array($tran_name)){ | ||
| 234 | + $tran_name = $tran_name[0]; | ||
| 235 | + } | ||
| 236 | + $enName = generateRoute($tran_name); | ||
| 233 | if(substr($enName, 0, 1) === '-'){ | 237 | if(substr($enName, 0, 1) === '-'){ |
| 234 | - $enName = $nameStr; | 238 | + $enName = md5(uniqid().$project_id.rand(1,1000));; |
| 235 | } | 239 | } |
| 236 | $fileName = $enName; | 240 | $fileName = $enName; |
| 237 | $i=1; | 241 | $i=1; |
app/Http/Logic/Bside/Product/DetailLogic.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :DetailLogic.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2024/11/12 15:14 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Logic\Bside\Product; | ||
| 11 | + | ||
| 12 | +use App\Http\Logic\Bside\BaseLogic; | ||
| 13 | +use App\Models\Product\Column; | ||
| 14 | +use App\Models\Product\Detail; | ||
| 15 | + | ||
| 16 | +class DetailLogic extends BaseLogic | ||
| 17 | +{ | ||
| 18 | + public function __construct() | ||
| 19 | + { | ||
| 20 | + parent::__construct(); | ||
| 21 | + $this->param = $this->requestAll; | ||
| 22 | + $this->model = new Detail(); | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * @remark :保存栏目 | ||
| 27 | + * @name :saveColumn | ||
| 28 | + * @author :lyh | ||
| 29 | + * @method :post | ||
| 30 | + * @time :2024/11/12 15:15 | ||
| 31 | + */ | ||
| 32 | + public function saveColumn(){ | ||
| 33 | + $columnModel = new Column(); | ||
| 34 | + if(isset($this->param['id']) && !empty($this->param['id'])){ | ||
| 35 | + $id = $this->param['id']; | ||
| 36 | + $rs = $columnModel->edit(['column_name'=>$this->param['column_name']],['id'=>$this->param['id']]); | ||
| 37 | + if($rs === false){ | ||
| 38 | + $this->fail('保存失败,请联系管理员'); | ||
| 39 | + } | ||
| 40 | + }else{ | ||
| 41 | + $id = $columnModel->add($this->param); | ||
| 42 | + } | ||
| 43 | + return $this->success(['id'=>$id]); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + public function saveDetail(){ | ||
| 47 | + foreach ($this->param['data'] as $k => $data){ | ||
| 48 | + $i = 1; | ||
| 49 | + $save_data = []; | ||
| 50 | + foreach ($data as $key => $v){ | ||
| 51 | + $save_data[] = [ | ||
| 52 | + 'sort'=>$i, | ||
| 53 | + 'column_id'=>$v['column_id'], | ||
| 54 | + 'product_id'=>$this->param['product_id'], | ||
| 55 | + 'title'=>$v['title'] ?? '', | ||
| 56 | + 'content'=>json_encode($v['content'] ?? []), | ||
| 57 | + 'css'=>json_encode($v['css'] ?? []), | ||
| 58 | + 'created_at'=>date('Y-m-d H:i:s'), | ||
| 59 | + 'updated_at'=>date('Y-m-d H:i:s') | ||
| 60 | + ]; | ||
| 61 | + $i++; | ||
| 62 | + } | ||
| 63 | + $this->model->insert($save_data); | ||
| 64 | + } | ||
| 65 | + } | ||
| 66 | +} |
| @@ -560,7 +560,7 @@ class ProductLogic extends BaseLogic | @@ -560,7 +560,7 @@ class ProductLogic extends BaseLogic | ||
| 560 | 'related_product_id'=>Arr::arrToSet($info['related_product_id']), | 560 | 'related_product_id'=>Arr::arrToSet($info['related_product_id']), |
| 561 | 'sort'=>$info['sort'], | 561 | 'sort'=>$info['sort'], |
| 562 | 'status'=>0, | 562 | 'status'=>0, |
| 563 | - 'route'=>$info['route'], | 563 | + 'route'=>$info['title'], |
| 564 | 'product_type'=>$info['product_type'], | 564 | 'product_type'=>$info['product_type'], |
| 565 | 'created_uid'=>$this->user['id'], | 565 | 'created_uid'=>$this->user['id'], |
| 566 | 'created_at'=>date('Y-m-d H:i:s'), | 566 | 'created_at'=>date('Y-m-d H:i:s'), |
| @@ -277,6 +277,7 @@ class UserLoginLogic | @@ -277,6 +277,7 @@ class UserLoginLogic | ||
| 277 | $info['service_duration'] = $project['deploy_build']['service_duration'] ?? 0; | 277 | $info['service_duration'] = $project['deploy_build']['service_duration'] ?? 0; |
| 278 | $info['is_comment'] = $project['deploy_build']['is_comment'] ?? 0; | 278 | $info['is_comment'] = $project['deploy_build']['is_comment'] ?? 0; |
| 279 | $info['remain_day'] = $project['remain_day'] ?? 0; | 279 | $info['remain_day'] = $project['remain_day'] ?? 0; |
| 280 | + $info['type'] = $project['type'] ?? 1; | ||
| 280 | if($info['is_customized'] == 1){ | 281 | if($info['is_customized'] == 1){ |
| 281 | $info['is_visualization'] = json_decode($project['is_visualization']); | 282 | $info['is_visualization'] = json_decode($project['is_visualization']); |
| 282 | } | 283 | } |
| @@ -20,7 +20,6 @@ class Blog extends Base | @@ -20,7 +20,6 @@ class Blog extends Base | ||
| 20 | if(!$value){ | 20 | if(!$value){ |
| 21 | return date('Y-m-d H:i:s', strtotime($this->getAttribute('created_at'))); | 21 | return date('Y-m-d H:i:s', strtotime($this->getAttribute('created_at'))); |
| 22 | } | 22 | } |
| 23 | - | ||
| 24 | return $value; | 23 | return $value; |
| 25 | } | 24 | } |
| 26 | } | 25 | } |
app/Models/Product/Column.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :Column.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2024/11/12 14:14 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Models\Product; | ||
| 11 | + | ||
| 12 | +use App\Models\Base; | ||
| 13 | + | ||
| 14 | +class Column extends Base | ||
| 15 | +{ | ||
| 16 | + //设置关联表名 | ||
| 17 | + protected $table = 'gl_product_column'; | ||
| 18 | + //连接数据库 | ||
| 19 | + protected $connection = 'custom_mysql'; | ||
| 20 | + | ||
| 21 | +} |
app/Models/Product/Detail.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :Detail.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2024/11/12 14:13 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Models\Product; | ||
| 11 | + | ||
| 12 | +use App\Models\Base; | ||
| 13 | + | ||
| 14 | +class Detail extends Base | ||
| 15 | +{ | ||
| 16 | + //设置关联表名 | ||
| 17 | + protected $table = 'gl_product_detail'; | ||
| 18 | + //连接数据库 | ||
| 19 | + protected $connection = 'custom_mysql'; | ||
| 20 | + | ||
| 21 | + /** | ||
| 22 | + * @remark :文本框类型 | ||
| 23 | + * @name :text_box | ||
| 24 | + * @author :lyh | ||
| 25 | + * @method :post | ||
| 26 | + * @time :2024/11/12 14:15 | ||
| 27 | + */ | ||
| 28 | + public function text_type(){ | ||
| 29 | + return [ | ||
| 30 | + 1=>'富文本框', | ||
| 31 | + 2=>'多图模块', | ||
| 32 | + 3=>'单图文案', | ||
| 33 | + ]; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * @remark :多图框类型 | ||
| 38 | + * @name :line_number | ||
| 39 | + * @author :lyh | ||
| 40 | + * @method :post | ||
| 41 | + * @time :2024/11/12 14:15 | ||
| 42 | + */ | ||
| 43 | + public function line_two_type(){ | ||
| 44 | + return [ | ||
| 45 | + 1=>'1行', | ||
| 46 | + 2=>'2行', | ||
| 47 | + 3=>'3行', | ||
| 48 | + 4=>'4行', | ||
| 49 | + 5=>'5行', | ||
| 50 | + ]; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * @remark :图片框类型 | ||
| 55 | + * @name :line_number | ||
| 56 | + * @author :lyh | ||
| 57 | + * @method :post | ||
| 58 | + * @time :2024/11/12 14:15 | ||
| 59 | + */ | ||
| 60 | + public function image_two_type(){ | ||
| 61 | + return [ | ||
| 62 | + 1=>'1张图', | ||
| 63 | + 2=>'2张图', | ||
| 64 | + 3=>'3张图', | ||
| 65 | + 4=>'4张图', | ||
| 66 | + 5=>'5张图', | ||
| 67 | + ]; | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + /** | ||
| 71 | + * @remark :图片文本框类型 | ||
| 72 | + * @name :line_number | ||
| 73 | + * @author :lyh | ||
| 74 | + * @method :post | ||
| 75 | + * @time :2024/11/12 14:15 | ||
| 76 | + */ | ||
| 77 | + public function three_type(){ | ||
| 78 | + return [ | ||
| 79 | + 1=>'左图右文', | ||
| 80 | + 2=>'右图左文', | ||
| 81 | + ]; | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + /** | ||
| 85 | + * @remark :图片文本框类型 | ||
| 86 | + * @name :line_number | ||
| 87 | + * @author :lyh | ||
| 88 | + * @method :post | ||
| 89 | + * @time :2024/11/12 14:15 | ||
| 90 | + */ | ||
| 91 | + public function image_three_type(){ | ||
| 92 | + return [ | ||
| 93 | + 1=>'图片悬浮', | ||
| 94 | + 2=>'图片固定', | ||
| 95 | + ]; | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | +} |
| @@ -136,6 +136,8 @@ class ProjectServer | @@ -136,6 +136,8 @@ class ProjectServer | ||
| 136 | self::init404Page($project_id); | 136 | self::init404Page($project_id); |
| 137 | //初始化模块数据 | 137 | //初始化模块数据 |
| 138 | self::initModule($project_id); | 138 | self::initModule($project_id); |
| 139 | + //初始化切换栏 | ||
| 140 | + self::initColumn(); | ||
| 139 | //初始化search页面 | 141 | //初始化search页面 |
| 140 | // self::initSearchPage($project_id); | 142 | // self::initSearchPage($project_id); |
| 141 | DB::disconnect('custom_mysql'); | 143 | DB::disconnect('custom_mysql'); |
| @@ -163,6 +165,27 @@ class ProjectServer | @@ -163,6 +165,27 @@ class ProjectServer | ||
| 163 | } | 165 | } |
| 164 | return true; | 166 | return true; |
| 165 | } | 167 | } |
| 168 | + | ||
| 169 | + /** | ||
| 170 | + * @remark :初始化产品切换栏 | ||
| 171 | + * @name :initColumn | ||
| 172 | + * @author :lyh | ||
| 173 | + * @method :post | ||
| 174 | + * @time :2024/11/12 11:39 | ||
| 175 | + */ | ||
| 176 | + public static function initColumn(){ | ||
| 177 | + $info = DB::connection('custom_mysql')->table('gl_product_column')->first(); | ||
| 178 | + if(empty($info)){ | ||
| 179 | + $data = [ | ||
| 180 | + 'column_name'=>'Product Details', | ||
| 181 | + 'created_at' => date('Y-m-d H:i:s'), | ||
| 182 | + 'updated_at' => date('Y-m-d H:i:s') | ||
| 183 | + ]; | ||
| 184 | + DB::connection('custom_mysql')->table('gl_product_column')->insert($data); | ||
| 185 | + } | ||
| 186 | + return true; | ||
| 187 | + } | ||
| 188 | + | ||
| 166 | /** | 189 | /** |
| 167 | * @remark :菜单 | 190 | * @remark :菜单 |
| 168 | * @name :initGroup | 191 | * @name :initGroup |
| @@ -39,6 +39,9 @@ Route::any('valid_user', [\App\Http\Controllers\Api\PrivateController::class, 'v | @@ -39,6 +39,9 @@ Route::any('valid_user', [\App\Http\Controllers\Api\PrivateController::class, 'v | ||
| 39 | Route::any('getAutoToken', [\App\Http\Controllers\Api\PrivateController::class, 'getAutoToken'])->name('api.getAutoToken'); | 39 | Route::any('getAutoToken', [\App\Http\Controllers\Api\PrivateController::class, 'getAutoToken'])->name('api.getAutoToken'); |
| 40 | // 特殊项目 有效产品路由 | 40 | // 特殊项目 有效产品路由 |
| 41 | Route::any('valid_product_route', [\App\Http\Controllers\Api\PrivateController::class, 'getProductRoute'])->name('api.valid_product_route'); | 41 | Route::any('valid_product_route', [\App\Http\Controllers\Api\PrivateController::class, 'getProductRoute'])->name('api.valid_product_route'); |
| 42 | +// 6.0项目新增有效链接 - 提交Google | ||
| 43 | +Route::any('project_new_url', [\App\Http\Controllers\Api\PrivateController::class, 'projectNewUrl'])->name('api.project_new_url'); | ||
| 44 | + | ||
| 42 | 45 | ||
| 43 | // --------------------- 站群服务 ------------------------------------------ | 46 | // --------------------- 站群服务 ------------------------------------------ |
| 44 | // 获取项目信息 | 47 | // 获取项目信息 |
| @@ -493,6 +493,11 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -493,6 +493,11 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 493 | Route::any('/fb_relay_detail_list', [Aside\Task\AdsController::class, 'fbRelayDetail'])->name('admin.fb_ads_relay_detail_list'); | 493 | Route::any('/fb_relay_detail_list', [Aside\Task\AdsController::class, 'fbRelayDetail'])->name('admin.fb_ads_relay_detail_list'); |
| 494 | Route::any('/fb_relay_count', [Aside\Task\AdsController::class, 'fbRelayCount'])->name('admin.fb_relay_count'); | 494 | Route::any('/fb_relay_count', [Aside\Task\AdsController::class, 'fbRelayCount'])->name('admin.fb_relay_count'); |
| 495 | }); | 495 | }); |
| 496 | + | ||
| 497 | + //统计所有项目相关 | ||
| 498 | + Route::prefix('all_project')->group(function () { | ||
| 499 | + Route::any('/', [Aside\Project\AllProjectController::class, 'lists'])->name('admin.all_project_lists'); | ||
| 500 | + }); | ||
| 496 | }); | 501 | }); |
| 497 | 502 | ||
| 498 | //无需登录验证的路由组 | 503 | //无需登录验证的路由组 |
-
请 注册 或 登录 后发表评论