Merge remote-tracking branch 'origin/develop' into akun
正在显示
18 个修改的文件
包含
247 行增加
和
62 行删除
| @@ -77,6 +77,7 @@ class SyncProject extends Command | @@ -77,6 +77,7 @@ class SyncProject extends Command | ||
| 77 | if(!$data || empty($data['data'])){ | 77 | if(!$data || empty($data['data'])){ |
| 78 | LogUtils::error('OaGlobalsoApi order_info error', $data); | 78 | LogUtils::error('OaGlobalsoApi order_info error', $data); |
| 79 | $this->retry($item, '未获取到订单信息'); | 79 | $this->retry($item, '未获取到订单信息'); |
| 80 | + continue; | ||
| 80 | } | 81 | } |
| 81 | if($data['data']['order_type'] == '首次'){ | 82 | if($data['data']['order_type'] == '首次'){ |
| 82 | $this->sync($data['data'],$is_update); | 83 | $this->sync($data['data'],$is_update); |
| @@ -275,6 +276,7 @@ class SyncProject extends Command | @@ -275,6 +276,7 @@ class SyncProject extends Command | ||
| 275 | $projectModel = new Project(); | 276 | $projectModel = new Project(); |
| 276 | $info = $projectModel->read(['from_order_id'=>$param['from_order_id'],'delete_status'=>0]); | 277 | $info = $projectModel->read(['from_order_id'=>$param['from_order_id'],'delete_status'=>0]); |
| 277 | if($info !== false){ | 278 | if($info !== false){ |
| 279 | + unset($param['type']); //更新的 不更新状态了 | ||
| 278 | $projectModel->edit($param, ['id' => $info['id']]); | 280 | $projectModel->edit($param, ['id' => $info['id']]); |
| 279 | return $info['id']; | 281 | return $info['id']; |
| 280 | }else{ | 282 | }else{ |
| @@ -110,7 +110,7 @@ class GoogleSpeedApi | @@ -110,7 +110,7 @@ class GoogleSpeedApi | ||
| 110 | try { | 110 | try { |
| 111 | if($url){ | 111 | if($url){ |
| 112 | $params = [ | 112 | $params = [ |
| 113 | - 'url' => $url | 113 | + 'url' => base64_encode($url) |
| 114 | ]; | 114 | ]; |
| 115 | $res = HttpUtils::get('http://pagespeed.quanqiusou.cn/api.php', $params); | 115 | $res = HttpUtils::get('http://pagespeed.quanqiusou.cn/api.php', $params); |
| 116 | if ($res) { | 116 | if ($res) { |
| @@ -207,7 +207,7 @@ class LoginController extends BaseController | @@ -207,7 +207,7 @@ class LoginController extends BaseController | ||
| 207 | * @time :2023/9/1 10:12 | 207 | * @time :2023/9/1 10:12 |
| 208 | */ | 208 | */ |
| 209 | public function getWechatLoginInfo(){ | 209 | public function getWechatLoginInfo(){ |
| 210 | - $this->request->validate([ | 210 | + $this->param = $this->request->validate([ |
| 211 | 'ticket' => 'required', | 211 | 'ticket' => 'required', |
| 212 | ],[ | 212 | ],[ |
| 213 | 'ticket.required' => 'ticket不能为空', | 213 | 'ticket.required' => 'ticket不能为空', |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Controllers\Bside\Nav; | ||
| 4 | + | ||
| 5 | + | ||
| 6 | +use App\Enums\Common\Code; | ||
| 7 | +use App\Http\Controllers\Bside\BaseController; | ||
| 8 | +use App\Models\Nav\BNavGroup; | ||
| 9 | +use Illuminate\Http\Request; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * 导航组 | ||
| 13 | + * Class NavGroupController | ||
| 14 | + * @package App\Http\Controllers\Bside\Nav | ||
| 15 | + * @author zbj | ||
| 16 | + * @date 2023/10/9 | ||
| 17 | + */ | ||
| 18 | +class NavGroupController extends BaseController | ||
| 19 | +{ | ||
| 20 | + | ||
| 21 | + public function index(BNavGroup $nav_group){ | ||
| 22 | + $this->map['project_id'] = $this->user['project_id']; | ||
| 23 | + $lists = $nav_group->list($this->map, 'id', ['id', 'name'], 'asc'); | ||
| 24 | + $this->response('success',Code::SUCCESS,$lists); | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + public function save(Request $request){ | ||
| 28 | + $request->validate([ | ||
| 29 | + 'name'=> ['required','max:100'], | ||
| 30 | + ],[ | ||
| 31 | + 'name.required' => '菜单组名称不能为空', | ||
| 32 | + 'name.max' => '菜单组名称不能超过100个字符' | ||
| 33 | + ]); | ||
| 34 | + if(empty($this->param['id'])){ | ||
| 35 | + $nav_group = new BNavGroup(); | ||
| 36 | + }else{ | ||
| 37 | + if(in_array($this->param['id'], [BNavGroup::DEFAULT_HEADER_ID,BNavGroup::DEFAULT_FOOTER_ID])){ | ||
| 38 | + $this->fail('系统内置菜单组不能修改'); | ||
| 39 | + } | ||
| 40 | + $nav_group = BNavGroup::find($this->param['id']); | ||
| 41 | + if(!$nav_group){ | ||
| 42 | + $this->fail('数据不存在或者已经删除'); | ||
| 43 | + } | ||
| 44 | + } | ||
| 45 | + $nav_group->project_id = $this->user['project_id']; | ||
| 46 | + $nav_group->name = $this->param['name']; | ||
| 47 | + $nav_group->save(); | ||
| 48 | + | ||
| 49 | + $this->response('success'); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + public function delete(Request $request){ | ||
| 53 | + $request->validate([ | ||
| 54 | + 'id'=>'required', | ||
| 55 | + ],[ | ||
| 56 | + 'id.required' => 'ID不能为空', | ||
| 57 | + ]); | ||
| 58 | + if(in_array($this->param['id'], [BNavGroup::DEFAULT_HEADER_ID,BNavGroup::DEFAULT_FOOTER_ID])){ | ||
| 59 | + $this->fail('系统内置菜单组不能删除'); | ||
| 60 | + } | ||
| 61 | + $nav_group = BNavGroup::find($this->param['id']); | ||
| 62 | + if(!$nav_group){ | ||
| 63 | + $this->response('数据不存在或者已经删除'); | ||
| 64 | + } | ||
| 65 | + $nav_group->delete(); | ||
| 66 | + | ||
| 67 | + $this->response('success'); | ||
| 68 | + } | ||
| 69 | +} |
| @@ -38,7 +38,7 @@ class CategoryController extends BaseController | @@ -38,7 +38,7 @@ class CategoryController extends BaseController | ||
| 38 | if(!empty($list)){ | 38 | if(!empty($list)){ |
| 39 | foreach ($list as $k =>$v){ | 39 | foreach ($list as $k =>$v){ |
| 40 | $v['url'] = $this->user['domain'] . $v['route']; | 40 | $v['url'] = $this->user['domain'] . $v['route']; |
| 41 | - $v['product_num'] = Product::where('category_id','like' ,'%,'.$v['id'].',%')->count(); | 41 | + $v['product_num'] = Product::where('category_id','like' ,'%,'.$v['id'].',%')->where(['status'=>1])->count(); |
| 42 | $v['image_link'] = getImageUrl($v['image']); | 42 | $v['image_link'] = getImageUrl($v['image']); |
| 43 | $list[$k] = $v; | 43 | $list[$k] = $v; |
| 44 | } | 44 | } |
| @@ -110,11 +110,12 @@ class FileController | @@ -110,11 +110,12 @@ class FileController | ||
| 110 | */ | 110 | */ |
| 111 | public function single(&$files){ | 111 | public function single(&$files){ |
| 112 | $hash = hash_file('md5', $files->getPathname()); | 112 | $hash = hash_file('md5', $files->getPathname()); |
| 113 | + $name = $files->getClientOriginalName(); | ||
| 113 | //查看文件是否存在 | 114 | //查看文件是否存在 |
| 114 | $fileModel = new File(); | 115 | $fileModel = new File(); |
| 115 | $file_hash = $fileModel->read(['hash'=>$hash]); | 116 | $file_hash = $fileModel->read(['hash'=>$hash]); |
| 116 | if($file_hash !== false){ | 117 | if($file_hash !== false){ |
| 117 | - return $this->response('资源',Code::SUCCESS,$this->responseData($file_hash['path'])); | 118 | + return $this->response('资源',Code::SUCCESS,$this->responseData($file_hash['path'], $name)); |
| 118 | } | 119 | } |
| 119 | $url = $this->config['root'].$this->path; | 120 | $url = $this->config['root'].$this->path; |
| 120 | $fileName = uniqid().rand(10000,99999).'.'.$files->getClientOriginalExtension(); | 121 | $fileName = uniqid().rand(10000,99999).'.'.$files->getClientOriginalExtension(); |
| @@ -128,8 +129,8 @@ class FileController | @@ -128,8 +129,8 @@ class FileController | ||
| 128 | return $this->response($files->getError(), Code::USER_ERROR); | 129 | return $this->response($files->getError(), Code::USER_ERROR); |
| 129 | } | 130 | } |
| 130 | } | 131 | } |
| 131 | - $this->saveMysql($fileModel,$files->getSize(),$files->getClientOriginalExtension(),$fileName,$hash,$this->upload_location,$files->getMimeType()); | ||
| 132 | - return $this->response('资源',Code::SUCCESS,$this->responseData($this->path.'/'.$fileName)); | 132 | + $this->saveMysql($fileModel,$files->getSize(),$files->getClientOriginalExtension(),$fileName,$hash,$this->upload_location,$files->getMimeType(),$name); |
| 133 | + return $this->response('资源',Code::SUCCESS,$this->responseData($this->path.'/'.$fileName, $name)); | ||
| 133 | } | 134 | } |
| 134 | 135 | ||
| 135 | /** | 136 | /** |
| @@ -139,7 +140,7 @@ class FileController | @@ -139,7 +140,7 @@ class FileController | ||
| 139 | * @method :post | 140 | * @method :post |
| 140 | * @time :2023/7/19 16:38 | 141 | * @time :2023/7/19 16:38 |
| 141 | */ | 142 | */ |
| 142 | - public function saveMysql(&$fileModel,$size,$image_type,$fileName,$hash,$is_cos = 0,$mime = ''){ | 143 | + public function saveMysql(&$fileModel,$size,$image_type,$fileName,$hash,$is_cos = 0,$mime = '',$name=''){ |
| 143 | $data = [ | 144 | $data = [ |
| 144 | 'path' => $this->path.'/'.$fileName, | 145 | 'path' => $this->path.'/'.$fileName, |
| 145 | 'created_at' => date('Y-m-d H:i:s',time()), | 146 | 'created_at' => date('Y-m-d H:i:s',time()), |
| @@ -149,6 +150,7 @@ class FileController | @@ -149,6 +150,7 @@ class FileController | ||
| 149 | 'refer'=>$this->param['refer'] ?? 1, | 150 | 'refer'=>$this->param['refer'] ?? 1, |
| 150 | 'is_cos'=>$is_cos, | 151 | 'is_cos'=>$is_cos, |
| 151 | 'mime'=>$mime, | 152 | 'mime'=>$mime, |
| 153 | + 'name'=>$name, | ||
| 152 | ]; | 154 | ]; |
| 153 | $rs = $fileModel->add($data); | 155 | $rs = $fileModel->add($data); |
| 154 | if ($rs === false) { | 156 | if ($rs === false) { |
| @@ -168,10 +170,11 @@ class FileController | @@ -168,10 +170,11 @@ class FileController | ||
| 168 | $data = []; | 170 | $data = []; |
| 169 | foreach ($files as $file) { | 171 | foreach ($files as $file) { |
| 170 | $fileModel = new File(); | 172 | $fileModel = new File(); |
| 173 | + $name = $file->getClientOriginalName(); | ||
| 171 | $hash = hash_file('md5', $file->getPathname()); | 174 | $hash = hash_file('md5', $file->getPathname()); |
| 172 | $file_hash = $fileModel->read(['hash'=>$hash]); | 175 | $file_hash = $fileModel->read(['hash'=>$hash]); |
| 173 | if($file_hash !== false){ | 176 | if($file_hash !== false){ |
| 174 | - $data[] = $this->responseData($file_hash['path']); | 177 | + $data[] = $this->responseData($file_hash['path'], $name); |
| 175 | continue; | 178 | continue; |
| 176 | } | 179 | } |
| 177 | $url = $this->config['root'].'/'.$this->path; | 180 | $url = $this->config['root'].'/'.$this->path; |
| @@ -189,8 +192,8 @@ class FileController | @@ -189,8 +192,8 @@ class FileController | ||
| 189 | } | 192 | } |
| 190 | $size = $file->getSize(); | 193 | $size = $file->getSize(); |
| 191 | $mime = $file->getMimeType(); | 194 | $mime = $file->getMimeType(); |
| 192 | - $this->saveMysql($fileModel,$size,$file_type,$fileName,$hash,$this->upload_location,$mime); | ||
| 193 | - $data[] = $this->responseData($this->path.'/'.$fileName); | 195 | + $this->saveMysql($fileModel,$size,$file_type,$fileName,$hash,$this->upload_location,$mime,$name); |
| 196 | + $data[] = $this->responseData($this->path.'/'.$fileName, $name); | ||
| 194 | } | 197 | } |
| 195 | $this->response('资源',Code::SUCCESS,$data); | 198 | $this->response('资源',Code::SUCCESS,$data); |
| 196 | } | 199 | } |
| @@ -230,11 +233,11 @@ class FileController | @@ -230,11 +233,11 @@ class FileController | ||
| 230 | $this->response('指定文件不存在!', Code::USER_ERROR); | 233 | $this->response('指定文件不存在!', Code::USER_ERROR); |
| 231 | } | 234 | } |
| 232 | $fileUrl = getFileUrl($info['path'],$info['is_cos']); | 235 | $fileUrl = getFileUrl($info['path'],$info['is_cos']); |
| 233 | - $fileName = basename($fileUrl); // 要保存的文件名 | 236 | +// $fileName = basename($fileUrl); // 要保存的文件名 |
| 234 | // 设置响应头 | 237 | // 设置响应头 |
| 235 | header('Content-Description: File Transfer'); | 238 | header('Content-Description: File Transfer'); |
| 236 | header('Content-Type: application/octet-stream'); | 239 | header('Content-Type: application/octet-stream'); |
| 237 | - header('Content-Disposition: attachment; filename="' . $fileName . '"'); | 240 | + header('Content-Disposition: attachment; filename="' . $info['name'] . '"'); |
| 238 | // 下载文件 | 241 | // 下载文件 |
| 239 | readfile($fileUrl); | 242 | readfile($fileUrl); |
| 240 | } | 243 | } |
| @@ -277,7 +280,7 @@ class FileController | @@ -277,7 +280,7 @@ class FileController | ||
| 277 | } | 280 | } |
| 278 | $this->map['refer'] = 1; | 281 | $this->map['refer'] = 1; |
| 279 | $fileModel = new File(); | 282 | $fileModel = new File(); |
| 280 | - $lists = $fileModel->list($this->map,'id',['id','hash','type','path','created_at']); | 283 | + $lists = $fileModel->list($this->map,'id',['id','hash','type','path','created_at','name']); |
| 281 | foreach ($lists as $k => $v){ | 284 | foreach ($lists as $k => $v){ |
| 282 | $v['file_link'] = getFileUrl($v['path']); | 285 | $v['file_link'] = getFileUrl($v['path']); |
| 283 | $lists[$k] = $v; | 286 | $lists[$k] = $v; |
| @@ -292,10 +295,11 @@ class FileController | @@ -292,10 +295,11 @@ class FileController | ||
| 292 | * @method :post | 295 | * @method :post |
| 293 | * @time :2023/7/26 13:41 | 296 | * @time :2023/7/26 13:41 |
| 294 | */ | 297 | */ |
| 295 | - public function responseData($path){ | 298 | + public function responseData($path, $name){ |
| 296 | $data = [ | 299 | $data = [ |
| 297 | 'file'=>$path, | 300 | 'file'=>$path, |
| 298 | 'file_link'=>getFileUrl($path,$this->upload_location), | 301 | 'file_link'=>getFileUrl($path,$this->upload_location), |
| 302 | + 'name'=>$name, | ||
| 299 | ]; | 303 | ]; |
| 300 | return $data; | 304 | return $data; |
| 301 | } | 305 | } |
| @@ -313,7 +317,7 @@ class FileController | @@ -313,7 +317,7 @@ class FileController | ||
| 313 | if ($info === false) { | 317 | if ($info === false) { |
| 314 | $this->response('指定文件不存在!', Code::USER_ERROR); | 318 | $this->response('指定文件不存在!', Code::USER_ERROR); |
| 315 | } | 319 | } |
| 316 | - $data = ['file_download'=>url('a/download_files?path='.$info['path'])]; | 320 | + $data = ['file_download'=>url('a/download_files?path='.$info['path']), 'name' => $info['name']]; |
| 317 | $this->response('success',Code::SUCCESS,$data); | 321 | $this->response('success',Code::SUCCESS,$data); |
| 318 | } | 322 | } |
| 319 | } | 323 | } |
| @@ -180,6 +180,7 @@ class ImageController extends Controller | @@ -180,6 +180,7 @@ class ImageController extends Controller | ||
| 180 | */ | 180 | */ |
| 181 | public function single(&$files){ | 181 | public function single(&$files){ |
| 182 | $hash = hash_file('md5', $files->getPathname()); | 182 | $hash = hash_file('md5', $files->getPathname()); |
| 183 | + $name = $files->getClientOriginalName(); | ||
| 183 | //查看文件是否存在 | 184 | //查看文件是否存在 |
| 184 | $imageModel = new ImageModel(); | 185 | $imageModel = new ImageModel(); |
| 185 | //查看图片是否已上传 | 186 | //查看图片是否已上传 |
| @@ -189,7 +190,7 @@ class ImageController extends Controller | @@ -189,7 +190,7 @@ class ImageController extends Controller | ||
| 189 | } | 190 | } |
| 190 | $image_hash = $imageModel->read($param); | 191 | $image_hash = $imageModel->read($param); |
| 191 | if($image_hash !== false){ | 192 | if($image_hash !== false){ |
| 192 | - return $this->response('图片资源',Code::SUCCESS,$this->responseData($image_hash['path'])); | 193 | + return $this->response('图片资源',Code::SUCCESS,$this->responseData($image_hash['path'], $name)); |
| 193 | } | 194 | } |
| 194 | //保存路径 | 195 | //保存路径 |
| 195 | $url = $this->config['root'].$this->path; | 196 | $url = $this->config['root'].$this->path; |
| @@ -202,8 +203,8 @@ class ImageController extends Controller | @@ -202,8 +203,8 @@ class ImageController extends Controller | ||
| 202 | }else{ | 203 | }else{ |
| 203 | $files->move($url,$fileName); | 204 | $files->move($url,$fileName); |
| 204 | } | 205 | } |
| 205 | - $this->saveMysql($imageModel,$files->getSize(),$image_type,$fileName,$hash,$this->upload_location,$files->getMimeType()); | ||
| 206 | - return $this->response('图片资源',Code::SUCCESS,$this->responseData($this->path.'/'.$fileName)); | 206 | + $this->saveMysql($imageModel,$files->getSize(),$image_type,$fileName,$hash,$this->upload_location,$files->getMimeType(), $name); |
| 207 | + return $this->response('图片资源',Code::SUCCESS,$this->responseData($this->path.'/'.$fileName, $name)); | ||
| 207 | } | 208 | } |
| 208 | 209 | ||
| 209 | /** | 210 | /** |
| @@ -213,7 +214,7 @@ class ImageController extends Controller | @@ -213,7 +214,7 @@ class ImageController extends Controller | ||
| 213 | * @method :post | 214 | * @method :post |
| 214 | * @time :2023/7/19 16:38 | 215 | * @time :2023/7/19 16:38 |
| 215 | */ | 216 | */ |
| 216 | - public function saveMysql(&$imageModel,$size,$image_type,$fileName,$hash,$is_cos = 0,$mime = ''){ | 217 | + public function saveMysql(&$imageModel,$size,$image_type,$fileName,$hash,$is_cos = 0,$mime = '', $name=''){ |
| 217 | $data = [ | 218 | $data = [ |
| 218 | 'path' => $this->path.'/'.$fileName, | 219 | 'path' => $this->path.'/'.$fileName, |
| 219 | 'created_at' => date('Y-m-d H:i:s',time()), | 220 | 'created_at' => date('Y-m-d H:i:s',time()), |
| @@ -224,6 +225,7 @@ class ImageController extends Controller | @@ -224,6 +225,7 @@ class ImageController extends Controller | ||
| 224 | 'is_cos'=>$is_cos, | 225 | 'is_cos'=>$is_cos, |
| 225 | 'mime'=>$mime, | 226 | 'mime'=>$mime, |
| 226 | 'project_id'=>$this->cache['project_id'] ?? 0, | 227 | 'project_id'=>$this->cache['project_id'] ?? 0, |
| 228 | + 'name'=>$name, | ||
| 227 | ]; | 229 | ]; |
| 228 | $rs = $imageModel->add($data); | 230 | $rs = $imageModel->add($data); |
| 229 | if ($rs === false) { | 231 | if ($rs === false) { |
| @@ -258,6 +260,7 @@ class ImageController extends Controller | @@ -258,6 +260,7 @@ class ImageController extends Controller | ||
| 258 | foreach ($files as $file) { | 260 | foreach ($files as $file) { |
| 259 | $imageModel = new ImageModel(); | 261 | $imageModel = new ImageModel(); |
| 260 | $hash = hash_file('md5', $file->getPathname()); | 262 | $hash = hash_file('md5', $file->getPathname()); |
| 263 | + $name = $files->getClientOriginalName(); | ||
| 261 | //查看图片是否已上传 | 264 | //查看图片是否已上传 |
| 262 | $param = ['hash'=>$hash,'refer'=>$this->param['refer'] ?? 0]; | 265 | $param = ['hash'=>$hash,'refer'=>$this->param['refer'] ?? 0]; |
| 263 | if(isset($this->cache['project_id']) && !empty($this->cache['project_id'])){ | 266 | if(isset($this->cache['project_id']) && !empty($this->cache['project_id'])){ |
| @@ -279,8 +282,8 @@ class ImageController extends Controller | @@ -279,8 +282,8 @@ class ImageController extends Controller | ||
| 279 | $file->move($url,$fileName); | 282 | $file->move($url,$fileName); |
| 280 | } | 283 | } |
| 281 | //批量存储 | 284 | //批量存储 |
| 282 | - $this->saveMysql($imageModel,$file->getSize(),$image_type,$fileName,$hash,$this->upload_location,$file->getMimeType()); | ||
| 283 | - $data[] = $this->responseData($this->path.'/'.$fileName); | 285 | + $this->saveMysql($imageModel,$file->getSize(),$image_type,$fileName,$hash,$this->upload_location,$file->getMimeType(),$name); |
| 286 | + $data[] = $this->responseData($this->path.'/'.$fileName,$name); | ||
| 284 | } | 287 | } |
| 285 | $this->response('图片资源',Code::SUCCESS,$data); | 288 | $this->response('图片资源',Code::SUCCESS,$data); |
| 286 | } | 289 | } |
| @@ -309,11 +312,11 @@ class ImageController extends Controller | @@ -309,11 +312,11 @@ class ImageController extends Controller | ||
| 309 | $this->response('指定图片已被系统删除!', Code::USER_ERROR); | 312 | $this->response('指定图片已被系统删除!', Code::USER_ERROR); |
| 310 | } | 313 | } |
| 311 | } | 314 | } |
| 312 | - $fileName = basename($info['path']); // 要保存的文件名 | 315 | +// $fileName = basename($info['path']); // 要保存的文件名 |
| 313 | // 设置响应头 | 316 | // 设置响应头 |
| 314 | header('Content-Description: File Transfer'); | 317 | header('Content-Description: File Transfer'); |
| 315 | header('Content-Type: application/octet-stream'); | 318 | header('Content-Type: application/octet-stream'); |
| 316 | - header('Content-Disposition: attachment; filename="' . $fileName . '"'); | 319 | + header('Content-Disposition: attachment; filename="' . $info['name'] . '"'); |
| 317 | // 下载文件 | 320 | // 下载文件 |
| 318 | readfile($fileUrl); | 321 | readfile($fileUrl); |
| 319 | } | 322 | } |
| @@ -392,10 +395,11 @@ class ImageController extends Controller | @@ -392,10 +395,11 @@ class ImageController extends Controller | ||
| 392 | * @method :post | 395 | * @method :post |
| 393 | * @time :2023/7/26 13:41 | 396 | * @time :2023/7/26 13:41 |
| 394 | */ | 397 | */ |
| 395 | - public function responseData($path = ''){ | 398 | + public function responseData($path = '', $name = ''){ |
| 396 | $data = [ | 399 | $data = [ |
| 397 | 'image'=>$path, | 400 | 'image'=>$path, |
| 398 | 'image_link'=>getImageUrl($path), | 401 | 'image_link'=>getImageUrl($path), |
| 402 | + 'name'=>$name, | ||
| 399 | ]; | 403 | ]; |
| 400 | return $data; | 404 | return $data; |
| 401 | } | 405 | } |
| @@ -413,7 +417,7 @@ class ImageController extends Controller | @@ -413,7 +417,7 @@ class ImageController extends Controller | ||
| 413 | if ($info === false) { | 417 | if ($info === false) { |
| 414 | $this->response('指定文件不存在!', Code::USER_ERROR); | 418 | $this->response('指定文件不存在!', Code::USER_ERROR); |
| 415 | } | 419 | } |
| 416 | - $data = ['image_download'=>url('a/download_images?path='.$info['path'])]; | 420 | + $data = ['image_download'=>url('a/download_images?path='.$info['path']), 'name' => $info['name']]; |
| 417 | $this->response('success',Code::SUCCESS,$data); | 421 | $this->response('success',Code::SUCCESS,$data); |
| 418 | } | 422 | } |
| 419 | } | 423 | } |
| @@ -113,7 +113,7 @@ class ProjectLogic extends BaseLogic | @@ -113,7 +113,7 @@ class ProjectLogic extends BaseLogic | ||
| 113 | DB::commit(); | 113 | DB::commit(); |
| 114 | }catch (\Exception $e){ | 114 | }catch (\Exception $e){ |
| 115 | DB::rollBack(); | 115 | DB::rollBack(); |
| 116 | - $this->fail('error'); | 116 | + $this->fail('请填写完整后再提交'); |
| 117 | } | 117 | } |
| 118 | return $this->success(); | 118 | return $this->success(); |
| 119 | } | 119 | } |
| @@ -158,8 +158,6 @@ class ProjectLogic extends BaseLogic | @@ -158,8 +158,6 @@ class ProjectLogic extends BaseLogic | ||
| 158 | 'upload_max_size' => $param['upload_config']['upload_max_size'] ?? 5, | 158 | 'upload_max_size' => $param['upload_config']['upload_max_size'] ?? 5, |
| 159 | ]; | 159 | ]; |
| 160 | } | 160 | } |
| 161 | - | ||
| 162 | - | ||
| 163 | $this->model->edit($param,['id'=>$param['id']]); | 161 | $this->model->edit($param,['id'=>$param['id']]); |
| 164 | Common::del_user_cache($this->model->getTable(),$param['id']); | 162 | Common::del_user_cache($this->model->getTable(),$param['id']); |
| 165 | return $this->success(); | 163 | return $this->success(); |
| @@ -196,9 +194,6 @@ class ProjectLogic extends BaseLogic | @@ -196,9 +194,6 @@ class ProjectLogic extends BaseLogic | ||
| 196 | */ | 194 | */ |
| 197 | protected function saveProjectDeployBuild($deploy_build){ | 195 | protected function saveProjectDeployBuild($deploy_build){ |
| 198 | $deployBuildModel = new DeployBuild(); | 196 | $deployBuildModel = new DeployBuild(); |
| 199 | - if(isset($deploy_build['configuration']['build_status']) && ($deploy_build['configuration']['build_status'] == 0)){ | ||
| 200 | - | ||
| 201 | - } | ||
| 202 | $deploy_build['configuration'] = Arr::a2s(!empty($deploy_build['configuration']) ? $deploy_build['configuration'] : []); | 197 | $deploy_build['configuration'] = Arr::a2s(!empty($deploy_build['configuration']) ? $deploy_build['configuration'] : []); |
| 203 | $deployBuildModel->edit($deploy_build,['id'=>$deploy_build['id']]); | 198 | $deployBuildModel->edit($deploy_build,['id'=>$deploy_build['id']]); |
| 204 | return $this->success(); | 199 | return $this->success(); |
| @@ -7,7 +7,6 @@ use App\Models\Service\Service as ServiceSettingModel; | @@ -7,7 +7,6 @@ use App\Models\Service\Service as ServiceSettingModel; | ||
| 7 | use App\Models\Template\Template; | 7 | use App\Models\Template\Template; |
| 8 | use App\Models\Template\Setting; | 8 | use App\Models\Template\Setting; |
| 9 | use Illuminate\Support\Facades\DB; | 9 | use Illuminate\Support\Facades\DB; |
| 10 | -use mysql_xdevapi\Exception; | ||
| 11 | 10 | ||
| 12 | class ATemplateLogic extends BaseLogic | 11 | class ATemplateLogic extends BaseLogic |
| 13 | { | 12 | { |
| @@ -141,7 +140,7 @@ class ATemplateLogic extends BaseLogic | @@ -141,7 +140,7 @@ class ATemplateLogic extends BaseLogic | ||
| 141 | ]; | 140 | ]; |
| 142 | $serviceSettingModel->insert($data); | 141 | $serviceSettingModel->insert($data); |
| 143 | DB::commit(); | 142 | DB::commit(); |
| 144 | - }catch (Exception $e){ | 143 | + }catch (\Exception $e){ |
| 145 | DB::rollBack(); | 144 | DB::rollBack(); |
| 146 | $this->fail('error'); | 145 | $this->fail('error'); |
| 147 | } | 146 | } |
| @@ -9,6 +9,7 @@ use App\Models\Product\Category; | @@ -9,6 +9,7 @@ use App\Models\Product\Category; | ||
| 9 | use App\Models\Product\Product; | 9 | use App\Models\Product\Product; |
| 10 | use App\Models\RouteMap\RouteMap; | 10 | use App\Models\RouteMap\RouteMap; |
| 11 | use App\Models\Service\Service as ServiceSettingModel; | 11 | use App\Models\Service\Service as ServiceSettingModel; |
| 12 | +use App\Models\Template\BTemplateCommon; | ||
| 12 | use App\Models\Template\Setting; | 13 | use App\Models\Template\Setting; |
| 13 | use App\Models\Template\BTemplate; | 14 | use App\Models\Template\BTemplate; |
| 14 | use App\Models\Template\BTemplateLog; | 15 | use App\Models\Template\BTemplateLog; |
| @@ -103,6 +104,13 @@ class BTemplateLogic extends BaseLogic | @@ -103,6 +104,13 @@ class BTemplateLogic extends BaseLogic | ||
| 103 | $ATemplateModel = new Template(); | 104 | $ATemplateModel = new Template(); |
| 104 | $TemplateInfo = $ATemplateModel->read(['id'=>$info['template_id']]); | 105 | $TemplateInfo = $ATemplateModel->read(['id'=>$info['template_id']]); |
| 105 | }else{ | 106 | }else{ |
| 107 | + //兼容老数据 | ||
| 108 | + $commonTemplateModel = new BTemplateCommon(); | ||
| 109 | + $commonInfo = $commonTemplateModel->read(['template_id'=>$info['template_id'],'project_id'=>$this->user['project_id']]); | ||
| 110 | + if($commonInfo !== false){ | ||
| 111 | + $TemplateInfo['html'] = $commonInfo['head_css'].$TemplateInfo['main_css'].$commonInfo['footer_css'].$commonInfo['other']. | ||
| 112 | + $commonInfo['head_html'].$TemplateInfo['main_html'].$commonInfo['footer_html']; | ||
| 113 | + } | ||
| 106 | //渲染首页数据 | 114 | //渲染首页数据 |
| 107 | $ATemplateModel = new Template(); | 115 | $ATemplateModel = new Template(); |
| 108 | $ATemplateInfo = $ATemplateModel->read(['id'=>$info['template_id']]); | 116 | $ATemplateInfo = $ATemplateModel->read(['id'=>$info['template_id']]); |
| @@ -121,23 +129,34 @@ class BTemplateLogic extends BaseLogic | @@ -121,23 +129,34 @@ class BTemplateLogic extends BaseLogic | ||
| 121 | * @time :2023/7/25 16:40 | 129 | * @time :2023/7/25 16:40 |
| 122 | */ | 130 | */ |
| 123 | public function productHtml($info,$source,$source_id){ | 131 | public function productHtml($info,$source,$source_id){ |
| 132 | + $homeTemplateInfo = $this->webTemplateInfo($info['template_id'],1,0); | ||
| 133 | + if($homeTemplateInfo === false){ | ||
| 134 | + $this->fail('请先装修首页'); | ||
| 135 | + } | ||
| 124 | //查看当前模板是否已编辑保存web_template | 136 | //查看当前模板是否已编辑保存web_template |
| 125 | $TemplateInfo = $this->webTemplateInfo($info['template_id'],$source,$source_id); | 137 | $TemplateInfo = $this->webTemplateInfo($info['template_id'],$source,$source_id); |
| 126 | if($TemplateInfo === false){ | 138 | if($TemplateInfo === false){ |
| 127 | - //获取首页数据 | ||
| 128 | - $homeTemplateInfo = $this->webTemplateInfo($info['template_id'],1,0); | ||
| 129 | - if($homeTemplateInfo === false){ | ||
| 130 | - $this->fail('请先装修首页'); | 139 | + //兼容老数据 |
| 140 | + $commonTemplateModel = new BTemplateCommon(); | ||
| 141 | + $commonInfo = $commonTemplateModel->read(['template_id'=>$info['template_id'],'project_id'=>$this->user['project_id']]); | ||
| 142 | + if($commonInfo !== false){ | ||
| 143 | + $html = $commonInfo['head_css']."<style id='globalsojs-styles'></style>".$commonInfo['footer_css'].$commonInfo['other']. | ||
| 144 | + $commonInfo['head_html'].$this->getProductModule().$commonInfo['footer_html']; | ||
| 145 | + }else{ | ||
| 146 | + $html = preg_replace('/<style id="globalsojs-styles">(.*?)<\/style>/s', "<style id='globalsojs-styles'></style>", $homeTemplateInfo['html']); | ||
| 147 | + $html = preg_replace('/<main\b[^>]*>(.*?)<\/main>/s', "<main>{$this->getProductModule()}</main>", $html); | ||
| 131 | } | 148 | } |
| 132 | - $html = preg_replace('/<style id="globalsojs-styles">(.*?)<\/style>/s', "<style id='globalsojs-styles'></style>", $homeTemplateInfo['html']); | ||
| 133 | - $html = preg_replace('/<main\b[^>]*>(.*?)<\/main>/s', "<main>{$this->getProductModule()}</main>", $html); | ||
| 134 | }else{ | 149 | }else{ |
| 135 | - $homeTemplateInfo = $this->webTemplateInfo($info['template_id'],1,0); | ||
| 136 | - if($homeTemplateInfo === false){ | ||
| 137 | - $this->fail('请先装修首页'); | 150 | + //兼容老数据 |
| 151 | + $commonTemplateModel = new BTemplateCommon(); | ||
| 152 | + $commonInfo = $commonTemplateModel->read(['template_id'=>$info['template_id'],'project_id'=>$this->user['project_id']]); | ||
| 153 | + if($commonInfo !== false){ | ||
| 154 | + $html = $commonInfo['head_css'].$TemplateInfo['main_css'].$commonInfo['footer_css'].$commonInfo['other']. | ||
| 155 | + $commonInfo['head_html'].$TemplateInfo['main_html'].$commonInfo['footer_html']; | ||
| 156 | + }else{ | ||
| 157 | + $html = preg_replace('/<style id="globalsojs-styles">(.*?)<\/style>/s', $TemplateInfo['main_css'], $homeTemplateInfo['html']); | ||
| 158 | + $html = preg_replace('/<main\b[^>]*>(.*?)<\/main>/s',$TemplateInfo['main_html'] , $html); | ||
| 138 | } | 159 | } |
| 139 | - $html = preg_replace('/<style id="globalsojs-styles">(.*?)<\/style>/s', $TemplateInfo['main_css'], $homeTemplateInfo['html']); | ||
| 140 | - $html = preg_replace('/<main\b[^>]*>(.*?)<\/main>/s',$TemplateInfo['main_html'] , $html); | ||
| 141 | } | 160 | } |
| 142 | $TemplateInfo['html'] = $this->getHeadFooter($html);//组装数据 | 161 | $TemplateInfo['html'] = $this->getHeadFooter($html);//组装数据 |
| 143 | return $this->success($TemplateInfo); | 162 | return $this->success($TemplateInfo); |
| @@ -186,7 +205,8 @@ class BTemplateLogic extends BaseLogic | @@ -186,7 +205,8 @@ class BTemplateLogic extends BaseLogic | ||
| 186 | $info = $this->webTemplateInfo($this->param['template_id'],$this->param['source'],$this->param['source_id']); | 205 | $info = $this->webTemplateInfo($this->param['template_id'],$this->param['source'],$this->param['source_id']); |
| 187 | //字符串截取 | 206 | //字符串截取 |
| 188 | $this->param = $this->stringProcessing($this->param); | 207 | $this->param = $this->stringProcessing($this->param); |
| 189 | - $this->param = $this->templateSaveParam($this->param); | 208 | + $this->saveCommonTemplate($this->param); |
| 209 | + $this->param = $this->templateSaveParam($this->param);//组装数据 | ||
| 190 | if($info === false){ | 210 | if($info === false){ |
| 191 | $this->model->add($this->param); | 211 | $this->model->add($this->param); |
| 192 | }else{ | 212 | }else{ |
| @@ -196,7 +216,7 @@ class BTemplateLogic extends BaseLogic | @@ -196,7 +216,7 @@ class BTemplateLogic extends BaseLogic | ||
| 196 | DB::commit(); | 216 | DB::commit(); |
| 197 | }catch (\Exception $e){ | 217 | }catch (\Exception $e){ |
| 198 | DB::rollBack(); | 218 | DB::rollBack(); |
| 199 | - $this->fail('error'); | 219 | + $this->fail('系统错误,请联系管理员'); |
| 200 | } | 220 | } |
| 201 | //通知更新 | 221 | //通知更新 |
| 202 | $this->homeOrProduct($this->param['source'],$this->param['source_id']); | 222 | $this->homeOrProduct($this->param['source'],$this->param['source_id']); |
| @@ -204,6 +224,34 @@ class BTemplateLogic extends BaseLogic | @@ -204,6 +224,34 @@ class BTemplateLogic extends BaseLogic | ||
| 204 | } | 224 | } |
| 205 | 225 | ||
| 206 | /** | 226 | /** |
| 227 | + * @remark :保存头部公共数据 | ||
| 228 | + * @name :saveCommonTemplate | ||
| 229 | + * @author :lyh | ||
| 230 | + * @method :post | ||
| 231 | + * @time :2023/10/13 14:27 | ||
| 232 | + */ | ||
| 233 | + public function saveCommonTemplate($param){ | ||
| 234 | + $templateCommonModel = new BTemplateCommon(); | ||
| 235 | + $info = $templateCommonModel->read(['template_id'=>$param['template_id'],'project_id'=>$this->user['project_id']]); | ||
| 236 | +// @file_put_contents(storage_path('logs/lyh_error.log'), var_export($param['html'], true) . PHP_EOL, FILE_APPEND); | ||
| 237 | + $data = [ | ||
| 238 | + 'head_html'=>$param['head_html'], | ||
| 239 | + 'head_css'=>$param['head_css'], | ||
| 240 | + 'footer_html'=>$param['footer_html'], | ||
| 241 | + 'footer_css'=>$param['footer_css'], | ||
| 242 | + 'other'=>str_replace('<header','',characterTruncation($param['html'],"/<link id=\"google-fonts-link\"(.*?)<header/s")), | ||
| 243 | + ]; | ||
| 244 | + if($info === false){ | ||
| 245 | + $data['template_id'] = $param['template_id']; | ||
| 246 | + $data['project_id'] = $this->user['project_id']; | ||
| 247 | + $templateCommonModel->add($data); | ||
| 248 | + }else{ | ||
| 249 | + $templateCommonModel->edit($data,['id'=>$info['id']]); | ||
| 250 | + } | ||
| 251 | + return $this->success(); | ||
| 252 | + } | ||
| 253 | + | ||
| 254 | + /** | ||
| 207 | * @remark :生成记录 | 255 | * @remark :生成记录 |
| 208 | * @name :setTemplateLog | 256 | * @name :setTemplateLog |
| 209 | * @author :lyh | 257 | * @author :lyh |
| @@ -5,6 +5,7 @@ namespace App\Http\Logic\Bside\Nav; | @@ -5,6 +5,7 @@ namespace App\Http\Logic\Bside\Nav; | ||
| 5 | 5 | ||
| 6 | use App\Http\Logic\Bside\BaseLogic; | 6 | use App\Http\Logic\Bside\BaseLogic; |
| 7 | use App\Models\Nav\BNav; | 7 | use App\Models\Nav\BNav; |
| 8 | +use App\Models\Nav\BNavGroup; | ||
| 8 | use App\Models\RouteMap\RouteMap; | 9 | use App\Models\RouteMap\RouteMap; |
| 9 | use Illuminate\Support\Facades\DB; | 10 | use Illuminate\Support\Facades\DB; |
| 10 | 11 | ||
| @@ -36,6 +37,14 @@ class NavLogic extends BaseLogic | @@ -36,6 +37,14 @@ class NavLogic extends BaseLogic | ||
| 36 | { | 37 | { |
| 37 | DB::beginTransaction(); | 38 | DB::beginTransaction(); |
| 38 | try { | 39 | try { |
| 40 | + if(!empty($this->param['location'])){ | ||
| 41 | + if($this->param['location'] == 'header'){ | ||
| 42 | + $this->param['group_id'] = BNavGroup::DEFAULT_HEADER_ID; | ||
| 43 | + } | ||
| 44 | + if($this->param['location'] == 'footer'){ | ||
| 45 | + $this->param['group_id'] = BNavGroup::DEFAULT_FOOTER_ID; | ||
| 46 | + } | ||
| 47 | + } | ||
| 39 | $this->param['image'] = str_replace_url(isset($this->param['image']) ? $this->param['image'] : ''); | 48 | $this->param['image'] = str_replace_url(isset($this->param['image']) ? $this->param['image'] : ''); |
| 40 | $this->param['remark_image'] = str_replace_url(isset($this->param['remark_image']) ? $this->param['remark_image'] : ''); | 49 | $this->param['remark_image'] = str_replace_url(isset($this->param['remark_image']) ? $this->param['remark_image'] : ''); |
| 41 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 50 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| @@ -336,12 +336,9 @@ class ProductLogic extends BaseLogic | @@ -336,12 +336,9 @@ class ProductLogic extends BaseLogic | ||
| 336 | public function batchSetCategory(){ | 336 | public function batchSetCategory(){ |
| 337 | DB::beginTransaction(); | 337 | DB::beginTransaction(); |
| 338 | try { | 338 | try { |
| 339 | - //删除分类关联表记录 | ||
| 340 | - $categoryRelatedModel = new CategoryRelated(); | ||
| 341 | - $categoryRelatedModel->del(['product_id'=>['in',$this->param['id']]]); | ||
| 342 | //批量 | 339 | //批量 |
| 343 | $param = [ | 340 | $param = [ |
| 344 | - 'category_id'=>Arr::arrToSet($this->param['category_id']), | 341 | + 'category_id'=>','.Arr::arrToSet($this->param['category_id']).',', |
| 345 | 'status'=>$this->param['status'] | 342 | 'status'=>$this->param['status'] |
| 346 | ]; | 343 | ]; |
| 347 | $this->model->edit($param,['id'=>['in',$this->param['id']]]); | 344 | $this->model->edit($param,['id'=>['in',$this->param['id']]]); |
| @@ -349,7 +346,7 @@ class ProductLogic extends BaseLogic | @@ -349,7 +346,7 @@ class ProductLogic extends BaseLogic | ||
| 349 | //对应添加关联表 | 346 | //对应添加关联表 |
| 350 | }catch (\Exception $e){ | 347 | }catch (\Exception $e){ |
| 351 | DB::rollBack(); | 348 | DB::rollBack(); |
| 352 | - $this->fail('error'); | 349 | + $this->fail('系统错误,请联系管理员'); |
| 353 | } | 350 | } |
| 354 | return $this->success(); | 351 | return $this->success(); |
| 355 | } | 352 | } |
| @@ -33,7 +33,7 @@ class WebSettingReceivingLogic extends BaseLogic | @@ -33,7 +33,7 @@ class WebSettingReceivingLogic extends BaseLogic | ||
| 33 | * @time :2023/5/8 16:26 | 33 | * @time :2023/5/8 16:26 |
| 34 | */ | 34 | */ |
| 35 | public function setting_receiving_save(){ | 35 | public function setting_receiving_save(){ |
| 36 | -// try { | 36 | + try { |
| 37 | $this->model->del(['project_id'=>$this->user['project_id']]); | 37 | $this->model->del(['project_id'=>$this->user['project_id']]); |
| 38 | foreach ($this->param['data'] as $k => $v){ | 38 | foreach ($this->param['data'] as $k => $v){ |
| 39 | $v['project_id'] = $this->user['project_id']; | 39 | $v['project_id'] = $this->user['project_id']; |
| @@ -42,9 +42,9 @@ class WebSettingReceivingLogic extends BaseLogic | @@ -42,9 +42,9 @@ class WebSettingReceivingLogic extends BaseLogic | ||
| 42 | $this->param['data'][$k] = $v; | 42 | $this->param['data'][$k] = $v; |
| 43 | } | 43 | } |
| 44 | $this->model->insert($this->param['data']); | 44 | $this->model->insert($this->param['data']); |
| 45 | -// }catch (\Exception $e){ | ||
| 46 | -// $this->fail('error'); | ||
| 47 | -// } | 45 | + }catch (\Exception $e){ |
| 46 | + $this->fail('error'); | ||
| 47 | + } | ||
| 48 | return $this->success(); | 48 | return $this->success(); |
| 49 | } | 49 | } |
| 50 | } | 50 | } |
| @@ -41,6 +41,9 @@ class WebSettingServiceLogic extends BaseLogic | @@ -41,6 +41,9 @@ class WebSettingServiceLogic extends BaseLogic | ||
| 41 | //删除以前的数据 | 41 | //删除以前的数据 |
| 42 | $this->model->del(['project_id'=>$this->user['project_id']]); | 42 | $this->model->del(['project_id'=>$this->user['project_id']]); |
| 43 | foreach ($this->param['data'] as $k => $v){ | 43 | foreach ($this->param['data'] as $k => $v){ |
| 44 | + if(!isset($v['values']) || empty($v['values'])){ | ||
| 45 | + $v['values'] = ''; | ||
| 46 | + } | ||
| 44 | $v['project_id'] = $this->user['project_id']; | 47 | $v['project_id'] = $this->user['project_id']; |
| 45 | $v['created_at'] = date('Y-m-d H:i:s'); | 48 | $v['created_at'] = date('Y-m-d H:i:s'); |
| 46 | $v['updated_at'] = date('Y-m-d H:i:s'); | 49 | $v['updated_at'] = date('Y-m-d H:i:s'); |
| @@ -50,7 +53,7 @@ class WebSettingServiceLogic extends BaseLogic | @@ -50,7 +53,7 @@ class WebSettingServiceLogic extends BaseLogic | ||
| 50 | DB::commit(); | 53 | DB::commit(); |
| 51 | }catch (\Exception $e){ | 54 | }catch (\Exception $e){ |
| 52 | DB::rollBack(); | 55 | DB::rollBack(); |
| 53 | - $this->fail('error'); | 56 | + $this->fail('系统错误,请联系管理员'); |
| 54 | } | 57 | } |
| 55 | return $this->success(); | 58 | return $this->success(); |
| 56 | } | 59 | } |
| @@ -32,6 +32,7 @@ class NavRequest extends FormRequest | @@ -32,6 +32,7 @@ class NavRequest extends FormRequest | ||
| 32 | public function rules() | 32 | public function rules() |
| 33 | { | 33 | { |
| 34 | $rule = [ | 34 | $rule = [ |
| 35 | +// 'group_id' => ['required','integer'], | ||
| 35 | 'pid' => ['required','integer'], | 36 | 'pid' => ['required','integer'], |
| 36 | 'name' => ['required','max:100'], | 37 | 'name' => ['required','max:100'], |
| 37 | ]; | 38 | ]; |
| @@ -41,6 +42,8 @@ class NavRequest extends FormRequest | @@ -41,6 +42,8 @@ class NavRequest extends FormRequest | ||
| 41 | public function messages() | 42 | public function messages() |
| 42 | { | 43 | { |
| 43 | return [ | 44 | return [ |
| 45 | + 'group_id.required' => '未定义菜单组', | ||
| 46 | + 'group_id.integer' => '菜单组错误', | ||
| 44 | 'pid.required' => '上级选择错误', | 47 | 'pid.required' => '上级选择错误', |
| 45 | 'pid.gte' => '上级选择错误', | 48 | 'pid.gte' => '上级选择错误', |
| 46 | 'pid.integer' => '上级选择错误', | 49 | 'pid.integer' => '上级选择错误', |
app/Models/Nav/BNavGroup.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Models\Nav; | ||
| 4 | + | ||
| 5 | +use App\Models\Base; | ||
| 6 | +use Illuminate\Database\Eloquent\SoftDeletes; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * Class BNavGroup | ||
| 10 | + * @package App\Models\Nav | ||
| 11 | + * @author zbj | ||
| 12 | + * @date 2023/10/9 | ||
| 13 | + */ | ||
| 14 | +class BNavGroup extends Base | ||
| 15 | +{ | ||
| 16 | + | ||
| 17 | + protected $table = 'gl_web_nav_group'; | ||
| 18 | + //连接数据库 | ||
| 19 | + protected $connection = 'custom_mysql'; | ||
| 20 | + use SoftDeletes; | ||
| 21 | + | ||
| 22 | + public $hidden = ['deleted_at']; | ||
| 23 | + | ||
| 24 | + const DEFAULT_HEADER_ID = 1; | ||
| 25 | + const DEFAULT_FOOTER_ID = 2; | ||
| 26 | + | ||
| 27 | +} |
app/Models/Template/BTemplateCommon.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :BTemplateCommon.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2023/10/13 11:45 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Models\Template; | ||
| 11 | + | ||
| 12 | +use App\Models\Base; | ||
| 13 | + | ||
| 14 | +class BTemplateCommon extends Base | ||
| 15 | +{ | ||
| 16 | + protected $table = 'gl_web_template_common'; | ||
| 17 | + //连接数据库 | ||
| 18 | + protected $connection = 'custom_mysql'; | ||
| 19 | +} |
| @@ -103,14 +103,20 @@ class ProjectServer extends BaseService | @@ -103,14 +103,20 @@ class ProjectServer extends BaseService | ||
| 103 | if(empty($info)){ | 103 | if(empty($info)){ |
| 104 | $created_at = date('Y-m-d H:i:s'); | 104 | $created_at = date('Y-m-d H:i:s'); |
| 105 | $data = [ | 105 | $data = [ |
| 106 | - ['project_id'=>$project_id,'name'=>'Home','url'=>'nav-home-'.$project_id,'location'=>'header','created_at'=>$created_at,'updated_at'=>$created_at], | ||
| 107 | - ['project_id'=>$project_id,'name'=>'Products','url'=>'nav-product'.$project_id,'location'=>'header','created_at'=>$created_at,'updated_at'=>$created_at], | ||
| 108 | - ['project_id'=>$project_id,'name'=>'News','url'=>'nav-news'.$project_id,'location'=>'header','created_at'=>$created_at,'updated_at'=>$created_at], | ||
| 109 | - ['project_id'=>$project_id,'name'=>'ABOUT US','url'=>'nav-about-us'.$project_id,'location'=>'footer','created_at'=>$created_at,'updated_at'=>$created_at], | ||
| 110 | - ['project_id'=>$project_id,'name'=>'Contact Us','url'=>'nav-contact-us'.$project_id,'location'=>'footer','created_at'=>$created_at,'updated_at'=>$created_at], | ||
| 111 | - ['project_id'=>$project_id,'name'=>'FAQ','url'=>'nav-faq'.$project_id,'location'=>'footer','created_at'=>$created_at,'updated_at'=>$created_at], | 106 | + ['project_id'=>$project_id,'name'=>'Home','url'=>'nav-home-'.$project_id,'location'=>'header','group_id'=>1,'created_at'=>$created_at,'updated_at'=>$created_at], |
| 107 | + ['project_id'=>$project_id,'name'=>'Products','url'=>'nav-product'.$project_id,'location'=>'header','group_id'=>1,'created_at'=>$created_at,'updated_at'=>$created_at], | ||
| 108 | + ['project_id'=>$project_id,'name'=>'News','url'=>'nav-news'.$project_id,'location'=>'header','group_id'=>1,'created_at'=>$created_at,'updated_at'=>$created_at], | ||
| 109 | + ['project_id'=>$project_id,'name'=>'ABOUT US','url'=>'nav-about-us'.$project_id,'location'=>'footer','group_id'=>2,'created_at'=>$created_at,'updated_at'=>$created_at], | ||
| 110 | + ['project_id'=>$project_id,'name'=>'Contact Us','url'=>'nav-contact-us'.$project_id,'location'=>'footer','group_id'=>2,'created_at'=>$created_at,'updated_at'=>$created_at], | ||
| 111 | + ['project_id'=>$project_id,'name'=>'FAQ','url'=>'nav-faq'.$project_id,'location'=>'footer','group_id'=>2,'created_at'=>$created_at,'updated_at'=>$created_at], | ||
| 112 | ]; | 112 | ]; |
| 113 | DB::connection('custom_mysql')->table('gl_web_nav')->insert($data); | 113 | DB::connection('custom_mysql')->table('gl_web_nav')->insert($data); |
| 114 | + | ||
| 115 | + $data = [ | ||
| 116 | + ['project_id'=>$project_id,'name'=>'全局顶部菜单','created_at'=>$created_at,'updated_at'=>$created_at], | ||
| 117 | + ['project_id'=>$project_id,'name'=>'底部菜单','created_at'=>$created_at,'updated_at'=>$created_at], | ||
| 118 | + ]; | ||
| 119 | + DB::connection('custom_mysql')->table('gl_web_nav_group')->insert($data); | ||
| 114 | } | 120 | } |
| 115 | DB::disconnect('custom_mysql'); | 121 | DB::disconnect('custom_mysql'); |
| 116 | return true; | 122 | return true; |
-
请 注册 或 登录 后发表评论