作者 赵彬吉

Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into develop

@@ -30,14 +30,12 @@ class BaseController extends Controller @@ -30,14 +30,12 @@ class BaseController extends Controller
30 $this->request = $request; 30 $this->request = $request;
31 $this->param = $this->request->all(); 31 $this->param = $this->request->all();
32 $this->token = $this->request->header('token'); 32 $this->token = $this->request->header('token');
  33 + $this->get_param();
33 if(!empty($this->token) && !empty(Cache::get($this->token))){ 34 if(!empty($this->token) && !empty(Cache::get($this->token))){
34 $info = Cache::get($this->token); 35 $info = Cache::get($this->token);
35 $this->user = $info; 36 $this->user = $info;
36 $this->uid = $info['id']; 37 $this->uid = $info['id'];
37 - //参数处理  
38 - $this->get_param();  
39 } 38 }
40 -  
41 } 39 }
42 40
43 41
  1 +<?php
  2 +
  3 +namespace App\Http\Controllers\Aside\Project;
  4 +
  5 +use App\Http\Controllers\Aside\BaseController;
  6 +use App\Http\Logic\Aside\Project\OptimizeLogic;
  7 +
  8 +/**
  9 + * @remark :优化方案设置
  10 + * @name :OptimizeController
  11 + * @author :lyh
  12 + * @time :2023/6/20 14:33
  13 + */
  14 +class OptimizeController extends BaseController
  15 +{
  16 +
  17 + /**
  18 + * @remark :授权域名
  19 + * @name :empowerDomain
  20 + * @author :lyh
  21 + * @method :post
  22 + * @time :2023/6/20 15:10
  23 + */
  24 + public function empowerDomain(OptimizeLogic $optimizeLogic){
  25 + $this->request->validate([
  26 + 'id'=>'required',
  27 + 'gsc_id'=>'required'
  28 + ],[
  29 + 'id.required' => '审核域名ID不能为空',
  30 + 'gsc_id.required' => 'GSC账号ID不能为空'
  31 + ]);
  32 + $optimizeLogic->empowerDomain();
  33 + $this->response('success');
  34 + }
  35 +
  36 + /**
  37 + * @remark :优化设置
  38 + * @name :save
  39 + * @author :lyh
  40 + * @method :post
  41 + * @time :2023/6/20 14:33
  42 + */
  43 + public function save(){
  44 + $this->response('success');
  45 + }
  46 +}
  1 +<?php
  2 +
  3 +namespace App\Http\Controllers\Aside\Project;
  4 +
  5 +use App\Enums\Common\Code;
  6 +use App\Http\Controllers\Aside\BaseController;
  7 +use App\Http\Logic\Aside\Project\GscLogic;
  8 +use App\Http\Requests\Aside\User\GscRequest;
  9 +
  10 +/**
  11 + * @remark :优化gsc账号
  12 + * @name :ProjectGscController
  13 + * @author :lyh
  14 + * @time :2023/6/19 11:25
  15 + */
  16 +class ProjectGscController extends BaseController
  17 +{
  18 +
  19 + /**
  20 + * @remark :gsc账号列表
  21 + * @name :lists
  22 + * @author :lyh
  23 + * @method :post
  24 + * @time :2023/6/19 11:25
  25 + */
  26 + public function lists(GscLogic $gscLogic){
  27 + $lists = $gscLogic->GscLists($this->map,$this->page,$this->row,$this->order);
  28 + $this->response('success',Code::SUCCESS,$lists);
  29 + }
  30 +
  31 + /**
  32 + * @remark :根据gsc账号获取域名
  33 + * @name :lists
  34 + * @author :lyh
  35 + * @method :post
  36 + * @time :2023/6/19 10:48
  37 + */
  38 + public function domainLists(GscLogic $gscLogic){
  39 + $this->request->validate([
  40 + 'gsc_id'=>'required'
  41 + ],[
  42 + 'gsc_id.required' => 'GSC账号ID不能为空'
  43 + ]);
  44 + $lists = $gscLogic->DomainLists($this->map,$this->page,$this->row,$this->order);
  45 + $this->response('success',Code::SUCCESS,$lists);
  46 + }
  47 +
  48 + /**
  49 + * @remark :获取gsc账号详情
  50 + * @name :read
  51 + * @author :lyh
  52 + * @method :post
  53 + * @time :2023/6/19 16:55
  54 + */
  55 + public function read(GscLogic $gscLogic){
  56 + $this->request->validate([
  57 + 'id'=>'required'
  58 + ],[
  59 + 'id.required' => 'GSC账号ID不能为空'
  60 + ]);
  61 + $info = $gscLogic->GscRead();
  62 + $this->response('success',Code::SUCCESS,$info);
  63 + }
  64 +
  65 + /**
  66 + * @remark :添加/编辑gsc账号
  67 + * @name :add
  68 + * @author :lyh
  69 + * @method :post
  70 + * @time :2023/6/19 16:28
  71 + */
  72 + public function save(GscRequest $gscRequest,GscLogic $gscLogic){
  73 + if(isset($this->param['id'])){
  74 + $gscRequest->validate([
  75 + 'id'=>'required'
  76 + ],[
  77 + 'id.required' => 'GSC账号ID不能为空'
  78 + ]);
  79 + }
  80 + $gscRequest->validated();
  81 + $gscLogic->GscSave();
  82 + $this->response('success');
  83 + }
  84 +
  85 + /**
  86 + * @remark :逻辑删除gsc账号
  87 + * @name :del
  88 + * @author :lyh
  89 + * @method :post
  90 + * @time :2023/6/19 16:30
  91 + */
  92 + public function del(GscLogic $gscLogic){
  93 + $this->request->validate([
  94 + 'id'=>'required'
  95 + ],[
  96 + 'id.required' => 'GSC账号ID不能为空'
  97 + ]);
  98 + $gscLogic->GscDel();
  99 + $this->response('success');
  100 + }
  101 +
  102 +}
@@ -143,6 +143,6 @@ class ComController extends BaseController @@ -143,6 +143,6 @@ class ComController extends BaseController
143 } 143 }
144 144
145 public function ceshi(){ 145 public function ceshi(){
146 - 146 + return $this->request->route()->getAction();
147 } 147 }
148 } 148 }
@@ -20,8 +20,9 @@ class MailController extends BaseController @@ -20,8 +20,9 @@ class MailController extends BaseController
20 public function lists(){ 20 public function lists(){
21 $mailModel = new MailModel(); 21 $mailModel = new MailModel();
22 //获取当前用户下的所有站内信 22 //获取当前用户下的所有站内信
23 - $lists = $mailModel->where('user_list','like','%,'.$this->uid.',%')->orWhere('user_list', '')->select(['*'])->orderBy($this->order,'desc')  
24 - ->paginate($this->row, ['*'], 'page', $this->page); 23 + $lists = $mailModel->where('status',0)
  24 + ->where('user_list','like','%,'.$this->uid.',%')->orWhere('user_list', '')->select(['*'])->orderBy($this->order,'desc')
  25 + ->get();
25 if(!empty($lists)){ 26 if(!empty($lists)){
26 $lists = $lists->toArray(); 27 $lists = $lists->toArray();
27 } 28 }
@@ -195,8 +195,7 @@ class TemplateController extends BaseController @@ -195,8 +195,7 @@ class TemplateController extends BaseController
195 */ 195 */
196 public function chunk(){ 196 public function chunk(){
197 197
198 - $lists = TemplateChunkLogic::instance()->getList([['status','=',1]],['sort'=>'asc'],['*'],false)->toArray();  
199 - 198 + $lists = TemplateChunkLogic::instance()->getList([['status','=',1]],['sort'=>'asc'],['*'],false);
200 foreach ($lists as &$list){ 199 foreach ($lists as &$list){
201 unset($list['created_at']); 200 unset($list['created_at']);
202 unset($list['updated_at']); 201 unset($list['updated_at']);
  1 +<?php
  2 +
  3 +namespace App\Http\Logic\Aside\Project;
  4 +
  5 +use App\Http\Logic\Aside\BaseLogic;
  6 +use App\Models\Project\DomainInfo;
  7 +use App\Models\Project\Gsc;
  8 +
  9 +class GscLogic extends BaseLogic
  10 +{
  11 +
  12 + public function __construct()
  13 + {
  14 + parent::__construct();
  15 + $this->model = new Gsc();
  16 + $this->param = $this->requestAll;
  17 + }
  18 +
  19 + /**
  20 + * @remark :gsc账号列表
  21 + * @name :GscLists
  22 + * @author :lyh
  23 + * @method :post
  24 + * @time :2023/6/19 11:32
  25 + */
  26 + public function GscLists($map,$page,$row,$order = 'created_at',$files = ['*']){
  27 + $lists = $this->model->lists($map,$page,$row,$order,$files);
  28 + if(!empty($lists['list'])){
  29 + $domainInfoModel = new DomainInfo();
  30 + foreach ($lists['list'] as $k => $v){
  31 + $lists['list'][$k]['tal'] = $domainInfoModel->formatQuery(['gsc_id'=>$v['id']])->count();
  32 + $lists['list'][$k]['pub'] = $domainInfoModel->formatQuery(['gsc_id'=>$v['id'],'status'=>$domainInfoModel::STATUS_TRUE])->count();
  33 + $lists['list'][$k]['num'] = $lists['list'][$k]['tal'] - $lists['list'][$k]['pub'];
  34 + }
  35 + }
  36 + return $this->success($lists);
  37 + }
  38 +
  39 + /**
  40 + * @remark :gsc账号审核域名列表
  41 + * @name :DomainLists
  42 + * @author :lyh
  43 + * @method :post
  44 + * @time :2023/6/19 15:56
  45 + */
  46 + public function DomainLists($map,$page,$row,$order = 'created_at',$files = ['*']){
  47 + $domainInfoModel = new DomainInfo();
  48 + $lists = $domainInfoModel->lists($map,$page,$row,$order,$files);
  49 + return $this->success($lists);
  50 + }
  51 +
  52 + /**
  53 + * @remark :gsc账户详情
  54 + * @name :GscRead
  55 + * @author :lyh
  56 + * @method :post
  57 + * @time :2023/6/19 17:07
  58 + */
  59 + public function GscRead(){
  60 + $info = $this->model->read($this->param);
  61 + return $this->success($info);
  62 + }
  63 +
  64 + /**
  65 + * @remark :更新账号列表
  66 + * @name :save
  67 + * @author :lyh
  68 + * @method :post
  69 + * @time :2023/6/19 16:21
  70 + */
  71 + public function GscSave(){
  72 + if(isset($this->param['id']) && !empty($this->param['id'])){
  73 + $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
  74 + }else{
  75 + $rs = $this->model->add($this->param);
  76 + }
  77 + if($rs === false){
  78 + $this->fail('error');
  79 + }
  80 + return $this->success();
  81 + }
  82 +
  83 + /**
  84 + * @remark :删除账号列表
  85 + * @name :del
  86 + * @author :lyh
  87 + * @method :post
  88 + * @time :2023/6/19 16:31
  89 + */
  90 + public function GscDel(){
  91 + $this->param['id'] = ['in',$this->param['id']];
  92 + $rs = $this->model->del($this->param);
  93 + if($rs === false){
  94 + $this->fail('error');
  95 + }
  96 + return $this->success();
  97 + }
  98 +}
  1 +<?php
  2 +
  3 +namespace App\Http\Logic\Aside\Project;
  4 +
  5 +use App\Http\Logic\Aside\BaseLogic;
  6 +use App\Models\Project\DeployOptimize;
  7 +use App\Models\Project\DomainInfo;
  8 +
  9 +/**
  10 + * @remark :优化授权域名
  11 + * @name :OptimizeLogic
  12 + * @author :lyh
  13 + * @time :2023/6/20 15:14
  14 + */
  15 +class OptimizeLogic extends BaseLogic
  16 +{
  17 + public function __construct()
  18 + {
  19 + parent::__construct();
  20 + $this->model = new DeployOptimize();
  21 + $this->param = $this->requestAll;
  22 + }
  23 +
  24 + /**
  25 + * @remark :授权域名
  26 + * @name :empowerDomain
  27 + * @author :lyh
  28 + * @method :post
  29 + * @time :2023/6/20 15:12
  30 + */
  31 + public function empowerDomain(){
  32 + $domain = new DomainInfo();
  33 + $rs = $domain->edit($this->param,['id'=>$this->param['id']]);
  34 + if($rs === false){
  35 + $this->fail('error');
  36 + }
  37 + return $this->success();
  38 + }
  39 +}
@@ -26,8 +26,8 @@ class MailLogic extends BaseLogic @@ -26,8 +26,8 @@ class MailLogic extends BaseLogic
26 //生成一条阅读记录 26 //生成一条阅读记录
27 $mailUserModel = new MailUserModel(); 27 $mailUserModel = new MailUserModel();
28 $data = [ 28 $data = [
29 - 'user_id'=>$info['id'],  
30 - 'mail_id'=>$this->user['id'], 29 + 'user_id'=>$this->user['id'],
  30 + 'mail_id'=>$info['id'],
31 ]; 31 ];
32 //查询当前记录是否存在 32 //查询当前记录是否存在
33 $read_info = $mailUserModel->read($data); 33 $read_info = $mailUserModel->read($data);
@@ -46,6 +46,7 @@ class ProofreadingLogic extends BaseLogic @@ -46,6 +46,7 @@ class ProofreadingLogic extends BaseLogic
46 $v['project_id'] = $this->user['project_id']; 46 $v['project_id'] = $this->user['project_id'];
47 $v['language_id'] = $this->param['language_id']; 47 $v['language_id'] = $this->param['language_id'];
48 $v['type'] = $this->param['type']; 48 $v['type'] = $this->param['type'];
  49 + $v['alias'] = $this->param['alias'];
49 $this->param['data'][$k] = $v; 50 $this->param['data'][$k] = $v;
50 } 51 }
51 //新增 52 //新增
  1 +<?php
  2 +
  3 +namespace App\Http\Requests\Aside\User;
  4 +
  5 +use Illuminate\Foundation\Http\FormRequest;
  6 +
  7 +class GscRequest extends FormRequest
  8 +{
  9 + /**
  10 + * Determine if the user is authorized to make this request.
  11 + *
  12 + * @return bool
  13 + */
  14 + public function authorize()
  15 + {
  16 + return true;
  17 + }
  18 +
  19 + /**
  20 + * Get the validation rules that apply to the request.
  21 + *
  22 + * @return array
  23 + */
  24 + public function rules()
  25 + {
  26 + return [
  27 + 'account'=>'required|string|regex:/^1[3-9]\d{9}$/',
  28 + 'password'=>'required|string',
  29 + 'mobile'=>'required|string',
  30 + 'remark'=>'required|string',
  31 + ];
  32 + }
  33 +
  34 + public function messages()
  35 + {
  36 + return [
  37 + 'account.required'=>'名称必须填写',
  38 + 'account.regex'=>'请输入正确的手机号',
  39 + 'password.required'=>'密码必须填写',
  40 + 'mobile.required'=>'手机号码必须填写',
  41 + 'remark.required'=>'备注必须填写',
  42 + ];
  43 + }
  44 +}
@@ -7,7 +7,7 @@ use App\Models\Base; @@ -7,7 +7,7 @@ use App\Models\Base;
7 /** 7 /**
8 * Class DomainInfo 8 * Class DomainInfo
9 * 9 *
10 - * @package App\Models\Aside\Domain 10 + * @package App\Models\Aside\DomainLogic
11 * @Author YiYuan-LIn 11 * @Author YiYuan-LIn
12 * @Date : 2019/5/16 12 * @Date : 2019/5/16
13 * 域名信息模型 13 * 域名信息模型
@@ -5,7 +5,7 @@ namespace App\Models\Aside\Domain; @@ -5,7 +5,7 @@ namespace App\Models\Aside\Domain;
5 use Illuminate\Database\Eloquent\Model; 5 use Illuminate\Database\Eloquent\Model;
6 6
7 /** 7 /**
8 - * App\Models\Aside\Domain\DomainInfoLog 8 + * App\Models\Aside\DomainLogic\DomainInfoLog
9 * 9 *
10 * @property int $id 10 * @property int $id
11 * @property int|null $user_id 操作用户 11 * @property int|null $user_id 操作用户
@@ -9,10 +9,10 @@ class Manage extends Base @@ -9,10 +9,10 @@ class Manage extends Base
9 //设置关联表名 9 //设置关联表名
10 protected $table = 'gl_manage'; 10 protected $table = 'gl_manage';
11 11
12 - protected $hidden = ['password', 'token']; 12 + protected $hidden = ['password'];
13 13
14 - const STATUS_ACTIVE = 1;  
15 - const STATUS_DISABLE = 0; 14 + const STATUS_ACTIVE = 0;
  15 + const STATUS_DISABLE = 1;
16 16
17 /** 17 /**
18 * 超级管理员ID, 当前ID拥有所有权限, 不能进行修改 18 * 超级管理员ID, 当前ID拥有所有权限, 不能进行修改
@@ -21,8 +21,8 @@ class Manage extends Base @@ -21,8 +21,8 @@ class Manage extends Base
21 21
22 public function statusMap(){ 22 public function statusMap(){
23 return [ 23 return [
24 - self::STATUS_ACTIVE => '正常',  
25 - self::STATUS_DISABLE => '禁用', 24 + self::STATUS_ACTIVE => '禁用',
  25 + self::STATUS_DISABLE => '正常',
26 ]; 26 ];
27 } 27 }
28 } 28 }
@@ -9,6 +9,8 @@ use Illuminate\Support\Facades\Cache; @@ -9,6 +9,8 @@ use Illuminate\Support\Facades\Cache;
9 9
10 class DomainInfo extends Base 10 class DomainInfo extends Base
11 { 11 {
  12 + const STATUS_TRUE = 1;//审核成功状态
  13 +
12 //设置关联表名 14 //设置关联表名
13 protected $table = 'gl_project_domain_info'; 15 protected $table = 'gl_project_domain_info';
14 16
  1 +<?php
  2 +
  3 +namespace App\Models\Project;
  4 +
  5 +use App\Models\Base;
  6 +
  7 +/**
  8 + * @remark :项目优化审核gsc
  9 + * @name :Gsc
  10 + * @author :lyh
  11 + * @time :2023/6/19 11:30
  12 + */
  13 +class Gsc extends Base
  14 +{
  15 + protected $table = 'gl_project_deploy_gsc';
  16 +}
@@ -146,7 +146,7 @@ return [ @@ -146,7 +146,7 @@ return [
146 146
147 /* 147 /*
148 |-------------------------------------------------------------------------- 148 |--------------------------------------------------------------------------
149 - | Session Cookie Domain 149 + | Session Cookie DomainLogic
150 |-------------------------------------------------------------------------- 150 |--------------------------------------------------------------------------
151 | 151 |
152 | Here you may change the domain of the cookie used to identify a session 152 | Here you may change the domain of the cookie used to identify a session
@@ -95,6 +95,20 @@ Route::middleware(['aloginauth'])->group(function () { @@ -95,6 +95,20 @@ Route::middleware(['aloginauth'])->group(function () {
95 }); 95 });
96 }); 96 });
97 97
  98 + //优化gsc账号记录表
  99 + Route::prefix('gsc')->group(function () {
  100 + Route::any('/', [Aside\Project\ProjectGscController::class, 'lists'])->name('admin.lists');
  101 + Route::any('/domainLists', [Aside\Project\ProjectGscController::class, 'domainLists'])->name('admin.domainLists');
  102 + Route::any('/read', [Aside\Project\ProjectGscController::class, 'read'])->name('admin.read');
  103 + Route::any('/save', [Aside\Project\ProjectGscController::class, 'save'])->name('admin.save');
  104 + Route::any('/del', [Aside\Project\ProjectGscController::class, 'del'])->name('admin.del');
  105 + });
  106 +
  107 + //优化gsc账号记录表
  108 + Route::prefix('optimize')->group(function () {
  109 + Route::any('/empowerDomain', [Aside\Project\OptimizeController::class, 'empowerDomain'])->name('admin.empowerDomain');
  110 + });
  111 +
98 //项目管理 112 //项目管理
99 Route::prefix('project')->group(function () { 113 Route::prefix('project')->group(function () {
100 Route::get('/', [Aside\Project\ProjectController::class, 'list'])->name('admin.project'); 114 Route::get('/', [Aside\Project\ProjectController::class, 'list'])->name('admin.project');
@@ -318,7 +318,7 @@ Route::middleware(['bloginauth'])->group(function () { @@ -318,7 +318,7 @@ Route::middleware(['bloginauth'])->group(function () {
318 //无需登录验证的路由组 318 //无需登录验证的路由组
319 Route::group([], function () { 319 Route::group([], function () {
320 Route::any('/login', [\App\Http\Controllers\Bside\ComController::class, 'login'])->name('login'); 320 Route::any('/login', [\App\Http\Controllers\Bside\ComController::class, 'login'])->name('login');
321 - Route::any('/ceshi', [\App\Http\Controllers\Bside\ComController::class, 'ceshi'])->name('ceshi'); 321 + Route::any('/ceshi', [\App\Http\Controllers\Bside\ComController::class, 'ceshi'])->name('com_ceshi');
322 Route::any('/sendLoginSms', [\App\Http\Controllers\Bside\ComController::class, 'sendLoginSms'])->name('sendLoginSms'); 322 Route::any('/sendLoginSms', [\App\Http\Controllers\Bside\ComController::class, 'sendLoginSms'])->name('sendLoginSms');
323 Route::get('/file/download', [\App\Http\Controllers\Bside\FileController::class, 'download'])->name('file_download'); 323 Route::get('/file/download', [\App\Http\Controllers\Bside\FileController::class, 'download'])->name('file_download');
324 Route::any('/image/{hash}/{w?}/{h?}', [\App\Http\Controllers\File\ImageController::class, 'index'])->name('image_show'); 324 Route::any('/image/{hash}/{w?}/{h?}', [\App\Http\Controllers\File\ImageController::class, 'index'])->name('image_show');