Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into develop
正在显示
18 个修改的文件
包含
160 行增加
和
156 行删除
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | -namespace App\Console\Commands; | 3 | +namespace App\Console\Commands\DayCount; |
| 4 | 4 | ||
| 5 | use App\Models\Inquiry\InquiryInfo; | 5 | use App\Models\Inquiry\InquiryInfo; |
| 6 | use Illuminate\Console\Command; | 6 | use Illuminate\Console\Command; |
| @@ -48,6 +48,7 @@ class InquiryDelay extends Command | @@ -48,6 +48,7 @@ class InquiryDelay extends Command | ||
| 48 | $data['url'] = $v; | 48 | $data['url'] = $v; |
| 49 | $this->inquiryForward($data); | 49 | $this->inquiryForward($data); |
| 50 | } | 50 | } |
| 51 | + $inquiryInfoModel->edit(['status'=>1],['id'=>$param['id']]); | ||
| 51 | } | 52 | } |
| 52 | } | 53 | } |
| 53 | return true; | 54 | return true; |
| @@ -78,4 +79,5 @@ class InquiryDelay extends Command | @@ -78,4 +79,5 @@ class InquiryDelay extends Command | ||
| 78 | ); | 79 | ); |
| 79 | return http_post($url,$post_data_new,$header); | 80 | return http_post($url,$post_data_new,$header); |
| 80 | } | 81 | } |
| 82 | + | ||
| 81 | } | 83 | } |
| @@ -30,7 +30,7 @@ class Kernel extends ConsoleKernel | @@ -30,7 +30,7 @@ class Kernel extends ConsoleKernel | ||
| 30 | $schedule->command('sync_channel')->dailyAt('06:00')->withoutOverlapping(1); // 渠道信息,每周执行一次 | 30 | $schedule->command('sync_channel')->dailyAt('06:00')->withoutOverlapping(1); // 渠道信息,每周执行一次 |
| 31 | $schedule->command('sync_project')->everyMinute()->withoutOverlapping(1); //同步项目 | 31 | $schedule->command('sync_project')->everyMinute()->withoutOverlapping(1); //同步项目 |
| 32 | $schedule->command('month_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计记录 | 32 | $schedule->command('month_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计记录 |
| 33 | -// $schedule->command('inquiry_delay')->everyMinute()->withoutOverlapping(1);//每分钟执行一次 | 33 | +// $schedule->command('inquiry_delay')->everyMinute()->withoutOverlapping(1);//TODO::上线放开,转发询盘,每分钟执行一次 |
| 34 | $schedule->command('inquiry_count')->dailyAt('01:00')->withoutOverlapping(1); // 询盘统计数据,每天凌晨执行一次 | 34 | $schedule->command('inquiry_count')->dailyAt('01:00')->withoutOverlapping(1); // 询盘统计数据,每天凌晨执行一次 |
| 35 | // // 更新域名|证书结束时间,每天凌晨1点执行一次 | 35 | // // 更新域名|证书结束时间,每天凌晨1点执行一次 |
| 36 | // $schedule->command('domain_time')->dailyAt('01:00')->withoutOverlapping(1); | 36 | // $schedule->command('domain_time')->dailyAt('01:00')->withoutOverlapping(1); |
| @@ -137,23 +137,6 @@ class BaseController extends Controller | @@ -137,23 +137,6 @@ class BaseController extends Controller | ||
| 137 | throw new HttpResponseException($response); | 137 | throw new HttpResponseException($response); |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | - /** | ||
| 141 | - * @remark :获取文件交接链接 | ||
| 142 | - * @name :getImageUrl | ||
| 143 | - * @author :lyh | ||
| 144 | - * @method :post | ||
| 145 | - * @time :2023/7/20 16:46 | ||
| 146 | - */ | ||
| 147 | - public function getFileUrl($hash){ | ||
| 148 | - $fileModel = new File(); | ||
| 149 | - $info = $fileModel->read(['hash'=>$hash]); | ||
| 150 | - if($info['is_cos'] == 1){ | ||
| 151 | - $cos = new CosService(); | ||
| 152 | - $url = $cos->getImageUrl($info['path']); | ||
| 153 | - }else{ | ||
| 154 | - $url = url('a/file/'.$info['hash']); | ||
| 155 | - } | ||
| 156 | - return $url; | ||
| 157 | - } | 140 | + |
| 158 | 141 | ||
| 159 | } | 142 | } |
| @@ -20,30 +20,14 @@ class ServerInformationController extends BaseController | @@ -20,30 +20,14 @@ class ServerInformationController extends BaseController | ||
| 20 | /** | 20 | /** |
| 21 | * @return JsonResponse | 21 | * @return JsonResponse |
| 22 | */ | 22 | */ |
| 23 | - public function lists($deleted = ServerInformation::DELETED_NORMAL) | 23 | + public function lists() |
| 24 | { | 24 | { |
| 25 | - $request = $this->param; | ||
| 26 | - $search = []; | ||
| 27 | - $search_array = [ | ||
| 28 | - 'ip' => 'ip', | ||
| 29 | - 'title' => 'title' | ||
| 30 | - ]; | ||
| 31 | - foreach ($search_array as $key => $item) { | ||
| 32 | - if (isset($request[$key]) && $request[$key]) { | ||
| 33 | - $search[$item] = $request[$key]; | ||
| 34 | - } | 25 | + if(isset($this->map['title']) && !empty($this->map['title'])){ |
| 26 | + $this->map['title'] = ['like','%'.$this->map['title'],',']; | ||
| 35 | } | 27 | } |
| 36 | - $size = request()->input('size', $this->row); | ||
| 37 | - $query = ServerInformation::query()->select(['id', 'title', 'ip']); | ||
| 38 | - if ($search) { | ||
| 39 | - foreach ($search as $key => $item) { | ||
| 40 | - $query = $query->Where("{$key}", 'like', "%{$item}%"); | ||
| 41 | - } | ||
| 42 | - } | ||
| 43 | - $data = $query->where('deleted', $deleted) | ||
| 44 | - ->orderBy('id', 'desc') | ||
| 45 | - ->paginate($size); | ||
| 46 | - return $this->response('success', Code::SUCCESS, $data); | 28 | + $serverInformationModel = new ServerInformation(); |
| 29 | + $lists = $serverInformationModel->lists($this->map,$this->page,$this->row,$this->order); | ||
| 30 | + $this->response('success', Code::SUCCESS, $lists); | ||
| 47 | 31 | ||
| 48 | } | 32 | } |
| 49 | 33 | ||
| @@ -97,14 +81,6 @@ class ServerInformationController extends BaseController | @@ -97,14 +81,6 @@ class ServerInformationController extends BaseController | ||
| 97 | $this->response('服务器删除成功!'); | 81 | $this->response('服务器删除成功!'); |
| 98 | } | 82 | } |
| 99 | 83 | ||
| 100 | - /** | ||
| 101 | - * 获取软删除的数据 | ||
| 102 | - * @return JsonResponse | ||
| 103 | - */ | ||
| 104 | - public function delete_list() | ||
| 105 | - { | ||
| 106 | - return $this->lists(ServerInformation::DELETED_DELETE); | ||
| 107 | - } | ||
| 108 | 84 | ||
| 109 | /** | 85 | /** |
| 110 | * 恢复数据 | 86 | * 恢复数据 |
| @@ -120,33 +96,6 @@ class ServerInformationController extends BaseController | @@ -120,33 +96,6 @@ class ServerInformationController extends BaseController | ||
| 120 | } | 96 | } |
| 121 | 97 | ||
| 122 | 98 | ||
| 123 | - /** | ||
| 124 | - * 搜索 | ||
| 125 | - * @param Request $request | ||
| 126 | - * @return JsonResponse | ||
| 127 | - */ | ||
| 128 | - public function search(Request $request) | ||
| 129 | - { | ||
| 130 | - $search = []; | ||
| 131 | - $ip = $request->input('ip'); | ||
| 132 | - if ($ip) { | ||
| 133 | - $search['ip'] = $ip; | ||
| 134 | - } | ||
| 135 | - $remark = $request->input('title'); | ||
| 136 | - if ($remark) { | ||
| 137 | - $search['title'] = $remark; | ||
| 138 | - } | ||
| 139 | - if (empty($search)) { | ||
| 140 | - return $this->response('请输入搜索内容', Code::USER_ERROR); | ||
| 141 | - } | ||
| 142 | - $query = ServerInformation::query()->select(['id', 'title', 'ip']); | ||
| 143 | - foreach ($search as $key => $item) { | ||
| 144 | - $query = $query->Where("{$key}", 'like', "%{$item}%"); | ||
| 145 | - } | ||
| 146 | - $size = $request->input('size', $this->row); | ||
| 147 | - $query = $query->orderBy('id', 'desc')->paginate($size); | ||
| 148 | - return $this->response('success', Code::SUCCESS, $query); | ||
| 149 | - } | ||
| 150 | 99 | ||
| 151 | /** | 100 | /** |
| 152 | * 服务器信息 | 101 | * 服务器信息 |
| @@ -6,7 +6,7 @@ use App\Http\Controllers\Aside\BaseController; | @@ -6,7 +6,7 @@ use App\Http\Controllers\Aside\BaseController; | ||
| 6 | use App\Http\Logic\Aside\Optimize\OptimizeLogic; | 6 | use App\Http\Logic\Aside\Optimize\OptimizeLogic; |
| 7 | 7 | ||
| 8 | /** | 8 | /** |
| 9 | - * @remark :优化方案设置 | 9 | + * @remark :授权域名 |
| 10 | * @name :OptimizeController | 10 | * @name :OptimizeController |
| 11 | * @author :lyh | 11 | * @author :lyh |
| 12 | * @time :2023/6/20 14:33 | 12 | * @time :2023/6/20 14:33 |
| @@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
| 2 | 2 | ||
| 3 | namespace App\Http\Controllers\Aside\Project; | 3 | namespace App\Http\Controllers\Aside\Project; |
| 4 | 4 | ||
| 5 | +use App\Enums\Common\Code; | ||
| 5 | use App\Http\Controllers\Aside\BaseController; | 6 | use App\Http\Controllers\Aside\BaseController; |
| 6 | use App\Http\Logic\Aside\Project\OnlineCheckLogic; | 7 | use App\Http\Logic\Aside\Project\OnlineCheckLogic; |
| 7 | use App\Http\Logic\Aside\Project\ProcessRecordsLogic; | 8 | use App\Http\Logic\Aside\Project\ProcessRecordsLogic; |
| @@ -31,7 +32,11 @@ class ProjectController extends BaseController | @@ -31,7 +32,11 @@ class ProjectController extends BaseController | ||
| 31 | $map = []; | 32 | $map = []; |
| 32 | //搜索类型 | 33 | //搜索类型 |
| 33 | if(!empty($this->param['type'])){ | 34 | if(!empty($this->param['type'])){ |
| 34 | - $map[] = ['type', $this->param['type']]; | 35 | + if($this->param['type'] == 3){//推广中 |
| 36 | + $map[] = ['type', '>=' ,$this->param['type']]; | ||
| 37 | + }else{ | ||
| 38 | + $map[] = ['type', $this->param['type']]; | ||
| 39 | + } | ||
| 35 | } | 40 | } |
| 36 | //搜索技术组 | 41 | //搜索技术组 |
| 37 | if(!empty($this->param['dep_id'])){ | 42 | if(!empty($this->param['dep_id'])){ |
| @@ -67,8 +72,8 @@ class ProjectController extends BaseController | @@ -67,8 +72,8 @@ class ProjectController extends BaseController | ||
| 67 | ],[ | 72 | ],[ |
| 68 | 'id.required' => 'ID不能为空' | 73 | 'id.required' => 'ID不能为空' |
| 69 | ]); | 74 | ]); |
| 70 | - $data = $logic->getInfo($this->param['id']); | ||
| 71 | - return $this->success($data); | 75 | + $data = $logic->getProjectInfo($this->param['id']); |
| 76 | + $this->response('success',Code::SUCCESS,$data); | ||
| 72 | } | 77 | } |
| 73 | 78 | ||
| 74 | public function save(ProjectRequest $request, ProjectLogic $logic) | 79 | public function save(ProjectRequest $request, ProjectLogic $logic) |
| @@ -231,22 +231,4 @@ class BaseController extends Controller | @@ -231,22 +231,4 @@ class BaseController extends Controller | ||
| 231 | return ''; | 231 | return ''; |
| 232 | } | 232 | } |
| 233 | 233 | ||
| 234 | - /** | ||
| 235 | - * @remark :获取文件交接链接 | ||
| 236 | - * @name :getImageUrl | ||
| 237 | - * @author :lyh | ||
| 238 | - * @method :post | ||
| 239 | - * @time :2023/7/20 16:46 | ||
| 240 | - */ | ||
| 241 | - public function getFileUrl($hash){ | ||
| 242 | - $fileModel = new File(); | ||
| 243 | - $info = $fileModel->read(['hash'=>$hash]); | ||
| 244 | - if($info['is_cos'] == 1){ | ||
| 245 | - $cos = new CosService(); | ||
| 246 | - $url = $cos->getImageUrl($info['path']); | ||
| 247 | - }else{ | ||
| 248 | - $url = url('a/file/'.$info['hash']); | ||
| 249 | - } | ||
| 250 | - return $url; | ||
| 251 | - } | ||
| 252 | } | 234 | } |
| @@ -20,6 +20,7 @@ use Carbon\Carbon; | @@ -20,6 +20,7 @@ use Carbon\Carbon; | ||
| 20 | use Illuminate\Http\Request; | 20 | use Illuminate\Http\Request; |
| 21 | use Illuminate\Support\Facades\Cache; | 21 | use Illuminate\Support\Facades\Cache; |
| 22 | use Illuminate\Support\Facades\DB; | 22 | use Illuminate\Support\Facades\DB; |
| 23 | +use Illuminate\Support\Facades\Route; | ||
| 23 | use Mrgoon\AliSms\AliSms; | 24 | use Mrgoon\AliSms\AliSms; |
| 24 | 25 | ||
| 25 | /*** | 26 | /*** |
| @@ -176,4 +177,9 @@ class ComController extends BaseController | @@ -176,4 +177,9 @@ class ComController extends BaseController | ||
| 176 | $str = Translate::tran($this->param['str'], 'en'); | 177 | $str = Translate::tran($this->param['str'], 'en'); |
| 177 | $this->response('success',Code::SUCCESS,$str); | 178 | $this->response('success',Code::SUCCESS,$str); |
| 178 | } | 179 | } |
| 180 | + | ||
| 181 | + public function ceshi(){ | ||
| 182 | + return $this->request->route()->getAction(); | ||
| 183 | +// return Route::currentRouteName(); | ||
| 184 | + } | ||
| 179 | } | 185 | } |
| @@ -55,7 +55,7 @@ class ProductController extends BaseController | @@ -55,7 +55,7 @@ class ProductController extends BaseController | ||
| 55 | $map[] = ['status', $this->param['status']]; | 55 | $map[] = ['status', $this->param['status']]; |
| 56 | } | 56 | } |
| 57 | $sort = ['id' => 'desc']; | 57 | $sort = ['id' => 'desc']; |
| 58 | - $data = $logic->getList($map, $sort, ['id', 'project_id', 'title', 'thumb', 'product_type' ,'category_id', 'keyword_id', 'status', 'created_uid', 'created_at', 'updated_at']); | 58 | + $data = $logic->getList($map, $sort, ['id', 'project_id', 'title', 'thumb', 'product_type' ,'category_id', 'keyword_id', 'status', 'created_uid', 'created_at', 'updated_at'],$this->row); |
| 59 | return $this->success($data); | 59 | return $this->success($data); |
| 60 | } | 60 | } |
| 61 | 61 | ||
| @@ -94,4 +94,16 @@ class ProductController extends BaseController | @@ -94,4 +94,16 @@ class ProductController extends BaseController | ||
| 94 | $data = $logic->getStatusNumber(); | 94 | $data = $logic->getStatusNumber(); |
| 95 | $this->response('success',Code::SUCCESS,$data); | 95 | $this->response('success',Code::SUCCESS,$data); |
| 96 | } | 96 | } |
| 97 | + | ||
| 98 | + /** | ||
| 99 | + * @remark :复制产品 | ||
| 100 | + * @name :copyProduct | ||
| 101 | + * @author :lyh | ||
| 102 | + * @method :post | ||
| 103 | + * @time :2023/7/29 14:59 | ||
| 104 | + */ | ||
| 105 | + public function copyProduct(ProductLogic $logic){ | ||
| 106 | + $rs = $logic->setCopyProduct(); | ||
| 107 | + $this->response('success',Code::SUCCESS,$rs); | ||
| 108 | + } | ||
| 97 | } | 109 | } |
| 1 | -<?php | ||
| 2 | - | ||
| 3 | -namespace App\Http\Controllers\Bside\Template; | ||
| 4 | - | ||
| 5 | -use App\Http\Controllers\Bside\BaseController; | ||
| 6 | - | ||
| 7 | -/** | ||
| 8 | - * @remark :模块相关配置 | ||
| 9 | - * @class :ModuleTypeController.php | ||
| 10 | - * @author :lyh | ||
| 11 | - * @time :2023/7/17 15:31 | ||
| 12 | - */ | ||
| 13 | -class ModuleTypeController extends BaseController | ||
| 14 | -{ | ||
| 15 | - /** | ||
| 16 | - * @remark :获取模版类型 | ||
| 17 | - * @name :getModuleTypeList | ||
| 18 | - * @author :lyh | ||
| 19 | - * @method :post | ||
| 20 | - * @time :2023/7/17 15:32 | ||
| 21 | - */ | ||
| 22 | - public function getModuleTypeList(){ | ||
| 23 | - | ||
| 24 | - } | ||
| 25 | -} |
| @@ -12,18 +12,6 @@ use Illuminate\Support\Facades\Cache; | @@ -12,18 +12,6 @@ use Illuminate\Support\Facades\Cache; | ||
| 12 | 12 | ||
| 13 | class FileController | 13 | class FileController |
| 14 | { | 14 | { |
| 15 | - public $upload_img = [ | ||
| 16 | - //设置静态缓存参数(304) | ||
| 17 | - 'header' => [ | ||
| 18 | - 'Cache-Control' => 'max-age=2592000', | ||
| 19 | - 'Pragma' => 'cache', | ||
| 20 | - 'Expires' => "%Expires%", // cache 1 month | ||
| 21 | - 'etag' => "%etag%", | ||
| 22 | - 'Last-Modified' => "%Last-Modified%", | ||
| 23 | - 'Content-Description' => 'File Transfer', | ||
| 24 | - ], | ||
| 25 | - ]; | ||
| 26 | - | ||
| 27 | public $path = '';//路径 | 15 | public $path = '';//路径 |
| 28 | 16 | ||
| 29 | public $config = '';//存储默认配置 | 17 | public $config = '';//存储默认配置 |
| @@ -58,7 +58,7 @@ class ProjectLogic extends BaseLogic | @@ -58,7 +58,7 @@ class ProjectLogic extends BaseLogic | ||
| 58 | 'optimize_optimist' => ManageLogic::getCacheName($item['deploy_optimize']['optimist_mid'] ?? 0), //优化师 | 58 | 'optimize_optimist' => ManageLogic::getCacheName($item['deploy_optimize']['optimist_mid'] ?? 0), //优化师 |
| 59 | 'optimize_assist' => ManageLogic::getCacheName($item['deploy_optimize']['assist_mid'] ?? 0), //优化助理 | 59 | 'optimize_assist' => ManageLogic::getCacheName($item['deploy_optimize']['assist_mid'] ?? 0), //优化助理 |
| 60 | 'optimize_tech' => ManageLogic::getCacheName($item['deploy_optimize']['tech_mid'] ?? 0), //售后技术 | 60 | 'optimize_tech' => ManageLogic::getCacheName($item['deploy_optimize']['tech_mid'] ?? 0), //售后技术 |
| 61 | - 'type' => $this->model::typeMap()[$item['type']] ?? '', | 61 | + 'type' => $item['type'], |
| 62 | 'test_domain' => $item['deploy_build']['test_domain'] ?? 0, | 62 | 'test_domain' => $item['deploy_build']['test_domain'] ?? 0, |
| 63 | 'domain' => $item['deploy_optimize']['domain'] ?? 0, | 63 | 'domain' => $item['deploy_optimize']['domain'] ?? 0, |
| 64 | 'created_at' => date('Y年m月d日', strtotime($item['created_at'])), | 64 | 'created_at' => date('Y年m月d日', strtotime($item['created_at'])), |
| @@ -86,6 +86,18 @@ class ProjectLogic extends BaseLogic | @@ -86,6 +86,18 @@ class ProjectLogic extends BaseLogic | ||
| 86 | return parent::getInfo($id); | 86 | return parent::getInfo($id); |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | + /** | ||
| 90 | + * @remark :获取当前数据详情 | ||
| 91 | + * @name :getProjectInfo | ||
| 92 | + * @author :lyh | ||
| 93 | + * @method :post | ||
| 94 | + * @time :2023/7/28 17:11 | ||
| 95 | + */ | ||
| 96 | + public function getProjectInfo($id){ | ||
| 97 | + $info = $this->model->with('payment')->with('deploy_build') | ||
| 98 | + ->with('deploy_optimize')->with('online_check')->where(['id'=>$id])->first(); | ||
| 99 | + return $this->success($info); | ||
| 100 | + } | ||
| 89 | public function save($param){ | 101 | public function save($param){ |
| 90 | if(!empty($param['deploy_optimize']['domain'])){ | 102 | if(!empty($param['deploy_optimize']['domain'])){ |
| 91 | $param['deploy_optimize']['domain'] = checkDomain($param['deploy_optimize']['domain']); | 103 | $param['deploy_optimize']['domain'] = checkDomain($param['deploy_optimize']['domain']); |
| @@ -26,9 +26,9 @@ class ProductLogic extends BaseLogic | @@ -26,9 +26,9 @@ class ProductLogic extends BaseLogic | ||
| 26 | $this->model = new Product(); | 26 | $this->model = new Product(); |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | - public function getList(array $map = [], array $sort = ['id' => 'desc'], array $columns = ['*'], int $limit = 20) | 29 | + public function getList(array $map = [], array $sort = ['id' => 'desc'], array $columns = ['*'], int $row = 20) |
| 30 | { | 30 | { |
| 31 | - $data = parent::getList($map, $sort, $columns, $limit); | 31 | + $data = parent::getList($map, $sort, $columns, $row); |
| 32 | foreach ($data['list'] as &$v){ | 32 | foreach ($data['list'] as &$v){ |
| 33 | $v = $this->formatData($v); | 33 | $v = $this->formatData($v); |
| 34 | $v['thumb']['image_link'] = getImageUrl($v['thumb']['url']);//图片统一 | 34 | $v['thumb']['image_link'] = getImageUrl($v['thumb']['url']);//图片统一 |
| @@ -142,4 +142,19 @@ class ProductLogic extends BaseLogic | @@ -142,4 +142,19 @@ class ProductLogic extends BaseLogic | ||
| 142 | } | 142 | } |
| 143 | return $this->success($data); | 143 | return $this->success($data); |
| 144 | } | 144 | } |
| 145 | + | ||
| 146 | + /** | ||
| 147 | + * @remark :复制产品 | ||
| 148 | + * @name :setCopyProduct | ||
| 149 | + * @author :lyh | ||
| 150 | + * @method :post | ||
| 151 | + * @time :2023/7/29 15:03 | ||
| 152 | + */ | ||
| 153 | + public function setCopyProduct(){ | ||
| 154 | + var_dump($this->param); | ||
| 155 | + die(); | ||
| 156 | + $info = $this->model->read(['id'=>$this->param['id']]); | ||
| 157 | + var_dump($info); | ||
| 158 | + die(); | ||
| 159 | + } | ||
| 145 | } | 160 | } |
| @@ -6,6 +6,7 @@ use App\Enums\Common\Code; | @@ -6,6 +6,7 @@ use App\Enums\Common\Code; | ||
| 6 | use App\Http\Logic\Aside\LoginLogic; | 6 | use App\Http\Logic\Aside\LoginLogic; |
| 7 | use App\Models\Manage\Group; | 7 | use App\Models\Manage\Group; |
| 8 | use App\Models\Manage\Manage; | 8 | use App\Models\Manage\Manage; |
| 9 | +use App\Models\Manage\Menu; | ||
| 9 | use Closure; | 10 | use Closure; |
| 10 | use Illuminate\Http\Request; | 11 | use Illuminate\Http\Request; |
| 11 | use Illuminate\Support\Facades\Route; | 12 | use Illuminate\Support\Facades\Route; |
| @@ -32,6 +33,44 @@ class LoginAuthMiddleware | @@ -32,6 +33,44 @@ class LoginAuthMiddleware | ||
| 32 | return response(['code'=> Code::USER_LOGIN_ERROE,'msg'=>'当前用户被禁用']); | 33 | return response(['code'=> Code::USER_LOGIN_ERROE,'msg'=>'当前用户被禁用']); |
| 33 | } | 34 | } |
| 34 | } | 35 | } |
| 36 | + $groupInfo = $this->getGroup($manage); | ||
| 37 | + //获取当前操作的路由name | ||
| 38 | + $action = Route::currentRouteName(); | ||
| 39 | + //TODO::操作权限 | ||
| 40 | + $this->viewOperateAuth($groupInfo,$action); | ||
| 35 | return $next($request); | 41 | return $next($request); |
| 36 | } | 42 | } |
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * @remark :查看角色是否被禁用 | ||
| 46 | + * @name :getGroup | ||
| 47 | + * @author :lyh | ||
| 48 | + * @method :post | ||
| 49 | + * @time :2023/7/28 15:26 | ||
| 50 | + */ | ||
| 51 | + public function getGroup($manage){ | ||
| 52 | + $groupModel = new Group(); | ||
| 53 | + $groupInfo = $groupModel->read(['id'=>$manage['gid']]); | ||
| 54 | + if($groupInfo['status'] != 0){ | ||
| 55 | + return response(['code'=> Code::USER_LOGIN_ERROE,'msg'=>'当前用户角色被禁用']); | ||
| 56 | + } | ||
| 57 | + return $groupInfo; | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + /** | ||
| 61 | + * @remark :查看操作权限 | ||
| 62 | + * @name :viewOperateAuth | ||
| 63 | + * @author :lyh | ||
| 64 | + * @method :post | ||
| 65 | + * @time :2023/7/28 14:56 | ||
| 66 | + */ | ||
| 67 | + public function viewOperateAuth($groupInfo,$action){ | ||
| 68 | + $menuModel = new Menu(); | ||
| 69 | + $menu_id = $menuModel->read(['route_name'=>$action],['id']); | ||
| 70 | + if($menu_id !== false){ | ||
| 71 | + if(strpos($groupInfo['rights'], $menu_id['id']) < 0){ | ||
| 72 | + return response(['code'=>Code::USER_LOGIN_ERROE,'msg'=>'当前用户没有权限']); | ||
| 73 | + } | ||
| 74 | + } | ||
| 75 | + } | ||
| 37 | } | 76 | } |
| @@ -9,6 +9,7 @@ use App\Services\ProjectServer; | @@ -9,6 +9,7 @@ use App\Services\ProjectServer; | ||
| 9 | use Closure; | 9 | use Closure; |
| 10 | use Illuminate\Http\Request; | 10 | use Illuminate\Http\Request; |
| 11 | use Illuminate\Support\Facades\Cache; | 11 | use Illuminate\Support\Facades\Cache; |
| 12 | +use Illuminate\Support\Facades\Route; | ||
| 12 | 13 | ||
| 13 | class LoginAuthMiddleware | 14 | class LoginAuthMiddleware |
| 14 | { | 15 | { |
| @@ -22,32 +23,66 @@ class LoginAuthMiddleware | @@ -22,32 +23,66 @@ class LoginAuthMiddleware | ||
| 22 | public function handle(Request $request, Closure $next) | 23 | public function handle(Request $request, Closure $next) |
| 23 | { | 24 | { |
| 24 | $token = $request->header('token'); | 25 | $token = $request->header('token'); |
| 25 | - if(!isset($token) || empty($token)){ | ||
| 26 | - return response(['code'=>Code::USER_LOGIN_ERROE,'msg'=>'当前用户未登录']); | ||
| 27 | - } | ||
| 28 | $info = Cache::get($token); | 26 | $info = Cache::get($token); |
| 29 | - if(empty($info)){ | 27 | + if(empty($info) || empty($token)){ |
| 30 | return response(['code'=>Code::USER_LOGIN_ERROE,'msg'=>'当前用户未登录']); | 28 | return response(['code'=>Code::USER_LOGIN_ERROE,'msg'=>'当前用户未登录']); |
| 31 | } | 29 | } |
| 30 | + $role_info = $this->setRole($info); | ||
| 31 | + //获取当前操作的路由name | ||
| 32 | + $action = Route::currentRouteName(); | ||
| 33 | + //查询当前用户是否拥有权限操作 | ||
| 34 | + $this->viewOperateAuth($role_info,$action); | ||
| 35 | + //配置数据库 | ||
| 36 | + $this->setProject($info); | ||
| 37 | + return $next($request); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + /** | ||
| 41 | + * @remark :设置数据库 | ||
| 42 | + * @name :setProject | ||
| 43 | + * @author :lyh | ||
| 44 | + * @method :post | ||
| 45 | + * @time :2023/7/28 14:52 | ||
| 46 | + */ | ||
| 47 | + public function setProject($info){ | ||
| 32 | // 设置数据信息 | 48 | // 设置数据信息 |
| 33 | $project = ProjectServer::useProject($info['project_id']); | 49 | $project = ProjectServer::useProject($info['project_id']); |
| 34 | if(empty($project)){ | 50 | if(empty($project)){ |
| 35 | return response(['code'=>Code::USER_LOGIN_ERROE,'msg'=>'数据库未配置']); | 51 | return response(['code'=>Code::USER_LOGIN_ERROE,'msg'=>'数据库未配置']); |
| 36 | } | 52 | } |
| 53 | + } | ||
| 54 | + | ||
| 55 | + /** | ||
| 56 | + * @remark :查看角色权限 | ||
| 57 | + * @name :setRole | ||
| 58 | + * @author :lyh | ||
| 59 | + * @method :post | ||
| 60 | + * @time :2023/7/28 14:53 | ||
| 61 | + */ | ||
| 62 | + public function setRole($info){ | ||
| 37 | //操作权限设置 | 63 | //操作权限设置 |
| 38 | $projectRoleModel = new ProjectRoleModel(); | 64 | $projectRoleModel = new ProjectRoleModel(); |
| 39 | $role_info = $projectRoleModel->read(['id'=>$info['role_id']]); | 65 | $role_info = $projectRoleModel->read(['id'=>$info['role_id']]); |
| 40 | - //获取当前操作的控制器与方法 | ||
| 41 | - $action = $request->route()->getAction(); | ||
| 42 | - //查询当前用户是否拥有权限操作 | 66 | + if($role_info['status'] != 0){ |
| 67 | + return response(['code'=>Code::USER_LOGIN_ERROE,'当前用户角色被禁用']); | ||
| 68 | + } | ||
| 69 | + return $role_info; | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + /** | ||
| 73 | + * @remark :查看操作权限 | ||
| 74 | + * @name :viewOperateAuth | ||
| 75 | + * @author :lyh | ||
| 76 | + * @method :post | ||
| 77 | + * @time :2023/7/28 14:56 | ||
| 78 | + */ | ||
| 79 | + public function viewOperateAuth($role_info,$action){ | ||
| 43 | $projectMenuModel = new ProjectMenu(); | 80 | $projectMenuModel = new ProjectMenu(); |
| 44 | - $menu_id = $projectMenuModel->read(['action'=>$action['as']],['id']); | 81 | + $menu_id = $projectMenuModel->read(['action'=>$action],['id']); |
| 45 | if($menu_id !== false){ | 82 | if($menu_id !== false){ |
| 46 | if(strpos($role_info['role_menu'], $menu_id['id']) < 0){ | 83 | if(strpos($role_info['role_menu'], $menu_id['id']) < 0){ |
| 47 | return response(['code'=>Code::USER_LOGIN_ERROE,'msg'=>'当前用户没有权限']); | 84 | return response(['code'=>Code::USER_LOGIN_ERROE,'msg'=>'当前用户没有权限']); |
| 48 | } | 85 | } |
| 49 | } | 86 | } |
| 50 | - return $next($request); | ||
| 51 | } | 87 | } |
| 52 | - | ||
| 53 | } | 88 | } |
| @@ -185,7 +185,7 @@ class Project extends Base | @@ -185,7 +185,7 @@ class Project extends Base | ||
| 185 | public function setNoticeFileAttribute($value) | 185 | public function setNoticeFileAttribute($value) |
| 186 | { | 186 | { |
| 187 | foreach ($value as &$v) { | 187 | foreach ($value as &$v) { |
| 188 | - $v = Upload::url2path($v); | 188 | + $v = basename($v); |
| 189 | } | 189 | } |
| 190 | $this->attributes['notice_file'] = Arr::a2s($value); | 190 | $this->attributes['notice_file'] = Arr::a2s($value); |
| 191 | } | 191 | } |
| @@ -193,9 +193,9 @@ class Project extends Base | @@ -193,9 +193,9 @@ class Project extends Base | ||
| 193 | public function getNoticeFileAttribute($value) | 193 | public function getNoticeFileAttribute($value) |
| 194 | { | 194 | { |
| 195 | $value = Arr::s2a($value); | 195 | $value = Arr::s2a($value); |
| 196 | - if(!empty($value)){ | 196 | + if(!empty($value)) { |
| 197 | foreach ($value as &$v) { | 197 | foreach ($value as &$v) { |
| 198 | - $v = Upload::path2url($v); | 198 | + $v = getImageUrl($v); |
| 199 | } | 199 | } |
| 200 | } | 200 | } |
| 201 | return $value; | 201 | return $value; |
| @@ -204,7 +204,7 @@ class Project extends Base | @@ -204,7 +204,7 @@ class Project extends Base | ||
| 204 | public function setConfirmFileAttribute($value) | 204 | public function setConfirmFileAttribute($value) |
| 205 | { | 205 | { |
| 206 | foreach ($value as &$v) { | 206 | foreach ($value as &$v) { |
| 207 | - $v = Upload::url2path($v); | 207 | + $v = basename($v); |
| 208 | } | 208 | } |
| 209 | $this->attributes['confirm_file'] = Arr::a2s($value); | 209 | $this->attributes['confirm_file'] = Arr::a2s($value); |
| 210 | } | 210 | } |
| @@ -214,7 +214,7 @@ class Project extends Base | @@ -214,7 +214,7 @@ class Project extends Base | ||
| 214 | $value = Arr::s2a($value); | 214 | $value = Arr::s2a($value); |
| 215 | if(!empty($value)) { | 215 | if(!empty($value)) { |
| 216 | foreach ($value as &$v) { | 216 | foreach ($value as &$v) { |
| 217 | - $v = Upload::path2url($v); | 217 | + $v = getImageUrl($v); |
| 218 | } | 218 | } |
| 219 | } | 219 | } |
| 220 | return $value; | 220 | return $value; |
| @@ -167,7 +167,6 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -167,7 +167,6 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 167 | Route::post('/add', [Aside\Devops\ServerInformationController::class, 'add'])->name('admin.devops.bt_add'); // 添加 | 167 | Route::post('/add', [Aside\Devops\ServerInformationController::class, 'add'])->name('admin.devops.bt_add'); // 添加 |
| 168 | Route::post('/edit', [Aside\Devops\ServerInformationController::class, 'edit'])->name('admin.devops.bt_edit'); // 修改 | 168 | Route::post('/edit', [Aside\Devops\ServerInformationController::class, 'edit'])->name('admin.devops.bt_edit'); // 修改 |
| 169 | Route::get('/delete', [Aside\Devops\ServerInformationController::class, 'delete'])->name('admin.devops.bt_delete'); // 删除 | 169 | Route::get('/delete', [Aside\Devops\ServerInformationController::class, 'delete'])->name('admin.devops.bt_delete'); // 删除 |
| 170 | - Route::get('/delete_list', [Aside\Devops\ServerInformationController::class, 'delete_list'])->name('admin.devops.bt_delete_list'); // 删除列表 | ||
| 171 | Route::get('/restore', [Aside\Devops\ServerInformationController::class, 'restore'])->name('admin.devops.bt_restore'); //恢复数据 | 170 | Route::get('/restore', [Aside\Devops\ServerInformationController::class, 'restore'])->name('admin.devops.bt_restore'); //恢复数据 |
| 172 | Route::get('/log', [Aside\Devops\ServerInformationLogController::class, 'lists'])->name('admin.devops.bt_log_lists'); //日志列表 | 171 | Route::get('/log', [Aside\Devops\ServerInformationLogController::class, 'lists'])->name('admin.devops.bt_log_lists'); //日志列表 |
| 173 | }); | 172 | }); |
| @@ -335,6 +335,8 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -335,6 +335,8 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 335 | //无需登录验证的路由组 | 335 | //无需登录验证的路由组 |
| 336 | Route::group([], function () { | 336 | Route::group([], function () { |
| 337 | Route::any('/login', [\App\Http\Controllers\Bside\ComController::class, 'login'])->name('login'); | 337 | Route::any('/login', [\App\Http\Controllers\Bside\ComController::class, 'login'])->name('login'); |
| 338 | + Route::any('/copyProduct', [\App\Http\Controllers\Bside\Product\ProductController::class, 'copyProduct'])->name('product_copyProduct'); | ||
| 339 | +// Route::any('/ceshi', [\App\Http\Controllers\Bside\ComController::class, 'ceshi'])->name('ceshi_ceshi'); | ||
| 338 | Route::any('/stringTranslation', [\App\Http\Controllers\Bside\ComController::class, 'stringTranslation'])->name('com_stringTranslation'); | 340 | Route::any('/stringTranslation', [\App\Http\Controllers\Bside\ComController::class, 'stringTranslation'])->name('com_stringTranslation'); |
| 339 | Route::any('/sendLoginSms', [\App\Http\Controllers\Bside\ComController::class, 'sendLoginSms'])->name('sendLoginSms'); | 341 | Route::any('/sendLoginSms', [\App\Http\Controllers\Bside\ComController::class, 'sendLoginSms'])->name('sendLoginSms'); |
| 340 | Route::any('/autologin', [\App\Http\Controllers\Bside\ComController::class, 'autologin'])->name('autologin'); | 342 | Route::any('/autologin', [\App\Http\Controllers\Bside\ComController::class, 'autologin'])->name('autologin'); |
-
请 注册 或 登录 后发表评论