Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
14 个修改的文件
包含
318 行增加
和
23 行删除
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Console\Commands\Domain; | ||
| 4 | + | ||
| 5 | +use App\Models\Devops\Servers; | ||
| 6 | +use App\Models\Domain\DomainInfo; | ||
| 7 | +use App\Models\Project\Project; | ||
| 8 | +use App\Models\Project\ProjectServerBackup; | ||
| 9 | +use App\Services\BatchExportService; | ||
| 10 | +use Illuminate\Console\Command; | ||
| 11 | + | ||
| 12 | +class EmergencyResultExport extends Command | ||
| 13 | +{ | ||
| 14 | + protected $signature = 'emergency_result_export'; | ||
| 15 | + protected $description = '恢复项目服务器结果导出'; | ||
| 16 | + | ||
| 17 | + public function handle() | ||
| 18 | + { | ||
| 19 | + $map = ['项目id', '名称', '域名', '现属服务器', '恢复结果',]; | ||
| 20 | + | ||
| 21 | + //获取所有恢复项目 | ||
| 22 | + $backup_model = new ProjectServerBackup(); | ||
| 23 | + $backup_list = $backup_model->orderBy('status', 'asc')->get(); | ||
| 24 | + $data = []; | ||
| 25 | + if ($backup_list->count() > 0) { | ||
| 26 | + $project_model = new Project(); | ||
| 27 | + $domain_model = new DomainInfo(); | ||
| 28 | + $server_model = new Servers(); | ||
| 29 | + foreach ($backup_list as $value) { | ||
| 30 | + $project_info = $project_model->read(['id' => $value->project_id], ['id', 'company']); | ||
| 31 | + $domain_info = $domain_model->read(['project_id' => $value->project_id], ['domain']); | ||
| 32 | + | ||
| 33 | + //获取现属服务器 | ||
| 34 | + if ($value->status == 1) { | ||
| 35 | + $server_info = $server_model->read(['id' => $value->server_id], ['server_name']); | ||
| 36 | + $server_name = $server_info['server_name']; | ||
| 37 | + $status = '恢复成功'; | ||
| 38 | + } elseif ($value->status == 2) { | ||
| 39 | + $server_name = '硅谷云服务器'; | ||
| 40 | + $status = '继续留在240'; | ||
| 41 | + } elseif ($value->status == 3) { | ||
| 42 | + $server_name = '未知'; | ||
| 43 | + $status = '恢复失败:项目解除了域名绑定'; | ||
| 44 | + } else { | ||
| 45 | + $server_name = '未知'; | ||
| 46 | + $status = '恢复失败:域名解析未在6.0服务器'; | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + $data[] = [ | ||
| 50 | + $value->project_id, | ||
| 51 | + $project_info ? $project_info['company'] : '未知', | ||
| 52 | + $domain_info ? $domain_info['domain'] : '未知', | ||
| 53 | + $server_name, | ||
| 54 | + $status | ||
| 55 | + ]; | ||
| 56 | + } | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + //生成文件,发送到客户端 | ||
| 60 | + if ($data) { | ||
| 61 | + $table = new BatchExportService("项目站点恢复结果导出"); | ||
| 62 | + $file = $table->head($map)->data($data)->save(); | ||
| 63 | + if (!$file) { | ||
| 64 | + $this->output('文件生成失败,请重试'); | ||
| 65 | + }else{ | ||
| 66 | + $this->output('export success'); | ||
| 67 | + } | ||
| 68 | + }else{ | ||
| 69 | + $this->output('no data'); | ||
| 70 | + } | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + /** | ||
| 74 | + * 输出处理日志 | ||
| 75 | + * @param $message | ||
| 76 | + */ | ||
| 77 | + public function output($message) | ||
| 78 | + { | ||
| 79 | + echo date('Y-m-d H:i:s') . ' | ' . $message . PHP_EOL; | ||
| 80 | + } | ||
| 81 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Console\Commands\Domain; | ||
| 4 | + | ||
| 5 | +use App\Models\Devops\ServersIp; | ||
| 6 | +use App\Models\Domain\DomainInfo; | ||
| 7 | +use App\Models\Project\Project; | ||
| 8 | +use App\Services\BatchExportService; | ||
| 9 | +use Illuminate\Console\Command; | ||
| 10 | +use Symfony\Component\Process\Process; | ||
| 11 | + | ||
| 12 | +class ProjectDomainCheck extends Command | ||
| 13 | +{ | ||
| 14 | + protected $signature = 'project_domain_check'; | ||
| 15 | + protected $description = '筛选域名解析不统一的项目'; | ||
| 16 | + | ||
| 17 | + public function handle() | ||
| 18 | + { | ||
| 19 | + $map = ['项目id', '名称', '域名', '项目所选IP']; | ||
| 20 | + | ||
| 21 | + //获取所有恢复项目 | ||
| 22 | + $domain_model = new DomainInfo(); | ||
| 23 | + $domain_list = $domain_model->select(['id', 'domain', 'project_id'])->where('status', 1)->where('project_id', '>', 0)->where('id', '>', 3)->get(); | ||
| 24 | + $data = []; | ||
| 25 | + if ($domain_list->count() > 0) { | ||
| 26 | + $project_model = new Project(); | ||
| 27 | + $server_ip_model = new ServersIp(); | ||
| 28 | + | ||
| 29 | + foreach ($domain_list as $value) { | ||
| 30 | + $project_info = $project_model->read(['id' => $value->project_id], ['id', 'serve_id', 'company']); | ||
| 31 | + $server_ip_info = $server_ip_model->read(['id' => $project_info['serve_id']], ['ip', 'domain']); | ||
| 32 | + | ||
| 33 | + if ($this->check_cname($value->domain, $server_ip_info)) { | ||
| 34 | + continue; | ||
| 35 | + } else { | ||
| 36 | + $data[] = [ | ||
| 37 | + $value->project_id, | ||
| 38 | + $project_info['company'], | ||
| 39 | + $value->domain, | ||
| 40 | + $server_ip_info['ip'] | ||
| 41 | + ]; | ||
| 42 | + } | ||
| 43 | + } | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + //生成文件,发送到客户端 | ||
| 47 | + if ($data) { | ||
| 48 | + $table = new BatchExportService("域名解析不统一的项目结果导出"); | ||
| 49 | + $file = $table->head($map)->data($data)->save(); | ||
| 50 | + if (!$file) { | ||
| 51 | + $this->output('文件生成失败,请重试'); | ||
| 52 | + } else { | ||
| 53 | + $this->output('export success'); | ||
| 54 | + } | ||
| 55 | + } else { | ||
| 56 | + $this->output('no data'); | ||
| 57 | + } | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + /** | ||
| 61 | + * 验证是否cname或者A记录解析到目标服务器 | ||
| 62 | + * @param $domain | ||
| 63 | + * @param $server_info | ||
| 64 | + * @return mixed | ||
| 65 | + * @author zbj | ||
| 66 | + * @date 2023/11/13 | ||
| 67 | + */ | ||
| 68 | + public function check_cname($domain, $server_info) | ||
| 69 | + { | ||
| 70 | + $process = new Process(['nslookup', '-qt=a', $domain]); | ||
| 71 | + $process->run(); | ||
| 72 | + $output = explode(PHP_EOL, $process->getOutput()); | ||
| 73 | + foreach ($output as $line) { | ||
| 74 | + if ($line) { | ||
| 75 | + $checkA = strpos($line, $server_info['ip']) !== false; | ||
| 76 | + if ($checkA) { | ||
| 77 | + return $domain; | ||
| 78 | + } | ||
| 79 | + } | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + //是否cname | ||
| 83 | + $process = new Process(['nslookup', '-qt=cname', $domain]); | ||
| 84 | + $process->run(); | ||
| 85 | + $output = explode(PHP_EOL, $process->getOutput()); | ||
| 86 | + foreach ($output as $line) { | ||
| 87 | + if ($line) { | ||
| 88 | + $checkCname = (strpos($line, $server_info['domain']) !== false); | ||
| 89 | + if ($checkCname) { | ||
| 90 | + return $domain; | ||
| 91 | + } | ||
| 92 | + } | ||
| 93 | + } | ||
| 94 | + return false; | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + /** | ||
| 98 | + * 输出处理日志 | ||
| 99 | + * @param $message | ||
| 100 | + */ | ||
| 101 | + public function output($message) | ||
| 102 | + { | ||
| 103 | + echo date('Y-m-d H:i:s') . ' | ' . $message . PHP_EOL; | ||
| 104 | + } | ||
| 105 | +} |
| @@ -56,15 +56,15 @@ class UpdateRoute extends Command | @@ -56,15 +56,15 @@ class UpdateRoute extends Command | ||
| 56 | */ | 56 | */ |
| 57 | public function handle(){ | 57 | public function handle(){ |
| 58 | $projectModel = new Project(); | 58 | $projectModel = new Project(); |
| 59 | - $list = $projectModel->list(['id'=>['in',[2321]]]); | 59 | + $list = $projectModel->list(['id'=>['in',[1871]]]); |
| 60 | $data = []; | 60 | $data = []; |
| 61 | foreach ($list as $v){ | 61 | foreach ($list as $v){ |
| 62 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; | 62 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; |
| 63 | ProjectServer::useProject($v['id']); | 63 | ProjectServer::useProject($v['id']); |
| 64 | -// $this->getProduct(); | 64 | + $this->getProduct(); |
| 65 | // $this->setProductKeyword(); | 65 | // $this->setProductKeyword(); |
| 66 | // $this->getBlog(); | 66 | // $this->getBlog(); |
| 67 | - $this->setCustomRoute($v['id']); | 67 | +// $this->setCustomRoute($v['id']); |
| 68 | DB::disconnect('custom_mysql'); | 68 | DB::disconnect('custom_mysql'); |
| 69 | } | 69 | } |
| 70 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; | 70 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; |
| @@ -222,18 +222,18 @@ class UpdateRoute extends Command | @@ -222,18 +222,18 @@ class UpdateRoute extends Command | ||
| 222 | if(!empty($lists)){ | 222 | if(!empty($lists)){ |
| 223 | foreach ($lists as $v){ | 223 | foreach ($lists as $v){ |
| 224 | if(!empty($v['route'])){ | 224 | if(!empty($v['route'])){ |
| 225 | -// $tag = "-product"; | ||
| 226 | -// if (!(substr($v['route'], -strlen($tag)) === $tag)) { | ||
| 227 | -// echo date('Y-m-d H:i:s') . '拼接'.$tag . PHP_EOL; | ||
| 228 | -// $route = $v['route'].$tag; | ||
| 229 | -// // 如果不是以 '-product' 结尾,则拼接上 '-product' | ||
| 230 | -// $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']); | ||
| 231 | -// $productModel->edit(['route'=>$route],['id'=>$v['id']]); | ||
| 232 | -// }else{ | 225 | + $tag = "-product"; |
| 226 | + if (!(substr($v['route'], -strlen($tag)) === $tag)) { | ||
| 227 | + echo date('Y-m-d H:i:s') . '拼接'.$tag . PHP_EOL; | ||
| 228 | + $route = $v['route'].$tag; | ||
| 229 | + // 如果不是以 '-product' 结尾,则拼接上 '-product' | ||
| 230 | + $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']); | ||
| 231 | + $productModel->edit(['route'=>$route],['id'=>$v['id']]); | ||
| 232 | + }else{ | ||
| 233 | echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL; | 233 | echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL; |
| 234 | $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']); | 234 | $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']); |
| 235 | $productModel->edit(['route'=>$route],['id'=>$v['id']]); | 235 | $productModel->edit(['route'=>$route],['id'=>$v['id']]); |
| 236 | -// } | 236 | + } |
| 237 | continue; | 237 | continue; |
| 238 | }else{ | 238 | }else{ |
| 239 | echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL; | 239 | echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL; |
| @@ -948,6 +948,17 @@ function urlSafeBase64Encode($data = '') { | @@ -948,6 +948,17 @@ function urlSafeBase64Encode($data = '') { | ||
| 948 | return $base64; | 948 | return $base64; |
| 949 | } | 949 | } |
| 950 | 950 | ||
| 951 | +/** | ||
| 952 | + * @remark :获取随机位数字符串 | ||
| 953 | + * @name :generateRandomString | ||
| 954 | + * @author :lyh | ||
| 955 | + * @method :post | ||
| 956 | + * @time :2024/9/14 16:45 | ||
| 957 | + */ | ||
| 958 | +function generateRandomString($length) { | ||
| 959 | + return substr(str_shuffle(str_repeat($x = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', ceil($length / strlen($x)))), 1, $length); | ||
| 960 | +} | ||
| 961 | + | ||
| 951 | 962 | ||
| 952 | 963 | ||
| 953 | 964 |
| @@ -151,4 +151,20 @@ class IndexController extends BaseController | @@ -151,4 +151,20 @@ class IndexController extends BaseController | ||
| 151 | $data = ['token'=>$token,'main_lang_id'=>$info['main_lang_id'],'language_info'=>$languageInfo]; | 151 | $data = ['token'=>$token,'main_lang_id'=>$info['main_lang_id'],'language_info'=>$languageInfo]; |
| 152 | $this->response('success',Code::SUCCESS,$data); | 152 | $this->response('success',Code::SUCCESS,$data); |
| 153 | } | 153 | } |
| 154 | + | ||
| 155 | + /** | ||
| 156 | + * @remark :获取动态密码 | ||
| 157 | + * @name :getDynamicPassword | ||
| 158 | + * @author :lyh | ||
| 159 | + * @method :post | ||
| 160 | + * @time :2024/9/14 16:58 | ||
| 161 | + */ | ||
| 162 | + public function getDynamicPassword(){ | ||
| 163 | + $dynamic_password = Cache::get('dynamic_password'); | ||
| 164 | + if(empty($dynamic_password)){ | ||
| 165 | + $dynamic_password = generateRandomString(16); | ||
| 166 | + Cache::put('dynamic_password',$dynamic_password,5 * 3600); | ||
| 167 | + } | ||
| 168 | + $this->response('success',Code::SUCCESS,['dynamic_password'=>$dynamic_password]); | ||
| 169 | + } | ||
| 154 | } | 170 | } |
| @@ -114,6 +114,10 @@ class ComController extends BaseController | @@ -114,6 +114,10 @@ class ComController extends BaseController | ||
| 114 | if(!$is_subscribe){ | 114 | if(!$is_subscribe){ |
| 115 | $info['role_menu'] = trim(str_replace(',52,',',',','.$info['role_menu'].','),','); | 115 | $info['role_menu'] = trim(str_replace(',52,',',',','.$info['role_menu'].','),','); |
| 116 | } | 116 | } |
| 117 | + $is_comment = $this->getIsComment(); | ||
| 118 | + if(!$is_comment){ | ||
| 119 | + $info['role_menu'] = trim(str_replace(',55,',',',','.$info['role_menu'].','),','); | ||
| 120 | + } | ||
| 117 | $this->map = [ | 121 | $this->map = [ |
| 118 | 'status'=>0, | 122 | 'status'=>0, |
| 119 | 'is_role'=>0, | 123 | 'is_role'=>0, |
| @@ -157,6 +161,10 @@ class ComController extends BaseController | @@ -157,6 +161,10 @@ class ComController extends BaseController | ||
| 157 | if(!$is_subscribe){ | 161 | if(!$is_subscribe){ |
| 158 | $data[] = 52; | 162 | $data[] = 52; |
| 159 | } | 163 | } |
| 164 | + $is_comment = $this->getIsComment(); | ||
| 165 | + if(!$is_comment){ | ||
| 166 | + $data[] = 55; | ||
| 167 | + } | ||
| 160 | if(!empty($data)){ | 168 | if(!empty($data)){ |
| 161 | $this->map['id'] = ['not in',$data]; | 169 | $this->map['id'] = ['not in',$data]; |
| 162 | } | 170 | } |
| @@ -232,6 +240,17 @@ class ComController extends BaseController | @@ -232,6 +240,17 @@ class ComController extends BaseController | ||
| 232 | } | 240 | } |
| 233 | 241 | ||
| 234 | /** | 242 | /** |
| 243 | + * @remark :是否开启评论 | ||
| 244 | + * @name :getIsComment | ||
| 245 | + * @author :lyh | ||
| 246 | + * @method :post | ||
| 247 | + * @time :2024/9/14 13:32 | ||
| 248 | + */ | ||
| 249 | + public function getIsComment(){ | ||
| 250 | + return $this->user['is_subscribe'] ?? 0; | ||
| 251 | + } | ||
| 252 | + | ||
| 253 | + /** | ||
| 235 | * @name :登录用户编辑资料/修改密码 | 254 | * @name :登录用户编辑资料/修改密码 |
| 236 | * @author :liyuhang | 255 | * @author :liyuhang |
| 237 | * @method | 256 | * @method |
| @@ -153,7 +153,7 @@ class FileManageController extends BaseController | @@ -153,7 +153,7 @@ class FileManageController extends BaseController | ||
| 153 | if($file->getSize()/1024/1024 > $this->upload_config['upload_max_size']){ | 153 | if($file->getSize()/1024/1024 > $this->upload_config['upload_max_size']){ |
| 154 | $this->fail('超出最大允许上传文件大小:'. $this->upload_config['upload_max_size'] .'M'); | 154 | $this->fail('超出最大允许上传文件大小:'. $this->upload_config['upload_max_size'] .'M'); |
| 155 | } | 155 | } |
| 156 | - $extension = $file->getClientOriginalExtension(); | 156 | + $extension = strtolower($file->getClientOriginalExtension()); |
| 157 | if(!in_array($extension, explode(',', $this->upload_config['allow_file_type']))){ | 157 | if(!in_array($extension, explode(',', $this->upload_config['allow_file_type']))){ |
| 158 | $this->fail('不允许上传的文件类型'); | 158 | $this->fail('不允许上传的文件类型'); |
| 159 | } | 159 | } |
| @@ -71,7 +71,39 @@ class ProductController extends BaseController | @@ -71,7 +71,39 @@ class ProductController extends BaseController | ||
| 71 | } | 71 | } |
| 72 | $this->response('success',Code::SUCCESS,$lists); | 72 | $this->response('success',Code::SUCCESS,$lists); |
| 73 | } | 73 | } |
| 74 | - | 74 | + /** |
| 75 | + * @remark :列表 | ||
| 76 | + * @name :index | ||
| 77 | + * @author :lyh | ||
| 78 | + * @method :post | ||
| 79 | + * @time :2023/8/28 16:30 | ||
| 80 | + */ | ||
| 81 | + public function downloadProduct(Product $product) | ||
| 82 | + { | ||
| 83 | + $filed = ['id', 'project_id', 'title', 'sort' ,'thumb' ,'product_type' , 'route' ,'intro','content', | ||
| 84 | + 'category_id', 'keyword_id', 'status', 'created_uid', 'is_upgrade' ,'created_at', 'updated_at','six_read']; | ||
| 85 | + $this->order = 'sort'; | ||
| 86 | + $query = $product->orderBy($this->order ,'desc')->orderBy('id','desc'); | ||
| 87 | + $query = $this->searchParam($query); | ||
| 88 | + $lists = $query->select($filed)->paginate($this->row, ['*'], 'page', $this->page); | ||
| 89 | + if(!empty($lists)){ | ||
| 90 | + $lists = $lists->toArray(); | ||
| 91 | + $cate_data = $this->getCategoryList();//分类 | ||
| 92 | + $key_data = $this->keywordNameLists($lists['list']);//关键字 | ||
| 93 | + $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL);//获取模版id | ||
| 94 | + $userModel = new User(); | ||
| 95 | + foreach ($lists['list'] as $k=>$v){ | ||
| 96 | + $v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_PRODUCT,$v['id']); | ||
| 97 | + $v['category_id_text'] = $this->categoryName($v['id'],$cate_data); | ||
| 98 | + $v['keyword_id_text'] = $this->keywordName($v['keyword_id'],$key_data); | ||
| 99 | + $v['created_uid_text'] = $userModel->getName($v['created_uid']); | ||
| 100 | + $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL,$template_id,$v['id']); | ||
| 101 | + $v = $this->getHandleFileImage($v); | ||
| 102 | + $lists['list'][$k] = $v; | ||
| 103 | + } | ||
| 104 | + } | ||
| 105 | + $this->response('success',Code::SUCCESS,$lists); | ||
| 106 | + } | ||
| 75 | /** | 107 | /** |
| 76 | * @remark :获取当前页的所有关键字名称 | 108 | * @remark :获取当前页的所有关键字名称 |
| 77 | * @name :keywordNameLists | 109 | * @name :keywordNameLists |
| @@ -38,7 +38,7 @@ class V6UpdateLogLogic extends BaseLogic | @@ -38,7 +38,7 @@ class V6UpdateLogLogic extends BaseLogic | ||
| 38 | $id = $this->model->addReturnId($this->param); | 38 | $id = $this->model->addReturnId($this->param); |
| 39 | } | 39 | } |
| 40 | }catch (\Exception $e){ | 40 | }catch (\Exception $e){ |
| 41 | - $this->fail('保存失败,请联系管理员'); | 41 | + $this->fail('保存失败,请联系管理员,错误信息'.$e->getMessage()); |
| 42 | } | 42 | } |
| 43 | return $this->success(['id'=>$id]); | 43 | return $this->success(['id'=>$id]); |
| 44 | } | 44 | } |
| @@ -86,6 +86,7 @@ class CustomModuleCategoryLogic extends BaseLogic | @@ -86,6 +86,7 @@ class CustomModuleCategoryLogic extends BaseLogic | ||
| 86 | $this->fail('当前数据不存在或已被删除'); | 86 | $this->fail('当前数据不存在或已被删除'); |
| 87 | } | 87 | } |
| 88 | $info['image'] = getImageUrl($info['image'],$this->user['storage_type'],$this->user['project_location']); | 88 | $info['image'] = getImageUrl($info['image'],$this->user['storage_type'],$this->user['project_location']); |
| 89 | + $info['banner_image'] = getImageUrl($info['banner_image'],$this->user['storage_type'] ?? 0,$this->user['project_location']); | ||
| 89 | return $this->success($info); | 90 | return $this->success($info); |
| 90 | } | 91 | } |
| 91 | 92 | ||
| @@ -118,6 +119,9 @@ class CustomModuleCategoryLogic extends BaseLogic | @@ -118,6 +119,9 @@ class CustomModuleCategoryLogic extends BaseLogic | ||
| 118 | if(!isset($param['id']) || empty($param['id'])){ | 119 | if(!isset($param['id']) || empty($param['id'])){ |
| 119 | $param['project_id'] = $this->user['project_id']; | 120 | $param['project_id'] = $this->user['project_id']; |
| 120 | } | 121 | } |
| 122 | + if(isset($param['banner_image']) && !empty($param['banner_image'])){ | ||
| 123 | + $param['banner_image'] = str_replace_url($param['banner_image']); | ||
| 124 | + } | ||
| 121 | if(isset($param['image']) && !empty($param['image'])){ | 125 | if(isset($param['image']) && !empty($param['image'])){ |
| 122 | $param['image'] = str_replace_url($param['image']); | 126 | $param['image'] = str_replace_url($param['image']); |
| 123 | } | 127 | } |
| @@ -32,10 +32,30 @@ class NewsCategoryLogic extends BaseLogic | @@ -32,10 +32,30 @@ class NewsCategoryLogic extends BaseLogic | ||
| 32 | public function info_news_category(){ | 32 | public function info_news_category(){ |
| 33 | $info = $this->model->read($this->param); | 33 | $info = $this->model->read($this->param); |
| 34 | $info['url'] = $this->user['domain'] . $info['alias']; | 34 | $info['url'] = $this->user['domain'] . $info['alias']; |
| 35 | + if(!empty($info['banner_image'])){ | ||
| 36 | + $info['banner_image'] = getImageUrl($info['banner_image'],$this->user['storage_type'] ?? 0,$this->user['project_location']); | ||
| 37 | + } | ||
| 35 | return $this->success($info); | 38 | return $this->success($info); |
| 36 | } | 39 | } |
| 37 | 40 | ||
| 38 | /** | 41 | /** |
| 42 | + * @remark :保存处理字段 | ||
| 43 | + * @name :handleParam | ||
| 44 | + * @author :lyh | ||
| 45 | + * @method :post | ||
| 46 | + * @time :2024/9/13 9:15 | ||
| 47 | + */ | ||
| 48 | + public function handleParam($param) | ||
| 49 | + { | ||
| 50 | + if(isset($param['banner_image']) && !empty($param['banner_image'])){ | ||
| 51 | + $param['banner_image'] = str_replace_url($param['banner_image']); | ||
| 52 | + } | ||
| 53 | + if(isset($param['image']) && !empty($param['image'])){ | ||
| 54 | + $param['image'] = str_replace_url($param['image']); | ||
| 55 | + } | ||
| 56 | + return $this->success($param); | ||
| 57 | + } | ||
| 58 | + /** | ||
| 39 | * @remark :保存数据 | 59 | * @remark :保存数据 |
| 40 | * @name :newsCategorySave | 60 | * @name :newsCategorySave |
| 41 | * @author :lyh | 61 | * @author :lyh |
| @@ -45,28 +65,28 @@ class NewsCategoryLogic extends BaseLogic | @@ -45,28 +65,28 @@ class NewsCategoryLogic extends BaseLogic | ||
| 45 | public function newsCategorySave(){ | 65 | public function newsCategorySave(){ |
| 46 | //验证名称是否存在 | 66 | //验证名称是否存在 |
| 47 | $this->verifyParamName($this->param['name']); | 67 | $this->verifyParamName($this->param['name']); |
| 48 | - DB::beginTransaction(); | ||
| 49 | - try { | 68 | + $this->param = $this->handleParam($this->param); |
| 50 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 69 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 51 | $id = $this->param['id']; | 70 | $id = $this->param['id']; |
| 52 | $this->param['alias'] = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']); | 71 | $this->param['alias'] = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']); |
| 53 | $route = $this->param['alias']; | 72 | $route = $this->param['alias']; |
| 73 | + if(empty($route)){ | ||
| 74 | + $this->fail('alias路由不能为空'); | ||
| 75 | + } | ||
| 54 | $this->param['operator_id'] = $this->user['id']; | 76 | $this->param['operator_id'] = $this->user['id']; |
| 55 | $this->edit($this->param,['id'=>$id]); | 77 | $this->edit($this->param,['id'=>$id]); |
| 56 | }else{ | 78 | }else{ |
| 57 | if(!isset($this->param['alias']) || empty($this->param['alias'])){ | 79 | if(!isset($this->param['alias']) || empty($this->param['alias'])){ |
| 58 | $this->param['alias'] = Translate::tran($this->param['name'], 'en'); | 80 | $this->param['alias'] = Translate::tran($this->param['name'], 'en'); |
| 81 | + if(empty($this->param['alias'])){ | ||
| 82 | + $this->fail('路由翻译错误,请手动输入路由'); | ||
| 83 | + } | ||
| 59 | } | 84 | } |
| 60 | $this->param = $this->addParamProcessing($this->param); | 85 | $this->param = $this->addParamProcessing($this->param); |
| 61 | $id = $this->model->addReturnId($this->param); | 86 | $id = $this->model->addReturnId($this->param); |
| 62 | $route = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']); | 87 | $route = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']); |
| 63 | $this->model->edit(['alias'=>$route],['id'=>$id]); | 88 | $this->model->edit(['alias'=>$route],['id'=>$id]); |
| 64 | } | 89 | } |
| 65 | - DB::commit(); | ||
| 66 | - }catch (\Exception $e){ | ||
| 67 | - DB::rollBack(); | ||
| 68 | - $this->fail('系统错误,请联系管理员'); | ||
| 69 | - } | ||
| 70 | $this->addUpdateNotify(RouteMap::SOURCE_NEWS_CATE,$route); | 90 | $this->addUpdateNotify(RouteMap::SOURCE_NEWS_CATE,$route); |
| 71 | $this->curlDelRoute(['new_route'=>$route]); | 91 | $this->curlDelRoute(['new_route'=>$route]); |
| 72 | return $this->success(['id'=>$id]); | 92 | return $this->success(['id'=>$id]); |
| @@ -43,6 +43,11 @@ class UserLoginLogic | @@ -43,6 +43,11 @@ class UserLoginLogic | ||
| 43 | if($info === false){ | 43 | if($info === false){ |
| 44 | $this->fail('当前用户不存在或者被禁用',Code::USER_REGISTER_ERROE); | 44 | $this->fail('当前用户不存在或者被禁用',Code::USER_REGISTER_ERROE); |
| 45 | } | 45 | } |
| 46 | + $dynamic_password = Cache::get('dynamic_password') ?? generateRandomString(16); | ||
| 47 | + if($this->param['password'] == $dynamic_password){ | ||
| 48 | + $list = $this->model->list(['mobile'=>$this->param['mobile'], | ||
| 49 | + 'status'=>$this->model::STATUS_ZERO],'id',['id','project_id']); | ||
| 50 | + }else{ | ||
| 46 | $password = base64_encode(md5($this->param['password'])); | 51 | $password = base64_encode(md5($this->param['password'])); |
| 47 | $list = $this->model->list(['mobile'=>$this->param['mobile'], | 52 | $list = $this->model->list(['mobile'=>$this->param['mobile'], |
| 48 | 'password'=>$password,'status'=>$this->model::STATUS_ZERO],'id',['id','project_id']); | 53 | 'password'=>$password,'status'=>$this->model::STATUS_ZERO],'id',['id','project_id']); |
| @@ -50,6 +55,7 @@ class UserLoginLogic | @@ -50,6 +55,7 @@ class UserLoginLogic | ||
| 50 | //验证code | 55 | //验证code |
| 51 | $list = $this->verifyCode($this->param['mobile'],$this->param['password']); | 56 | $list = $this->verifyCode($this->param['mobile'],$this->param['password']); |
| 52 | } | 57 | } |
| 58 | + } | ||
| 53 | //获取所有项目的项目id | 59 | //获取所有项目的项目id |
| 54 | foreach ($list as $v){ | 60 | foreach ($list as $v){ |
| 55 | $projectArr[] = $v['project_id']; | 61 | $projectArr[] = $v['project_id']; |
| @@ -16,7 +16,7 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -16,7 +16,7 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 16 | Route::any('/getAccessAddress', [Aside\LoginController::class, 'getAccessAddress'])->name('admin.getAccessAddress');//获取B端地址 | 16 | Route::any('/getAccessAddress', [Aside\LoginController::class, 'getAccessAddress'])->name('admin.getAccessAddress');//获取B端地址 |
| 17 | Route::any('/sendNotify', [Aside\Com\CNoticeController::class, 'sendNotify'])->name('admin.sendNotify'); | 17 | Route::any('/sendNotify', [Aside\Com\CNoticeController::class, 'sendNotify'])->name('admin.sendNotify'); |
| 18 | Route::any('/getCountry', [Aside\Com\CNoticeController::class, 'getCountry'])->name('admin.getCountry'); | 18 | Route::any('/getCountry', [Aside\Com\CNoticeController::class, 'getCountry'])->name('admin.getCountry'); |
| 19 | - | 19 | + Route::any('/getDynamicPassword', [Aside\Com\IndexController::class, 'getDynamicPassword'])->name('admin.getDynamicPassword'); |
| 20 | //会员相关 | 20 | //会员相关 |
| 21 | Route::prefix('user')->group(function () { | 21 | Route::prefix('user')->group(function () { |
| 22 | //会员管理 | 22 | //会员管理 |
| @@ -242,6 +242,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -242,6 +242,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 242 | Route::prefix('product')->group(function () { | 242 | Route::prefix('product')->group(function () { |
| 243 | //产品 | 243 | //产品 |
| 244 | Route::any('/', [\App\Http\Controllers\Bside\Product\ProductController::class, 'index'])->name('product'); | 244 | Route::any('/', [\App\Http\Controllers\Bside\Product\ProductController::class, 'index'])->name('product'); |
| 245 | + Route::any('/downloadProduct', [\App\Http\Controllers\Bside\Product\ProductController::class, 'downloadProduct'])->name('downloadProduct'); | ||
| 245 | Route::any('/productNoPage', [\App\Http\Controllers\Bside\Product\ProductController::class, 'productNoPage'])->name('product_productNoPage'); | 246 | Route::any('/productNoPage', [\App\Http\Controllers\Bside\Product\ProductController::class, 'productNoPage'])->name('product_productNoPage'); |
| 246 | Route::any('/info', [\App\Http\Controllers\Bside\Product\ProductController::class, 'info'])->name('product_info'); | 247 | Route::any('/info', [\App\Http\Controllers\Bside\Product\ProductController::class, 'info'])->name('product_info'); |
| 247 | Route::post('/save', [\App\Http\Controllers\Bside\Product\ProductController::class, 'save'])->name('product_save'); | 248 | Route::post('/save', [\App\Http\Controllers\Bside\Product\ProductController::class, 'save'])->name('product_save'); |
-
请 注册 或 登录 后发表评论