作者 赵彬吉

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

正在显示 56 个修改的文件 包含 1296 行增加606 行删除
@@ -243,7 +243,7 @@ class SyncProject extends Command @@ -243,7 +243,7 @@ class SyncProject extends Command
243 $param['channel'] = Arr::a2s($param['channel']); 243 $param['channel'] = Arr::a2s($param['channel']);
244 } 244 }
245 $projectModel = new Project(); 245 $projectModel = new Project();
246 - $info = $projectModel->read(['from_order_id'=>$param['from_order_id']]); 246 + $info = $projectModel->read(['from_order_id'=>$param['from_order_id'],'delete_status'=>0]);
247 if($info !== false){ 247 if($info !== false){
248 $projectModel->edit($param, ['id' => $info['id']]); 248 $projectModel->edit($param, ['id' => $info['id']]);
249 return $info['id']; 249 return $info['id'];
@@ -39,7 +39,7 @@ class BaseController extends Controller @@ -39,7 +39,7 @@ class BaseController extends Controller
39 $info = Cache::get(Common::MANAGE_TOKEN . $this->token); 39 $info = Cache::get(Common::MANAGE_TOKEN . $this->token);
40 if(!empty($this->token) && !empty($info)){ 40 if(!empty($this->token) && !empty($info)){
41 $this->manage = $info; 41 $this->manage = $info;
42 - Cache::put($this->token, $info, 3600);//更新缓存时间 42 + Cache::put($this->token, $info, 3600 * 6);//更新缓存时间
43 $this->uid = $info['id']; 43 $this->uid = $info['id'];
44 } 44 }
45 } 45 }
@@ -3,8 +3,12 @@ @@ -3,8 +3,12 @@
3 namespace App\Http\Controllers\Aside\Com; 3 namespace App\Http\Controllers\Aside\Com;
4 4
5 use App\Enums\Common\Code; 5 use App\Enums\Common\Code;
  6 +use App\Enums\Common\Common;
6 use App\Http\Controllers\Aside\BaseController; 7 use App\Http\Controllers\Aside\BaseController;
7 use App\Http\Logic\Aside\Manage\MenuLogic; 8 use App\Http\Logic\Aside\Manage\MenuLogic;
  9 +use App\Models\Manage\Manage;
  10 +use Illuminate\Support\Facades\Cache;
  11 +use Illuminate\Support\Facades\Hash;
8 12
9 /** 13 /**
10 * Class IndexController 14 * Class IndexController
@@ -33,4 +37,38 @@ class IndexController extends BaseController @@ -33,4 +37,38 @@ class IndexController extends BaseController
33 $this->response('success',Code::SUCCESS,$menus); 37 $this->response('success',Code::SUCCESS,$menus);
34 } 38 }
35 39
  40 + /**
  41 + * @remark :修改密码
  42 + * @name :editPassword
  43 + * @author :lyh
  44 + * @method :post
  45 + * @time :2023/9/11 9:10
  46 + */
  47 + public function editPassword(){
  48 + $this->request->validate([
  49 + 'oldPassword'=>'required',
  50 + 'password' => 'required',
  51 + 'confirm'=>'required',
  52 + ], [
  53 + 'oldPassword.required' => '请输入原密码',
  54 + 'password.required' => '请输入新密码',
  55 + 'confirm.required' => '请再次输入新密码',
  56 + ]);
  57 + //查询员密码是否正确
  58 + $managerModel = new Manage();
  59 + $info = $managerModel->read(['id'=>$this->manage['id']]);
  60 + if(!Hash::check($this->param['password'], $info['password'])){
  61 + $this->response('原密码错误',Code::USER_REGISTER_ERROE);
  62 + }
  63 + if($this->param['password'] != $this->param['confirm']){
  64 + $this->response('两次密码不一致');
  65 + }
  66 + $rs = $managerModel->edit(['password'=>Hash::make($this->param['password'])],['id'=>$this->manage['id']]);
  67 + if($rs === false){
  68 + $this->response('系统错误',Code::SYSTEM_ERROR);
  69 + }
  70 + Cache::pull(Common::MANAGE_TOKEN . $info['token']);
  71 + $this->response('success');
  72 + }
  73 +
36 } 74 }
@@ -31,15 +31,6 @@ class DomainInfoController extends BaseController @@ -31,15 +31,6 @@ class DomainInfoController extends BaseController
31 $this->map['domain'] = ['like','%'.$this->map['domain'],'%']; 31 $this->map['domain'] = ['like','%'.$this->map['domain'],'%'];
32 } 32 }
33 $lists = $domainModel->lists($this->map,$this->page,$this->row,$this->order); 33 $lists = $domainModel->lists($this->map,$this->page,$this->row,$this->order);
34 - $projectModel = new Project();  
35 - if(!empty($lists)){  
36 - foreach ($lists['list'] as $k => $v){  
37 - if(!empty($info['project_id'])){  
38 - $v['company'] = $projectModel->read(['id'=>$info['project_id']],['title'])['title'];  
39 - }  
40 - $lists['list'][$k] = $v;  
41 - }  
42 - }  
43 return $this->response('success', Code::SUCCESS, $lists); 34 return $this->response('success', Code::SUCCESS, $lists);
44 } 35 }
45 36
@@ -41,6 +41,13 @@ class LoginController extends BaseController @@ -41,6 +41,13 @@ class LoginController extends BaseController
41 $this->response('success',Code::SUCCESS,$data); 41 $this->response('success',Code::SUCCESS,$data);
42 } 42 }
43 43
  44 + /**
  45 + * @remark :退出登录
  46 + * @name :logout
  47 + * @author :lyh
  48 + * @method :post
  49 + * @time :2023/9/7 16:29
  50 + */
44 public function logout(LoginLogic $logic) 51 public function logout(LoginLogic $logic)
45 { 52 {
46 $logic->logout(); 53 $logic->logout();
@@ -3,6 +3,8 @@ @@ -3,6 +3,8 @@
3 namespace App\Http\Controllers\Aside\Manage; 3 namespace App\Http\Controllers\Aside\Manage;
4 use App\Enums\Common\Code; 4 use App\Enums\Common\Code;
5 use App\Http\Controllers\Aside\BaseController; 5 use App\Http\Controllers\Aside\BaseController;
  6 +use App\Models\Manage\ManageHr;
  7 +use App\Models\Manage\Menu;
6 use Illuminate\Http\Request; 8 use Illuminate\Http\Request;
7 use App\Http\Logic\Aside\Manage\HrLogic; 9 use App\Http\Logic\Aside\Manage\HrLogic;
8 10
@@ -29,8 +31,15 @@ class HrController extends BaseController @@ -29,8 +31,15 @@ class HrController extends BaseController
29 return $this->response('success', Code::SUCCESS, $lists); 31 return $this->response('success', Code::SUCCESS, $lists);
30 } 32 }
31 33
32 - public function info(Request $request, HrLogic $logic){  
33 - $request->validate([ 34 + /**
  35 + * @remark :获取详情
  36 + * @name :info
  37 + * @author :lyh
  38 + * @method :post
  39 + * @time :2023/9/6 10:04
  40 + */
  41 + public function info(HrLogic $logic){
  42 + $this->request->validate([
34 'id'=>'required' 43 'id'=>'required'
35 ],[ 44 ],[
36 'id.required' => 'ID不能为空' 45 'id.required' => 'ID不能为空'
@@ -42,6 +51,13 @@ class HrController extends BaseController @@ -42,6 +51,13 @@ class HrController extends BaseController
42 $this->response('success',Code::SUCCESS,$info); 51 $this->response('success',Code::SUCCESS,$info);
43 } 52 }
44 53
  54 + /**
  55 + * @remark :保存数据
  56 + * @name :save
  57 + * @author :lyh
  58 + * @method :post
  59 + * @time :2023/9/6 10:05
  60 + */
45 public function save(HrLogic $logic){ 61 public function save(HrLogic $logic){
46 $logic->hrSave(); 62 $logic->hrSave();
47 return $this->response('success'); 63 return $this->response('success');
@@ -12,6 +12,7 @@ namespace App\Http\Controllers\Aside\Manage; @@ -12,6 +12,7 @@ namespace App\Http\Controllers\Aside\Manage;
12 use App\Enums\Common\Code; 12 use App\Enums\Common\Code;
13 use App\Http\Controllers\Aside\BaseController; 13 use App\Http\Controllers\Aside\BaseController;
14 use App\Http\Logic\Aside\Manage\MenuSpecialLogic; 14 use App\Http\Logic\Aside\Manage\MenuSpecialLogic;
  15 +use App\Models\Manage\MenuSpecial;
15 16
16 /** 17 /**
17 * @remark :特殊模块设置 18 * @remark :特殊模块设置
@@ -29,8 +30,11 @@ class MenuSpecialController extends BaseController @@ -29,8 +30,11 @@ class MenuSpecialController extends BaseController
29 * @method :post 30 * @method :post
30 * @time :2023/8/7 11:52 31 * @time :2023/8/7 11:52
31 */ 32 */
32 - public function lists(MenuSpecialLogic $logic){  
33 - $lists = $logic->specialLists($this->map,$this->page,$this->row,$this->order); 33 + public function lists(MenuSpecial $menuSpecial){
  34 + if(isset($this->map['remark']) && !empty($this->map['remark'])){
  35 + $this->map['remark'] = ['like','%'.$this->map['remark'].'%'];
  36 + }
  37 + $lists = $menuSpecial->lists($this->map,$this->page,$this->row,$this->order);
34 $this->response('success',Code::SUCCESS,$lists); 38 $this->response('success',Code::SUCCESS,$lists);
35 } 39 }
36 40
@@ -73,11 +77,11 @@ class MenuSpecialController extends BaseController @@ -73,11 +77,11 @@ class MenuSpecialController extends BaseController
73 public function save(MenuSpecialLogic $logic){ 77 public function save(MenuSpecialLogic $logic){
74 $this->request->validate([ 78 $this->request->validate([
75 'name'=>'required', 79 'name'=>'required',
76 - 'user_list'=>'required', 80 +// 'user_list'=>'required',
77 'remark'=>'required' 81 'remark'=>'required'
78 ],[ 82 ],[
79 'name.required' => 'name不能为空', 83 'name.required' => 'name不能为空',
80 - 'user_list.required' => 'user_list不能为空', 84 +// 'user_list.required' => 'user_list不能为空',
81 'remark.required' => 'remark不能为空' 85 'remark.required' => 'remark不能为空'
82 ]); 86 ]);
83 $logic->specialSave(); 87 $logic->specialSave();
@@ -11,6 +11,7 @@ namespace App\Http\Controllers\Aside\Project; @@ -11,6 +11,7 @@ namespace App\Http\Controllers\Aside\Project;
11 11
12 use App\Enums\Common\Code; 12 use App\Enums\Common\Code;
13 use App\Http\Controllers\Aside\BaseController; 13 use App\Http\Controllers\Aside\BaseController;
  14 +use App\Http\Logic\Aside\Project\KeywordPrefixLogic;
14 use App\Models\Project\KeywordPrefix; 15 use App\Models\Project\KeywordPrefix;
15 16
16 class KeywordPrefixController extends BaseController 17 class KeywordPrefixController extends BaseController
@@ -27,4 +28,23 @@ class KeywordPrefixController extends BaseController @@ -27,4 +28,23 @@ class KeywordPrefixController extends BaseController
27 $list = $keywordPrefixModel->list($this->map); 28 $list = $keywordPrefixModel->list($this->map);
28 $this->response('success',Code::SUCCESS,$list); 29 $this->response('success',Code::SUCCESS,$list);
29 } 30 }
  31 +
  32 + /**
  33 + * @remark :保存关键字
  34 + * @name :save
  35 + * @author :lyh
  36 + * @method :post
  37 + * @time :2023/9/6 14:47
  38 + */
  39 + public function save(KeywordPrefixLogic $keywordPrefixLogic){
  40 + $this->request->validate([
  41 + 'keyword'=>'required',
  42 + 'type'=>'required'
  43 + ],[
  44 + 'keyword.required' => 'keyword不能为空',
  45 + 'type.required' => 'type不能为空',
  46 + ]);
  47 + $keywordPrefixLogic->prefixSave();
  48 + $this->response('success');
  49 + }
30 } 50 }
@@ -47,70 +47,40 @@ class ProjectController extends BaseController @@ -47,70 +47,40 @@ class ProjectController extends BaseController
47 * @time :2023/8/30 10:11 47 * @time :2023/8/30 10:11
48 */ 48 */
49 public function lists(Project $project){ 49 public function lists(Project $project){
50 - $map = [];  
51 - //搜索参数处理  
52 - $map = $this->searchParam($map,$this->map);  
53 - //类型  
54 - if(isset($this->map['type'])){  
55 - $map['type'] = $this->searchType($this->map['type']);  
56 - $map['extend_type'] = 0;//排除未续费项目  
57 - }  
58 - $filed = ['id', 'title', 'mysql_id' ,'channel','cooperate_date' ,'type', 'remain_day' ,'created_at'];  
59 - $lists = $project->formatQuery($map)->orderBy('id','desc')->select($filed)->with('payment')->with('deploy_build')  
60 - ->with('deploy_optimize')->with('online_check')->paginate($this->row, ['*'], 'page', $this->page);  
61 - if(!empty($lists)){  
62 - $lists = $lists->toArray();  
63 - $manageModel = new Manage();  
64 - $domainModel = new DomainInfo();  
65 - foreach ($lists['list'] as $k=>$item){  
66 - $item = $this->handleParam($item,$manageModel,$domainModel);  
67 - $lists['list'][$k] = $item; 50 + $query = $project->leftJoin('gl_project_payment', 'gl_project.id', '=', 'gl_project_payment.project_id')
  51 + ->leftJoin('gl_project_deploy_build', 'gl_project.id', '=', 'gl_project_deploy_build.project_id')
  52 + ->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id')
  53 + ->leftJoin('gl_project_online_check', 'gl_project.id', '=', 'gl_project_online_check.project_id');
  54 + $query = $this->searchParam($query);
  55 + $lists = $query->paginate($this->row, $this->selectParam(), 'page', $this->page)->toArray();
  56 + if(!empty($lists) && !empty($lists['list'])){
  57 + foreach ($lists['list'] as $k => $v){
  58 + $v = $this->handleParam($v);
  59 + $lists['list'][$k] = $v;
68 } 60 }
69 } 61 }
70 $this->response('success',Code::SUCCESS,$lists); 62 $this->response('success',Code::SUCCESS,$lists);
71 } 63 }
72 64
73 /** 65 /**
74 - * @remark :返回参数过滤  
75 - * @name :returnParamItem 66 + * @remark :搜索参数处理
  67 + * @name :searchParam
76 * @author :lyh 68 * @author :lyh
77 * @method :post 69 * @method :post
78 - * @time :2023/8/30 11:07 70 + * @time :2023/8/18 10:58
79 */ 71 */
80 - public function handleParam(&$item,&$manageModel,&$domainModel){  
81 - if($item['mysql_id'] != 0 && $item['type'] != 0){  
82 - $data = APublicModel::getNumByProjectId($item['id']);  
83 - }  
84 - $item = [  
85 - 'id' => $item['id'],  
86 - 'title' => $item['title'],  
87 - 'channel' => Channel::getChannelText($item['channel']['user_id'] ?? 0),  
88 - 'key' => $item['deploy_build']['keyword_num'] ?? 0,  
89 - 'day' => $item['deploy_build']['service_duration'] ?? 0,  
90 - 'amount' => $item['payment']['amount'] ?? 0,  
91 - 'build_leader' => $manageModel->getName($item['deploy_build']['leader_mid']), //组长  
92 - 'build_manager' => $manageModel->getName($item['deploy_build']['manager_mid']), //项目经理  
93 - 'build_designer' => $manageModel->getName($item['deploy_build']['designer_mid']), //设计师  
94 - 'build_tech' => $manageModel->getName($item['deploy_build']['tech_mid']), //技术助理  
95 - 'optimize_manager' => $manageModel->getName($item['deploy_optimize']['manager_mid']), //优化服务经理  
96 - 'optimize_optimist' => $manageModel->getName($item['deploy_optimize']['optimist_mid']), //优化师  
97 - 'optimize_assist' => $manageModel->getName($item['deploy_optimize']['assist_mid']), //优化助理  
98 - 'optimize_tech' => $manageModel->getName($item['deploy_optimize']['tech_mid']), //售后技术  
99 - 'type' => $item['type'],  
100 - 'test_domain' => $item['deploy_build']['test_domain'] ?? 0,  
101 - 'plan' =>Project::planMap()[$item['deploy_build']['plan']],  
102 - 'domain' => !empty($item['deploy_optimize']['domain']) ? $domainModel->getDomain($item['deploy_optimize']['domain']) : '',  
103 - 'created_at' => date('Y年m月d日', strtotime($item['created_at'])),  
104 - 'product_num' => $data['product'] ?? 0,  
105 - 'keyword_num' => $item['deploy_build']['keyword_num'] ?? 0,  
106 - 'article_num' => ($data['blog'] ?? 0) + ($data['news'] ?? 0),  
107 - 'task_finish_num' => Task::getNumByProjectId($item['id'], Task::STATUS_DOWN),  
108 - 'task_pending_num' => Task::getNumByProjectId($item['id'], [Task::STATUS_DONGING, Task::STATUS_WAIT]),  
109 - 'optimist_status'=>$item['online_check']['optimist_status'] ?? 0,  
110 - 'qa_status'=>$item['online_check']['qa_status'] ?? 0,  
111 - 'service_day'=>$item['remain_day'] ?? 0,  
112 - ];  
113 - return $item; 72 + public function searchParam(&$query){
  73 + //参数type
  74 + $query = $this->searchType($query);
  75 + //根据查看权限获取项目搜索条件(必带)
  76 + $query = $this->getManagerRole($query);
  77 + //搜索技术组
  78 + $query = $this->searchDept($query);
  79 + //搜索技术人员
  80 + $query = $this->searchManager($query);
  81 + //按类型搜索
  82 + $query = $this->searchContent($query);
  83 + return $query;
114 } 84 }
115 85
116 /** 86 /**
@@ -120,53 +90,195 @@ class ProjectController extends BaseController @@ -120,53 +90,195 @@ class ProjectController extends BaseController
120 * @method :post 90 * @method :post
121 * @time :2023/8/30 10:14 91 * @time :2023/8/30 10:14
122 */ 92 */
123 - public function searchType($type){  
124 - //初始项目  
125 - if($type == Project::TYPE_ZERO){  
126 - $type = Project::TYPE_ZERO; 93 + public function searchType(&$query){
  94 + $query->where('gl_project.delete_status',Project::TYPE_ZERO);
  95 + if(!isset($this->map['type'])){
  96 + $this->map['type'] = Project::TYPE_ZERO;
127 } 97 }
128 - //建站中  
129 - if($type == Project::TYPE_ONE){  
130 - $type = Project::TYPE_ONE; 98 + if($this->map['type'] == Project::TYPE_ZERO){
  99 + $query->where('gl_project.type',Project::TYPE_ZERO);
  100 + }elseif ($this->map['type'] == Project::TYPE_ONE){
  101 + $query->where('gl_project.type',Project::TYPE_ONE);
  102 + }elseif ($this->map['type'] == Project::TYPE_TWO){
  103 + $query->whereIn('gl_project.type', [Project::TYPE_TWO,Project::TYPE_THREE]);
  104 + }else{
  105 + $query->whereIn('gl_project.type', [Project::TYPE_FOUR,Project::TYPE_SIX]);
131 } 106 }
132 - //建站完成  
133 - if($type == Project::TYPE_TWO){  
134 - $type = ['in',[Project::TYPE_TWO,Project::TYPE_THREE]]; 107 + return $query;
  108 + }
  109 +
  110 + /**
  111 + * @remark :查询字段处理
  112 + * @name :selectParam
  113 + * @author :lyh
  114 + * @method :post
  115 + * @time :2023/8/18 10:59
  116 + */
  117 + public function selectParam(){
  118 + $select = [
  119 + 'gl_project.id AS id',
  120 + 'gl_project.title AS title',
  121 + 'gl_project.channel AS channel',
  122 + 'gl_project.company AS company',
  123 + 'gl_project.type AS type',
  124 + 'gl_project.created_at AS created_at',
  125 + 'gl_project_online_check.id AS online_check_id',
  126 + 'gl_project_online_check.question AS question',
  127 + 'gl_project_online_check.optimist_status AS optimist_status',
  128 + 'gl_project_online_check.qa_status AS qa_status',
  129 + 'gl_project_payment.amount AS amount',
  130 + 'gl_project_deploy_build.dept_id AS dept_id',
  131 + 'gl_project_deploy_build.keyword_num AS key',
  132 + 'gl_project_deploy_build.service_duration AS day',
  133 + 'gl_project_deploy_build.leader_mid AS leader_mid',
  134 + 'gl_project_deploy_build.manager_mid AS manager_mid',
  135 + 'gl_project_deploy_build.designer_mid AS designer_mid',
  136 + 'gl_project_deploy_build.tech_mid AS tech_mid',
  137 + 'gl_project_deploy_build.test_domain AS test_domain',
  138 + 'gl_project_deploy_build.plan AS plan',
  139 + 'gl_project_deploy_optimize.dept_id AS optimize_dept_id',
  140 + 'gl_project_deploy_optimize.manager_mid AS optimize_manager_mid',
  141 + 'gl_project_deploy_optimize.optimist_mid AS optimize_optimist_mid',
  142 + 'gl_project_deploy_optimize.assist_mid AS optimize_assist_mid',
  143 + 'gl_project_deploy_optimize.tech_mid AS optimize_tech_mid',
  144 + 'gl_project_deploy_optimize.design_mid AS design_mid',
  145 + 'gl_project_deploy_optimize.tech_leader AS tech_leader',
  146 + 'gl_project_deploy_optimize.domain AS domain',
  147 + 'gl_project_deploy_optimize.quality_mid AS quality_mid',
  148 + 'gl_project_deploy_optimize.design_mid AS design_mid',
  149 + 'gl_project_payment.amount AS amount',
  150 + ];
  151 + return $select;
  152 + }
  153 +
  154 + /**
  155 + * @remark :按需搜索
  156 + * @name :searchDomainTitle
  157 + * @author :lyh
  158 + * @method :post
  159 + * @time :2023/9/7 18:39
  160 + */
  161 + public function searchContent(&$query){
  162 + if(!empty($this->map['search']) && !empty($this->map['search_type'])){
  163 + //搜索域名
  164 + $query->where(function ($subQuery) {
  165 + $subQuery->orwhere('gl_project_deploy_optimize.domain','like','%'.$this->map['search'].'%')
  166 + ->orwhere('gl_project.company','like','%'.$this->map['search'].'%')
  167 + ->orwhere('gl_project.title','like','%'.$this->map['search'].'%');
  168 + });
135 } 169 }
136 - if($this->param['type'] == Project::TYPE_THREE){  
137 - $type = ['in',[Project::TYPE_FOUR,Project::TYPE_SIX]]; 170 + return $query;
  171 + }
  172 +
  173 + /**
  174 + * @remark :搜索技术组
  175 + * @name :searchDept
  176 + * @author :lyh
  177 + * @method :post
  178 + * @time :2023/9/7 18:40
  179 + */
  180 + public function searchDept(&$query){
  181 + if(!empty($this->map['dept_id'])){
  182 + $query->where(function ($subQuery) {
  183 + $subQuery->orwhere('gl_project_deploy_build.dept_id',$this->map['dept_id'])
  184 + ->orwhere('gl_project_deploy_optimize.dept_id',$this->map['dept_id']);
  185 + });
138 } 186 }
139 - return $type; 187 + return $query;
140 } 188 }
141 189
142 /** 190 /**
143 - * @remark :搜索参数处理  
144 - * @name :searchParam 191 + * @remark :访问权限
  192 + * @name :getManagerRole
145 * @author :lyh 193 * @author :lyh
146 * @method :post 194 * @method :post
147 - * @time :2023/8/30 10:30 195 + * @time :2023/9/7 17:28
148 */ 196 */
149 - public function searchParam(&$map,$param){  
150 - //搜索技术组  
151 - if(!empty($param['dep_id'])){  
152 - $map['id'] = ['in', DeployBuild::where('dept_id', $param['dep_id'])->pluck('project_id')->toArray()]; 197 + public function getManagerRole(&$query){
  198 + if($this->manage['role'] != 1){//1代表查看所有
  199 + //获取用户所在组
  200 + $managerHr = new ManageHr();
  201 + $info = $managerHr->read(['manage_id'=>$this->manage['id']]);
  202 + //获取当前用户自己的项目
  203 + $query->where(function ($subQuery) use ($info) {
  204 + $subQuery->where('gl_project_deploy_build.leader_mid', $this->manage['id'])
  205 + ->orWhere('gl_project_deploy_build.manager_mid', $this->manage['id'])
  206 + ->orWhere('gl_project_deploy_build.designer_mid', $this->manage['id'])
  207 + ->orWhere('gl_project_deploy_build.tech_mid', $this->manage['id'])
  208 + ->orWhere('gl_project_deploy_optimize.manager_mid', $this->manage['id'])
  209 + ->orWhere('gl_project_deploy_optimize.optimist_mid', $this->manage['id'])
  210 + ->orWhere('gl_project_deploy_optimize.assist_mid', $this->manage['id'])
  211 + ->orWhere('gl_project_deploy_optimize.tech_mid', $this->manage['id'])
  212 + ->orWhere('gl_project_deploy_optimize.tech_leader', $this->manage['id'])
  213 + ->orWhere('gl_project_deploy_optimize.quality_mid', $this->manage['id'])
  214 + ->orWhere('gl_project_deploy_optimize.design_mid', $this->manage['id'])
  215 + ->orWhere('gl_project_deploy_build.dept_id', $info['belong_group'])
  216 + ->orWhere('gl_project_deploy_optimize.dept_id', $info['belong_group']);
  217 + });
153 } 218 }
154 - //搜索技术人员  
155 - if(!empty($param['manage_id'])){  
156 - $map['id'] = ['in', DeployBuild::where('leader_mid', $param['manage_id'])  
157 - ->orwhere('manager_mid', $param['manage_id'])->orwhere('designer_mid', $param['manage_id'])  
158 - ->orwhere('tech_mid', $param['manage_id'])->pluck('project_id')->toArray()]; 219 + return $query;
  220 + }
  221 +
  222 + /**
  223 + * @remark :搜索技术人员
  224 + * @name :searchManager
  225 + * @author :lyh
  226 + * @method :post
  227 + * @time :2023/9/7 17:16
  228 + */
  229 + public function searchManager(&$query)
  230 + {
  231 + if (!empty($this->map['manage_id'])) {
  232 + $query->where(function ($subQuery) {
  233 + $subQuery->orWhere('gl_project_deploy_build.leader_mid', $this->map['manage_id'])
  234 + ->orWhere('gl_project_deploy_build.manager_mid', $this->map['manage_id'])
  235 + ->orWhere('gl_project_deploy_build.designer_mid', $this->map['manage_id'])
  236 + ->orWhere('gl_project_deploy_build.tech_mid', $this->map['manage_id'])
  237 + ->orWhere('gl_project_deploy_optimize.manager_mid', $this->map['manage_id'])
  238 + ->orWhere('gl_project_deploy_optimize.optimist_mid', $this->map['manage_id'])
  239 + ->orWhere('gl_project_deploy_optimize.assist_mid', $this->map['manage_id'])
  240 + ->orWhere('gl_project_deploy_optimize.tech_mid', $this->map['manage_id'])
  241 + ->orWhere('gl_project_deploy_optimize.tech_leader', $this->map['manage_id'])
  242 + ->orWhere('gl_project_deploy_optimize.quality_mid', $this->map['manage_id'])
  243 + ->orWhere('gl_project_deploy_optimize.design_mid', $this->map['manage_id']);
  244 + });
159 } 245 }
160 - //按类型搜索  
161 - if(!empty($param['search']) && !empty($param['search_type'])){  
162 - if($this->param['search_type'] == 'domain'){  
163 - //搜索域名  
164 - $map['id'] = ['id', 'in', DeployOptimize::where('domain', 'like', "%{$this->param['search']}%")->pluck('project_id')->toArray()];  
165 - }else{  
166 - $map[$param['search_type']] = ['like', "%{$param['search']}%"];  
167 - } 246 + return $query;
  247 + }
  248 +
  249 + /**
  250 + * @remark :参数处理
  251 + * @name :handleParam
  252 + * @author :lyh
  253 + * @method :post
  254 + * @time :2023/8/18 14:44
  255 + */
  256 + public function handleParam(&$item){
  257 + if($item['type'] != Project::TYPE_ZERO){
  258 + $data = APublicModel::getNumByProjectId($item['id']);
168 } 259 }
169 - return $map; 260 + $manageModel = new Manage();
  261 + $item['channel'] = Channel::getChannelText($item['channel']['user_id'] ?? 0);
  262 + $item['build_leader'] = $manageModel->getName($item['leader_mid']);
  263 + $item['build_manager'] = $manageModel->getName($item['manager_mid']);
  264 + $item['build_designer'] = $manageModel->getName($item['designer_mid']);
  265 + $item['build_tech'] = $manageModel->getName($item['tech_mid']);
  266 + $item['optimize_manager'] = $manageModel->getName($item['optimize_manager_mid']);
  267 + $item['optimize_optimist'] = $manageModel->getName($item['optimize_optimist_mid']);
  268 + $item['optimize_assist'] = $manageModel->getName($item['optimize_assist_mid']);
  269 + $item['optimize_tech'] = $manageModel->getName($item['optimize_tech_mid']);
  270 + $item['plan'] = Project::planMap()[$item['plan']];
  271 + $item['created_at'] = date('Y年m月d日', strtotime($item['created_at']));
  272 + $item['autologin_code'] = getAutoLoginCode($item['id']);
  273 + $domainModel = new DomainInfo();
  274 + $item['domain'] = !empty($item['domain']) ? $domainModel->getDomain($item['domain']) : '';
  275 + $item['product_num'] = $data['product'] ?? 0;
  276 + $item['keyword_num'] = $item['key'] ?? 0;
  277 + $item['autologin_code'] = getAutoLoginCode($item['id']);
  278 + $item['article_num'] = ($data['blog'] ?? 0) + ($data['news'] ?? 0);
  279 + $item['task_finish_num'] = Task::getNumByProjectId($item['id'], Task::STATUS_DOWN);
  280 + $item['task_pending_num'] = Task::getNumByProjectId($item['id'], [Task::STATUS_DONGING, Task::STATUS_WAIT]);
  281 + return $item;
170 } 282 }
171 283
172 /** 284 /**
@@ -393,7 +505,7 @@ class ProjectController extends BaseController @@ -393,7 +505,7 @@ class ProjectController extends BaseController
393 */ 505 */
394 public function getServiceConfig(){ 506 public function getServiceConfig(){
395 $serviceConfigModel = new ServerConfig(); 507 $serviceConfigModel = new ServerConfig();
396 - $list = $serviceConfigModel->list($this->param); 508 + $list = $serviceConfigModel->list($this->param,'id',['id','type','title']);
397 $this->response('success',Code::SUCCESS,$list); 509 $this->response('success',Code::SUCCESS,$list);
398 } 510 }
399 511
@@ -435,6 +547,23 @@ class ProjectController extends BaseController @@ -435,6 +547,23 @@ class ProjectController extends BaseController
435 } 547 }
436 548
437 /** 549 /**
  550 + * @remark :逻辑删除项目
  551 + * @name :del
  552 + * @author :lyh
  553 + * @method :post
  554 + * @time :2023/9/8 15:21
  555 + */
  556 + public function del(ProjectLogic $logic){
  557 + $this->request->validate([
  558 + 'id'=>'required',
  559 + ],[
  560 + 'id.required' => 'id不能为空',
  561 + ]);
  562 + $logic->projectDel();
  563 + $this->response('success');
  564 + }
  565 +
  566 + /**
438 * 根据渠道商查询项目 567 * 根据渠道商查询项目
439 * @author zbj 568 * @author zbj
440 * @date 2023/9/11 569 * @date 2023/9/11
@@ -35,12 +35,8 @@ class RenewProjectController extends BaseController @@ -35,12 +35,8 @@ class RenewProjectController extends BaseController
35 * @time :2023/8/11 10:22 35 * @time :2023/8/11 10:22
36 */ 36 */
37 public function lists(Project $project){ 37 public function lists(Project $project){
38 - $arr = $this->getLessThanFifteenProjectId();  
39 - $map = [];  
40 - $this->searchParam($map,$this->map,$arr);  
41 - //按类型搜索  
42 - $map['id'] = ['in', $arr];  
43 - $filed = ['id', 'title', 'mysql_id' ,'channel','cooperate_date' ,'type', 'remain_day' ,'created_at']; 38 + $map = $this->searchParam($this->map);
  39 + $filed = ['id', 'title', 'type' ,'mysql_id' ,'channel','cooperate_date' ,'type', 'remain_day' ,'created_at','delete_status'];
44 $lists = $project->formatQuery($map)->select($filed)->with('payment')->with('deploy_build') 40 $lists = $project->formatQuery($map)->select($filed)->with('payment')->with('deploy_build')
45 ->with('deploy_optimize')->with('online_check')->paginate($this->row, ['*'], 'page', $this->page); 41 ->with('deploy_optimize')->with('online_check')->paginate($this->row, ['*'], 'page', $this->page);
46 if(!empty($lists)){ 42 if(!empty($lists)){
@@ -55,25 +51,6 @@ class RenewProjectController extends BaseController @@ -55,25 +51,6 @@ class RenewProjectController extends BaseController
55 $this->response('success',Code::SUCCESS,$lists); 51 $this->response('success',Code::SUCCESS,$lists);
56 } 52 }
57 53
58 - /**  
59 - * @remark :获取小于15天的项目id  
60 - * @name :getlessThanFifteenProjectId  
61 - * @author :lyh  
62 - * @method :post  
63 - * @time :2023/8/30 11:49  
64 - */  
65 - public function getLessThanFifteenProjectId(){  
66 - $count = new Count();  
67 - $yesterday = Carbon::yesterday()->toDateString();  
68 - $count_list = $count->list(['date'=>$yesterday,'service_day'=>['<=',15]],'id',['project_id']);  
69 - $arr = [];  
70 - if(!empty($count_list)){  
71 - foreach ($count_list as $v){  
72 - $arr[] = $v['project_id'];  
73 - }  
74 - }  
75 - return $arr;  
76 - }  
77 54
78 /** 55 /**
79 * @remark :搜索参数处理 56 * @remark :搜索参数处理
@@ -82,16 +59,16 @@ class RenewProjectController extends BaseController @@ -82,16 +59,16 @@ class RenewProjectController extends BaseController
82 * @method :post 59 * @method :post
83 * @time :2023/8/30 10:30 60 * @time :2023/8/30 10:30
84 */ 61 */
85 - public function searchParam(&$map,$param,&$arr){ 62 + public function searchParam($param){
  63 + $map = [];
86 //按类型搜索 64 //按类型搜索
87 if(!empty($param['search']) && !empty($param['search_type'])){ 65 if(!empty($param['search']) && !empty($param['search_type'])){
88 - if($this->param['search_type'] == 'domain'){  
89 - //搜索域名  
90 - $map['id'] = ['id', 'in', DeployOptimize::where('domain', 'like', "%{$param['search']}%")->where('id','in',$arr)->pluck('project_id')->toArray()];  
91 - }else{  
92 - $map[$this->param['search_type']] = ['like', "%{$this->param['search']}%"];  
93 - } 66 + $map[$this->param['search_type']] = ['like', "%{$this->param['search']}%"];
94 } 67 }
  68 + //按类型搜索
  69 + $map['delete_status'] = 0;
  70 + $map['type'] = ['in',[2,3,4]];
  71 + $map['remain_day'] = ['<=',15];
95 return $map; 72 return $map;
96 } 73 }
97 74
@@ -253,6 +253,8 @@ class TaskController extends BaseController @@ -253,6 +253,8 @@ class TaskController extends BaseController
253 $manage_ids = $taskOwnerModel->formatQuery(['task_id'=>['in',$ids],'manage_id'=>$this->manage['id']])->pluck('manage_id')->toArray(); 253 $manage_ids = $taskOwnerModel->formatQuery(['task_id'=>['in',$ids],'manage_id'=>$this->manage['id']])->pluck('manage_id')->toArray();
254 $map['manage_id'] = ['in',$manage_ids]; 254 $map['manage_id'] = ['in',$manage_ids];
255 } 255 }
  256 + }else{
  257 + $map['manage_id'] = $this->manage['id'];
256 } 258 }
257 }else{ 259 }else{
258 $map['manage_id'] = $this->manage['id']; 260 $map['manage_id'] = $this->manage['id'];
@@ -36,13 +36,6 @@ class ATemplateModuleController extends BaseController @@ -36,13 +36,6 @@ class ATemplateModuleController extends BaseController
36 * @time :2023/6/28 16:55 36 * @time :2023/6/28 16:55
37 */ 37 */
38 public function save(ATemplateModuleRequest $ATemplateModuleRequest,ATemplateModuleLogic $ATemplateModuleLogic){ 38 public function save(ATemplateModuleRequest $ATemplateModuleRequest,ATemplateModuleLogic $ATemplateModuleLogic){
39 - if(isset($this->param['id'])){  
40 - $this->request->validate([  
41 - 'id'=>'required'  
42 - ],[  
43 - 'id.required' => 'ID不能为空'  
44 - ]);  
45 - }  
46 $ATemplateModuleRequest->validated(); 39 $ATemplateModuleRequest->validated();
47 $ATemplateModuleLogic->aTemplateModuleSave(); 40 $ATemplateModuleLogic->aTemplateModuleSave();
48 $this->response('success'); 41 $this->response('success');
@@ -3,9 +3,11 @@ @@ -3,9 +3,11 @@
3 namespace App\Http\Controllers\Bside\BCom; 3 namespace App\Http\Controllers\Bside\BCom;
4 4
5 use App\Enums\Common\Code; 5 use App\Enums\Common\Code;
  6 +use App\Helper\Arr;
6 use App\Helper\Common; 7 use App\Helper\Common;
7 use App\Http\Controllers\Bside\BaseController; 8 use App\Http\Controllers\Bside\BaseController;
8 use App\Http\Logic\Bside\User\UserLogic; 9 use App\Http\Logic\Bside\User\UserLogic;
  10 +use App\Models\Project\DeployBuild;
9 use App\Models\Project\Project; 11 use App\Models\Project\Project;
10 use App\Models\User\ProjectMenu as ProjectMenuModel; 12 use App\Models\User\ProjectMenu as ProjectMenuModel;
11 use App\Models\User\ProjectRole as ProjectRoleModel; 13 use App\Models\User\ProjectRole as ProjectRoleModel;
@@ -26,18 +28,9 @@ class ComController extends BaseController @@ -26,18 +28,9 @@ class ComController extends BaseController
26 //根据当前登录用户角色返回用户菜单列表 28 //根据当前登录用户角色返回用户菜单列表
27 $projectMenuModel = new ProjectMenuModel(); 29 $projectMenuModel = new ProjectMenuModel();
28 if($this->user['role_id'] != 0){ 30 if($this->user['role_id'] != 0){
29 - $projectRoleModel = new ProjectRoleModel();  
30 - $info = $projectRoleModel->read(['id'=>$this->user['role_id']]);  
31 - $info['role_menu'] = trim($info['role_menu'],',');  
32 - $this->map = [  
33 - 'status'=>0,  
34 - 'is_role'=>0,  
35 - 'id'=>['in',explode(',',$info['role_menu'])]  
36 - ]; 31 + $this->map = $this->getNoAdminMenuCondition();
37 }else{ 32 }else{
38 - $this->map = [  
39 - 'status'=>0,  
40 - ]; 33 + $this->map = $this->getAdminMenuCondition();
41 } 34 }
42 $lists = $projectMenuModel->list($this->map,'sort'); 35 $lists = $projectMenuModel->list($this->map,'sort');
43 $menu = array(); 36 $menu = array();
@@ -51,6 +44,7 @@ class ComController extends BaseController @@ -51,6 +44,7 @@ class ComController extends BaseController
51 $this->response('当前用户菜单列表',Code::SUCCESS,$menu); 44 $this->response('当前用户菜单列表',Code::SUCCESS,$menu);
52 } 45 }
53 46
  47 +
54 /** 48 /**
55 * @name :获取当前项目详情 49 * @name :获取当前项目详情
56 * @author :liyuhang 50 * @author :liyuhang
@@ -65,6 +59,67 @@ class ComController extends BaseController @@ -65,6 +59,67 @@ class ComController extends BaseController
65 } 59 }
66 60
67 /** 61 /**
  62 + * @remark :非超级管理员菜单列表
  63 + * @name :getRoleMenuLis
  64 + * @author :lyh
  65 + * @method :post
  66 + * @time :2023/9/6 11:47
  67 + */
  68 + public function getNoAdminMenuCondition(){
  69 + $code = $this->getIsHome();
  70 + $projectRoleModel = new ProjectRoleModel();
  71 + $info = $projectRoleModel->read(['id'=>$this->user['role_id']]);
  72 + if($code != 1){
  73 + $info['role_menu'] = trim(str_replace(',11,',',',','.$info['role_menu'].','),',');
  74 + }
  75 + $this->map = [
  76 + 'status'=>0,
  77 + 'is_role'=>0,
  78 + 'id'=>['in',explode(',',$info['role_menu'])]
  79 + ];
  80 + return $this->map;
  81 + }
  82 +
  83 + /**
  84 + * @remark :超级管理员菜单列表
  85 + * @name :getAdminMenuCondition
  86 + * @author :lyh
  87 + * @method :post
  88 + * @time :2023/9/6 13:53
  89 + */
  90 + public function getAdminMenuCondition(){
  91 + $this->map['status'] = 0;
  92 + $code = $this->getIsHome();
  93 + if($code != 1){
  94 + $this->map['id'] = ['!=',11];//排除菜单网站装修
  95 + }
  96 + return $this->map;
  97 + }
  98 +
  99 +
  100 + /**
  101 + * @remark :查看是否显示网站装饰
  102 + * @name :getIsHome
  103 + * @author :lyh
  104 + * @method :post
  105 + * @time :2023/9/6 11:30
  106 + */
  107 + public function getIsHome(){
  108 + if(isset($this->user['manager_id'])){
  109 + return 1;
  110 + }
  111 + $deployBuild = new DeployBuild();
  112 + $info = $deployBuild->read(['project_id'=>$this->user['project_id']]);
  113 + if(!empty($info['configuration'])){
  114 + $configuration = Arr::s2a($info['configuration']);
  115 + if(isset($configuration['is_home']) && ((int)$configuration['is_home'] != 0)){
  116 + return 1;
  117 + }
  118 + }
  119 + return 0;
  120 + }
  121 +
  122 + /**
68 * @name :登录用户编辑资料/修改密码 123 * @name :登录用户编辑资料/修改密码
69 * @author :liyuhang 124 * @author :liyuhang
70 * @method 125 * @method
@@ -30,7 +30,7 @@ class BaseController extends Controller @@ -30,7 +30,7 @@ class BaseController extends Controller
30 protected $uid = 0; 30 protected $uid = 0;
31 protected $user = [];//当前登录用户详情 31 protected $user = [];//当前登录用户详情
32 /** 32 /**
33 - * 获取所有参数 33 + * ceshi获取所有参数
34 */ 34 */
35 public function __construct(Request $request) 35 public function __construct(Request $request)
36 { 36 {
@@ -58,36 +58,23 @@ class BlogCategoryController extends BaseController @@ -58,36 +58,23 @@ class BlogCategoryController extends BaseController
58 'id.required' => 'ID不能为空' 58 'id.required' => 'ID不能为空'
59 ]); 59 ]);
60 $info = $blogCategoryLogic->info_blog_category(); 60 $info = $blogCategoryLogic->info_blog_category();
61 - $info['alias'] = RouteMap::getRoute(RouteMap::SOURCE_BLOG_CATE, $info['id'], $this->user['project_id']);  
62 - $info['url'] = $this->user['domain'] . RouteMap::PATH_BLOG_CATE . '/' . $info['alias']; 61 + $info['url'] = $this->user['domain'] . $info['alias'];
63 $this->response('success',Code::SUCCESS,$info); 62 $this->response('success',Code::SUCCESS,$info);
64 } 63 }
  64 +
65 /** 65 /**
66 - * @name :添加分类  
67 - * @author :liyuhang  
68 - * @method 66 + * @remark :保存数据
  67 + * @name :save
  68 + * @author :lyh
  69 + * @method :post
  70 + * @time :2023/9/7 14:04
69 */ 71 */
70 - public function add(BlogCategoryRequest $request,BlogCategoryLogic $blogCategoryLogic){ 72 + public function save(BlogCategoryRequest $request,BlogCategoryLogic $blogCategoryLogic){
71 $request->validated(); 73 $request->validated();
72 - //添加时,验证分类上级分类是否有,有则更新到当前分类中,没有时直接添加  
73 - $blogCategoryLogic->add_blog_category(); 74 + $blogCategoryLogic->categorySave();
74 $this->response('success'); 75 $this->response('success');
75 } 76 }
76 77
77 - /**  
78 - * @name :编辑分类  
79 - * @author :liyuhang  
80 - * @method  
81 - */  
82 - public function edit(BlogCategoryRequest $request,BlogCategoryLogic $blogCategoryLogic){  
83 - $request->validate([  
84 - 'id'=>['required']  
85 - ],[  
86 - 'id.required' => 'ID不能为空'  
87 - ]);  
88 - $blogCategoryLogic->edit_blog_category();  
89 - $this->response('success');  
90 - }  
91 78
92 /** 79 /**
93 * @name :编辑状态/与排序 80 * @name :编辑状态/与排序
@@ -116,7 +103,7 @@ class BlogCategoryController extends BaseController @@ -116,7 +103,7 @@ class BlogCategoryController extends BaseController
116 'id.required' => 'ID不能为空', 103 'id.required' => 'ID不能为空',
117 'id.array' => 'ID为数组', 104 'id.array' => 'ID为数组',
118 ]); 105 ]);
119 - $blogCategoryLogic->del_blog_category(); 106 + $blogCategoryLogic->delBlogCategory();
120 //TODO::写入操作日志 107 //TODO::写入操作日志
121 $this->response('success'); 108 $this->response('success');
122 } 109 }
@@ -80,30 +80,16 @@ class BlogController extends BaseController @@ -80,30 +80,16 @@ class BlogController extends BaseController
80 $this->response('success',Code::SUCCESS,$info); 80 $this->response('success',Code::SUCCESS,$info);
81 } 81 }
82 82
83 -  
84 /** 83 /**
85 - * @name :添加博客  
86 - * @author :liyuhang  
87 - * @method 84 + * @remark :保存数据
  85 + * @name :save
  86 + * @author :lyh
  87 + * @method :post
  88 + * @time :2023/9/7 13:40
88 */ 89 */
89 - public function add(BlogRequest $request,BlogLogic $blogLogic){ 90 + public function save(BlogRequest $request,BlogLogic $blogLogic){
90 $request->validated(); 91 $request->validated();
91 - $blogLogic->blogAdd();  
92 - $this->response('success');  
93 - }  
94 -  
95 - /**  
96 - * @name :编辑博客  
97 - * @author :liyuhang  
98 - * @method  
99 - */  
100 - public function edit(BlogRequest $request,BlogLogic $blogLogic){  
101 - $request->validate([  
102 - 'id'=>['required']  
103 - ],[  
104 - 'id.required' => 'ID不能为空'  
105 - ]);  
106 - $blogLogic->blogEdit(); 92 + $blogLogic->blogSave();
107 $this->response('success'); 93 $this->response('success');
108 } 94 }
109 95
@@ -140,7 +126,7 @@ class BlogController extends BaseController @@ -140,7 +126,7 @@ class BlogController extends BaseController
140 'id.required' => 'ID不能为空', 126 'id.required' => 'ID不能为空',
141 'id.array' => 'ID为数组', 127 'id.array' => 'ID为数组',
142 ]); 128 ]);
143 - $blogLogic->blog_status(); 129 + $blogLogic->blogStatus();
144 //TODO::写入日志 130 //TODO::写入日志
145 $this->response('success'); 131 $this->response('success');
146 } 132 }
@@ -157,7 +143,7 @@ class BlogController extends BaseController @@ -157,7 +143,7 @@ class BlogController extends BaseController
157 'id.required' => 'ID不能为空', 143 'id.required' => 'ID不能为空',
158 'id.array' => 'ID为数组', 144 'id.array' => 'ID为数组',
159 ]); 145 ]);
160 - $blogLogic->blog_del(); 146 + $blogLogic->blogDel();
161 $this->response('success'); 147 $this->response('success');
162 } 148 }
163 149
@@ -297,4 +297,8 @@ class LoginController extends BaseController @@ -297,4 +297,8 @@ class LoginController extends BaseController
297 return $data; 297 return $data;
298 } 298 }
299 299
  300 + public function ceshi(){
  301 + return base64_encode(md5('globalsov6'));
  302 + }
  303 +
300 } 304 }
@@ -82,28 +82,14 @@ class NavController extends BaseController @@ -82,28 +82,14 @@ class NavController extends BaseController
82 */ 82 */
83 public function urls(){ 83 public function urls(){
84 // todo::需要配合 c端来 84 // todo::需要配合 c端来
85 - return $this->success([  
86 - [  
87 - 'url' => 'index',  
88 - 'name' => '首页'  
89 - ],  
90 - [  
91 - 'url' => 'news',  
92 - 'name' => '新闻'  
93 - ],  
94 - [  
95 - 'url' => 'products',  
96 - 'name' => '产品'  
97 - ],  
98 - [  
99 - 'url' => 'search',  
100 - 'name' => '搜索页'  
101 - ],  
102 - [  
103 - 'url' => 'blog',  
104 - 'name' => '博客'  
105 - ]  
106 - ]); 85 + $data = [
  86 + ['url'=>'index', 'name'=>'首页'],
  87 + ['url'=>'news', 'name'=>'新闻'],
  88 + ['url'=>'products', 'name'=>'产品'],
  89 + ['url'=>'search', 'name'=>'搜索页'],
  90 + ['url'=>'blog', 'name'=>'博客']
  91 + ];
  92 + $this->response('success',Code::SUCCESS,$data);
107 } 93 }
108 94
109 /** 95 /**
@@ -58,34 +58,20 @@ class NewsCategoryController extends BaseController @@ -58,34 +58,20 @@ class NewsCategoryController extends BaseController
58 'id.required' => 'ID不能为空' 58 'id.required' => 'ID不能为空'
59 ]); 59 ]);
60 $info = $newsCategoryLogic->info_news_category(); 60 $info = $newsCategoryLogic->info_news_category();
61 - $info['alias'] = RouteMap::getRoute(RouteMap::SOURCE_NEWS_CATE, $info['id'], $this->user['project_id']);  
62 - $info['url'] = $this->user['domain'] . RouteMap::PATH_NEWS_CATE . '/' . $info['alias']; 61 + $info['url'] = $this->user['domain'] . $info['alias'];
63 $this->response('success',Code::SUCCESS,$info); 62 $this->response('success',Code::SUCCESS,$info);
64 } 63 }
65 - /**  
66 - * @name :添加分类  
67 - * @author :liyuhang  
68 - * @method  
69 - */  
70 - public function add(NewsCategoryRequest $request,NewsCategoryLogic $newsCategoryLogic){  
71 - $request->validated();  
72 - //添加时,验证分类上级分类是否有,有则更新到当前分类中,没有时直接添加  
73 - $newsCategoryLogic->add_news_category();  
74 - $this->response('success');  
75 - }  
76 64
77 /** 65 /**
78 - * @name :编辑分类  
79 - * @author :liyuhang  
80 - * @method 66 + * @remark :保存数据
  67 + * @name :save
  68 + * @author :lyh
  69 + * @method :post
  70 + * @time :2023/9/7 14:51
81 */ 71 */
82 - public function edit(NewsCategoryRequest $request,NewsCategoryLogic $newsCategoryLogic){  
83 - $request->validate([  
84 - 'id'=>['required']  
85 - ],[  
86 - 'id.required' => 'ID不能为空'  
87 - ]);  
88 - $newsCategoryLogic->edit_news_category(); 72 + public function save(NewsCategoryRequest $request,NewsCategoryLogic $newsCategoryLogic){
  73 + $request->validated();
  74 + $newsCategoryLogic->newsCategorySave();
89 $this->response('success'); 75 $this->response('success');
90 } 76 }
91 77
@@ -78,38 +78,25 @@ class NewsController extends BaseController @@ -78,38 +78,25 @@ class NewsController extends BaseController
78 ],[ 78 ],[
79 'id.required' => 'ID不能为空', 79 'id.required' => 'ID不能为空',
80 ]); 80 ]);
81 - $info = $newsLogic->news_info();  
82 - $info['route'] = RouteMap::getRoute(RouteMap::SOURCE_NEWS, $info['id'], $this->user['project_id']); 81 + $info = $newsLogic->newsInfo();
83 $info['url'] = $this->user['domain'] . $info['route']; 82 $info['url'] = $this->user['domain'] . $info['route'];
84 $info['image_link'] = getImageUrl($info['image']); 83 $info['image_link'] = getImageUrl($info['image']);
85 $this->response('success',Code::SUCCESS,$info); 84 $this->response('success',Code::SUCCESS,$info);
86 } 85 }
  86 +
87 /** 87 /**
88 - * @name :添加新闻  
89 - * @return json  
90 - * @author :liyuhang  
91 - * @method 88 + * @remark :保存数据
  89 + * @name :save
  90 + * @author :lyh
  91 + * @method :post
  92 + * @time :2023/9/7 11:22
92 */ 93 */
93 - public function add(NewsRequest $newsRequest,NewsLogic $newsLogic){ 94 + public function save(NewsRequest $newsRequest,NewsLogic $newsLogic){
94 $newsRequest->validated(); 95 $newsRequest->validated();
95 - $newsLogic->news_add(); 96 + $newsLogic->newsSave();
96 $this->response('success'); 97 $this->response('success');
97 } 98 }
98 99
99 - /**  
100 - * @name :编辑  
101 - * @author :liyuhang  
102 - * @method  
103 - */  
104 - public function edit(NewsRequest $newsRequest,NewsLogic $newsLogic){  
105 - $newsRequest->validate([  
106 - 'id'=>['required'],  
107 - ],[  
108 - 'id.required' => 'ID不能为空',  
109 - ]);  
110 - $newsLogic->news_edit();  
111 - $this->response('success');  
112 - }  
113 100
114 /** 101 /**
115 * @name :编辑新闻seo 102 * @name :编辑新闻seo
@@ -160,8 +147,7 @@ class NewsController extends BaseController @@ -160,8 +147,7 @@ class NewsController extends BaseController
160 'id.required' => 'ID不能为空', 147 'id.required' => 'ID不能为空',
161 'id.array' => 'ID为数组', 148 'id.array' => 'ID为数组',
162 ]); 149 ]);
163 - $newsLogic->news_del();  
164 - //TODO::清空相关资源/写入日志 150 + $newsLogic->newsDel();
165 $this->response('success'); 151 $this->response('success');
166 } 152 }
167 153
@@ -126,7 +126,6 @@ class CategoryController extends BaseController @@ -126,7 +126,6 @@ class CategoryController extends BaseController
126 ],[ 126 ],[
127 'ids.required' => 'ID不能为空' 127 'ids.required' => 'ID不能为空'
128 ]); 128 ]);
129 -  
130 $data = $logic->categoryDelete(); 129 $data = $logic->categoryDelete();
131 return $this->success($data); 130 return $this->success($data);
132 } 131 }
@@ -118,8 +118,8 @@ class ProductController extends BaseController @@ -118,8 +118,8 @@ class ProductController extends BaseController
118 public function save(ProductRequest $request, ProductLogic $logic) 118 public function save(ProductRequest $request, ProductLogic $logic)
119 { 119 {
120 $request->validated(); 120 $request->validated();
121 - $data = $logic->productSave();  
122 - return $this->success($data); 121 + $logic->productSave();
  122 + $this->response('success');
123 } 123 }
124 124
125 /** 125 /**
@@ -40,12 +40,16 @@ class WebSettingController extends BaseController @@ -40,12 +40,16 @@ class WebSettingController extends BaseController
40 * @param Request $request 40 * @param Request $request
41 * @param WebSettingLogic $webSettingLogic 41 * @param WebSettingLogic $webSettingLogic
42 */ 42 */
43 - public function sendNotify(Request $request, WebSettingLogic $webSettingLogic){  
44 - $type = $request->input('type', UpdateNotify::TYPE_MASTER);  
45 - if (FALSE == in_array($type, [UpdateNotify::TYPE_MASTER, UpdateNotify::TYPE_MINOR])) 43 + public function sendNotify(WebSettingLogic $webSettingLogic){
  44 + $type = $this->request->input('type', UpdateNotify::TYPE_MASTER);
  45 + if (FALSE == in_array($type, [UpdateNotify::TYPE_MASTER, UpdateNotify::TYPE_MINOR])){
46 $this->response('非法参数!', Code::USER_ERROR); 46 $this->response('非法参数!', Code::USER_ERROR);
47 -  
48 - $list = $webSettingLogic->sendNotifyMessage($type); 47 + }
  48 + $page = $this->request->input('page', UpdateNotify::PAGE_ALL);
  49 + if (FALSE == in_array($type, [UpdateNotify::PAGE_ALL, UpdateNotify::PAGE_SINGLE])){
  50 + $this->response('非法参数!', Code::USER_ERROR);
  51 + }
  52 + $list = $webSettingLogic->sendNotifyMessage($type,$page);
49 if(!empty($list)){ 53 if(!empty($list)){
50 $this->response('当前页面正在生成了,请完成后再点击',Code::USER_ERROR,$list); 54 $this->response('当前页面正在生成了,请完成后再点击',Code::USER_ERROR,$list);
51 } 55 }
@@ -71,6 +71,10 @@ class BTemplateController extends BaseController @@ -71,6 +71,10 @@ class BTemplateController extends BaseController
71 * @time :2023/6/29 10:02 71 * @time :2023/6/29 10:02
72 */ 72 */
73 public function save(TemplateRequest $templateRequest,BTemplateLogic $BTemplateLogic){ 73 public function save(TemplateRequest $templateRequest,BTemplateLogic $BTemplateLogic){
  74 + //演示项目,不允许其他号码编辑
  75 + if(($this->user['project_id'] == 1) && ($this->user['mobile'] != '15928018676') && ($this->param['source'] == 1)){
  76 + $this->response('演示项目仅支持演示功能,无法更改首页',Code::USER_ERROR);
  77 + }
74 $templateRequest->validated(); 78 $templateRequest->validated();
75 $BTemplateLogic->templateSave(); 79 $BTemplateLogic->templateSave();
76 $this->response('success'); 80 $this->response('success');
@@ -222,7 +222,7 @@ class FileController @@ -222,7 +222,7 @@ class FileController
222 */ 222 */
223 public function downLoad(){ 223 public function downLoad(){
224 $file_model = new File(); 224 $file_model = new File();
225 - $info = $file_model->read(['path' => $this->param['path']]); 225 + $info = $file_model->read(['path' => str_replace_url($this->param['path'])]);
226 if ($info === false) { 226 if ($info === false) {
227 $this->response('指定文件不存在!', Code::USER_ERROR); 227 $this->response('指定文件不存在!', Code::USER_ERROR);
228 } 228 }
@@ -314,11 +314,11 @@ class FileController @@ -314,11 +314,11 @@ class FileController
314 */ 314 */
315 public function getDownloadUrl(){ 315 public function getDownloadUrl(){
316 $fileModel = new File(); 316 $fileModel = new File();
317 - $info = $fileModel->read(['path' => $this->param['path']]); 317 + $info = $fileModel->read(['path' => str_replace_url($this->param['path'])]);
318 if ($info === false) { 318 if ($info === false) {
319 $this->response('指定文件不存在!', Code::USER_ERROR); 319 $this->response('指定文件不存在!', Code::USER_ERROR);
320 } 320 }
321 - $data = ['file_download'=>url('a/downLoad/files?path='.$this->param['path'])]; 321 + $data = ['file_download'=>url('a/download_files?path='.$info['path'])];
322 $this->response('success',Code::SUCCESS,$data); 322 $this->response('success',Code::SUCCESS,$data);
323 } 323 }
324 } 324 }
@@ -16,7 +16,7 @@ use Intervention\Image\Facades\Image; @@ -16,7 +16,7 @@ use Intervention\Image\Facades\Image;
16 16
17 class ImageController extends Controller 17 class ImageController extends Controller
18 { 18 {
19 - public $path = '/upload';//路径 19 + public $path = '';//路径
20 20
21 public $config = '';//存储默认配置 21 public $config = '';//存储默认配置
22 22
@@ -105,14 +105,20 @@ class ImageController extends Controller @@ -105,14 +105,20 @@ class ImageController extends Controller
105 if ($info === false) { 105 if ($info === false) {
106 $this->response('指定图片不存在!', Code::USER_ERROR); 106 $this->response('指定图片不存在!', Code::USER_ERROR);
107 } 107 }
108 - //查看缩略图是否存在  
109 - $filename = $this->config['root'] . '/' .$info['path'] . '_' . $w . '_' . $h;  
110 - if(is_file($filename)){ 108 + if($info['is_cos'] == 1){
  109 + $filename = getImageUrl($info['path']);
111 $content = file_get_contents($filename); 110 $content = file_get_contents($filename);
112 $header['Content-Length'] = strlen($content); 111 $header['Content-Length'] = strlen($content);
113 }else{ 112 }else{
114 - $content = $this->readImageContent($info,$w,$h);  
115 - $header['Content-Length'] = strlen($content); 113 + //查看缩略图是否存在
  114 + $filename = $this->config['root'] . $info['path'] . '_' . $w . '_' . $h;
  115 + if(is_file($filename)){
  116 + $content = file_get_contents($filename);
  117 + $header['Content-Length'] = strlen($content);
  118 + }else{
  119 + $content = $this->readImageContent($info,$w,$h);
  120 + $header['Content-Length'] = strlen($content);
  121 + }
116 } 122 }
117 $header['Content-Type'] = $info['mime']; 123 $header['Content-Type'] = $info['mime'];
118 return response($content,200,$header); 124 return response($content,200,$header);
@@ -127,15 +133,11 @@ class ImageController extends Controller @@ -127,15 +133,11 @@ class ImageController extends Controller
127 */ 133 */
128 public function readImageContent($info,$w,$h) 134 public function readImageContent($info,$w,$h)
129 { 135 {
130 - $path = $this->config['root'] . '/' . $info['path'];  
131 - if (!is_file($path)) {  
132 - $this->response('指定图片已被系统删除!', Code::USER_ERROR);  
133 - }  
134 if ($w > 0 && $h > 0) { 136 if ($w > 0 && $h > 0) {
135 $path = $this->cacheImage($info, $w, $h); 137 $path = $this->cacheImage($info, $w, $h);
136 $content = file_get_contents($path); 138 $content = file_get_contents($path);
137 } else { 139 } else {
138 - $content = file_get_contents($path); 140 + $content = file_get_contents($this->config['root'] . $info['path']);
139 } 141 }
140 return $content; 142 return $content;
141 } 143 }
@@ -291,7 +293,8 @@ class ImageController extends Controller @@ -291,7 +293,8 @@ class ImageController extends Controller
291 */ 293 */
292 public function download(){ 294 public function download(){
293 $imageModel = new ImageModel(); 295 $imageModel = new ImageModel();
294 - $info = $imageModel->read(['path' => $this->param['path']]); 296 + ;
  297 + $info = $imageModel->read(['path' => str_replace_url($this->param['path'])]);
295 if ($info === false) { 298 if ($info === false) {
296 $this->response('指定文件不存在!', Code::USER_ERROR); 299 $this->response('指定文件不存在!', Code::USER_ERROR);
297 } 300 }
@@ -404,11 +407,11 @@ class ImageController extends Controller @@ -404,11 +407,11 @@ class ImageController extends Controller
404 */ 407 */
405 public function getDownloadUrl(){ 408 public function getDownloadUrl(){
406 $imageModel = new ImageModel(); 409 $imageModel = new ImageModel();
407 - $info = $imageModel->read(['path' => $this->param['path']]); 410 + $info = $imageModel->read(['path' => str_replace_url($this->param['path'])]);
408 if ($info === false) { 411 if ($info === false) {
409 $this->response('指定文件不存在!', Code::USER_ERROR); 412 $this->response('指定文件不存在!', Code::USER_ERROR);
410 } 413 }
411 - $data = ['image_download'=>url('a/downLoad/images?path='.$this->param['path'])]; 414 + $data = ['image_download'=>url('a/download_images?path='.$info['path'])];
412 $this->response('success',Code::SUCCESS,$data); 415 $this->response('success',Code::SUCCESS,$data);
413 } 416 }
414 } 417 }
@@ -29,10 +29,16 @@ class LoginLogic extends BaseLogic @@ -29,10 +29,16 @@ class LoginLogic extends BaseLogic
29 $this->model = new Manage(); 29 $this->model = new Manage();
30 } 30 }
31 31
32 - 32 + /**
  33 + * @remark :登录
  34 + * @name :login
  35 + * @author :lyh
  36 + * @method :post
  37 + * @time :2023/9/8 17:05
  38 + */
33 public function login() 39 public function login()
34 { 40 {
35 - $manage = $this->model->select('id', 'name', 'password', 'token', 'status', 'gid', 'dept_id') 41 + $manage = $this->model->select('id', 'name', 'password', 'token', 'status', 'gid', 'dept_id','role')
36 ->where('mobile', $this->param['mobile'])->first(); 42 ->where('mobile', $this->param['mobile'])->first();
37 if (!$manage){ 43 if (!$manage){
38 $this->fail('登录用户名不存在'); 44 $this->fail('登录用户名不存在');
@@ -40,6 +46,10 @@ class LoginLogic extends BaseLogic @@ -40,6 +46,10 @@ class LoginLogic extends BaseLogic
40 if (Manage::STATUS_DISABLE == $manage->status) { 46 if (Manage::STATUS_DISABLE == $manage->status) {
41 $this->fail('帐号已被禁用'); 47 $this->fail('帐号已被禁用');
42 } 48 }
  49 + //查看当前账号下有几个项目
  50 + if($this->param['password'] == '123456' && $this->param['mobile'] != '15680871314'){
  51 + $this->fail('请使用短信登录,修改初始密码');
  52 + }
43 $type = 1;//账号密码登录 53 $type = 1;//账号密码登录
44 if (!Hash::check($this->param['password'], $manage->password)) { 54 if (!Hash::check($this->param['password'], $manage->password)) {
45 //验证验证码 55 //验证验证码
@@ -67,11 +77,25 @@ class LoginLogic extends BaseLogic @@ -67,11 +77,25 @@ class LoginLogic extends BaseLogic
67 return $this->success($manage->makeVisible('token')->toArray()); 77 return $this->success($manage->makeVisible('token')->toArray());
68 } 78 }
69 79
  80 + /**
  81 + * @remark :退出登录
  82 + * @name :logout
  83 + * @author :lyh
  84 + * @method :post
  85 + * @time :2023/9/7 16:30
  86 + */
70 public function logout(){ 87 public function logout(){
71 Cache::pull(request()->header('token')); 88 Cache::pull(request()->header('token'));
72 return $this->success(); 89 return $this->success();
73 } 90 }
74 91
  92 + /**
  93 + * @remark :获取登录详情
  94 + * @name :manage
  95 + * @author :lyh
  96 + * @method :post
  97 + * @time :2023/9/7 16:30
  98 + */
75 public static function manage($field = ''){ 99 public static function manage($field = ''){
76 $manage = Cache::get(Common::MANAGE_TOKEN . request()->header('token')); 100 $manage = Cache::get(Common::MANAGE_TOKEN . request()->header('token'));
77 $manage = Manage::find($manage['id'] ?? 0); 101 $manage = Manage::find($manage['id'] ?? 0);
@@ -6,8 +6,12 @@ namespace App\Http\Logic\Aside\Manage; @@ -6,8 +6,12 @@ namespace App\Http\Logic\Aside\Manage;
6 use App\Http\Logic\Aside\BaseLogic; 6 use App\Http\Logic\Aside\BaseLogic;
7 use App\Models\Manage\BelongingGroup; 7 use App\Models\Manage\BelongingGroup;
8 use App\Models\Manage\EntryPosition; 8 use App\Models\Manage\EntryPosition;
  9 +use App\Models\Manage\Group;
9 use App\Models\Manage\JobLevel; 10 use App\Models\Manage\JobLevel;
  11 +use App\Models\Manage\Manage;
10 use App\Models\Manage\ManageHr; 12 use App\Models\Manage\ManageHr;
  13 +use App\Models\Manage\Menu;
  14 +use Illuminate\Support\Facades\Hash;
11 15
12 /** 16 /**
13 * Class ManageHrLogic 17 * Class ManageHrLogic
@@ -36,18 +40,27 @@ class HrLogic extends BaseLogic @@ -36,18 +40,27 @@ class HrLogic extends BaseLogic
36 return $this->success($lists); 40 return $this->success($lists);
37 } 41 }
38 42
  43 + /**
  44 + * @remark :保存数据
  45 + * @name :hrSave
  46 + * @author :lyh
  47 + * @method :post
  48 + * @time :2023/9/6 10:17
  49 + */
39 public function hrSave(){ 50 public function hrSave(){
40 - //处理参数  
41 - foreach ($this->model::specieField() as $v){  
42 - $this->param = $this->setJson($v,$this->param);  
43 - }  
44 - if(isset($this->param['id']) && !empty($this->param['id'])){  
45 - $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);  
46 - }else{  
47 - $this->param['manage_id'] = $this->manager['id'];  
48 - $rs = $this->model->add($this->param);  
49 - }  
50 - if($rs === false){ 51 + try {
  52 + //处理参数
  53 + foreach ($this->model::specieField() as $v){
  54 + $this->param = $this->setJson($v,$this->param);
  55 + }
  56 + if(isset($this->param['id']) && !empty($this->param['id'])){
  57 + $this->model->edit($this->param,['id'=>$this->param['id']]);
  58 + }else{
  59 + //添加管理员账号
  60 + $this->param['manage_id'] = $this->addManager($this->param['mobile'],$this->param['name']);
  61 + $this->model->add($this->param);
  62 + }
  63 + }catch (\Exception $e){
51 $this->fail('error'); 64 $this->fail('error');
52 } 65 }
53 return $this->success(); 66 return $this->success();
@@ -61,6 +74,14 @@ class HrLogic extends BaseLogic @@ -61,6 +74,14 @@ class HrLogic extends BaseLogic
61 * @time :2023/7/25 9:27 74 * @time :2023/7/25 9:27
62 */ 75 */
63 public function getHrInfo($id){ 76 public function getHrInfo($id){
  77 + //查看当前用户是否有人事权限
  78 + if($this->manager['gid'] != ManageHr::GID_ZERO){
  79 + $groupModel = new Group();
  80 + $groupInfo = $groupModel->read(['id'=>$this->manager['gid']]);
  81 + if (!in_array(20,$groupInfo['rights']) && ($id != $this->manager['id'])) {
  82 + $this->fail('无权限查看其他用户信息');
  83 + }
  84 + }
64 $data = $this->model->read(['id'=>$id]); 85 $data = $this->model->read(['id'=>$id]);
65 foreach ($this->model::specieField() as $v){ 86 foreach ($this->model::specieField() as $v){
66 $data[$v] = json_decode($data[$v],true); 87 $data[$v] = json_decode($data[$v],true);
@@ -180,4 +201,26 @@ class HrLogic extends BaseLogic @@ -180,4 +201,26 @@ class HrLogic extends BaseLogic
180 ]; 201 ];
181 return $this->success($data); 202 return $this->success($data);
182 } 203 }
  204 +
  205 + /**
  206 + * @remark :添加人事信息时 同步添加管理员账号
  207 + * @name :addManager
  208 + * @author :lyh
  209 + * @method :post
  210 + * @time :2023/9/6 10:18
  211 + */
  212 + public function addManager($mobile,$name){
  213 + $managerModel = new Manage();
  214 + $info = $managerModel->read(['mobile'=>$mobile]);
  215 + if($info === false){
  216 + $this->fail('当前号码已存在');
  217 + }
  218 + $data = [
  219 + 'name'=>$name,
  220 + 'mobile'=>$mobile,
  221 + 'password'=>Hash::make('globalsov6'),
  222 + 'gid'=>4,
  223 + ];
  224 + return $managerModel->addReturnId($data);
  225 + }
183 } 226 }
@@ -23,18 +23,6 @@ class MenuSpecialLogic extends BaseLogic @@ -23,18 +23,6 @@ class MenuSpecialLogic extends BaseLogic
23 } 23 }
24 24
25 /** 25 /**
26 - * @remark :列表  
27 - * @name :lists  
28 - * @author :lyh  
29 - * @method :post  
30 - * @time :2023/8/7 13:44  
31 - */  
32 - public function specialLists($map,$page,$row,$order,$filed = ['*']){  
33 - $lists = $this->model->lists($map,$page,$row,$order,$filed);  
34 - return $this->success($lists);  
35 - }  
36 -  
37 - /**  
38 * @remark :添加时获取用户列表 26 * @remark :添加时获取用户列表
39 * @name :managerList 27 * @name :managerList
40 * @author :lyh 28 * @author :lyh
@@ -87,7 +75,11 @@ class MenuSpecialLogic extends BaseLogic @@ -87,7 +75,11 @@ class MenuSpecialLogic extends BaseLogic
87 * @time :2023/8/7 13:52 75 * @time :2023/8/7 13:52
88 */ 76 */
89 public function specialSave(){ 77 public function specialSave(){
90 - $this->param['user_list'] = ','.trim($this->param['user_list'],',').','; 78 + if(isset($this->param['user_list']) && !empty($this->param['user_list'])){
  79 + $this->param['user_list'] = ','.trim($this->param['user_list'],',').',';
  80 + }else{
  81 + $this->param['user_list'] = '';
  82 + }
91 if(isset($this->param['id']) && !empty($this->param['id'])){ 83 if(isset($this->param['id']) && !empty($this->param['id'])){
92 $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); 84 $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
93 }else{ 85 }else{
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :KeywordPrefixLogic.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2023/9/6 14:40
  8 + */
  9 +
  10 +namespace App\Http\Logic\Aside\Project;
  11 +
  12 +use App\Http\Logic\Aside\BaseLogic;
  13 +use App\Models\Project\KeywordPrefix;
  14 +
  15 +class KeywordPrefixLogic extends BaseLogic
  16 +{
  17 + public function __construct()
  18 + {
  19 + parent::__construct();
  20 + $this->param = $this->requestAll;
  21 + $this->model = new KeywordPrefix();
  22 + }
  23 +
  24 + /**
  25 + * @remark :保存关键字
  26 + * @name :prefixSave
  27 + * @author :lyh
  28 + * @method :post
  29 + * @time :2023/9/6 14:42
  30 + */
  31 + public function prefixSave(){
  32 + try {
  33 + if(isset($this->param['id']) && !empty($this->param['id'])){
  34 + $this->model->edit($this->param,['id'=>$this->param['id']]);
  35 + }else{
  36 + $this->model->add($this->param);
  37 + }
  38 + }catch (\Exception $e){
  39 + $this->fail('error');
  40 + }
  41 + return $this->success();
  42 + }
  43 +}
@@ -3,6 +3,8 @@ @@ -3,6 +3,8 @@
3 namespace App\Http\Logic\Aside\Project; 3 namespace App\Http\Logic\Aside\Project;
4 4
5 use App\Models\Devops\ServerConfig; 5 use App\Models\Devops\ServerConfig;
  6 +use App\Models\User\ProjectMenu;
  7 +use App\Models\User\ProjectRole;
6 use Illuminate\Support\Arr as SupArr; 8 use Illuminate\Support\Arr as SupArr;
7 use App\Helper\Arr; 9 use App\Helper\Arr;
8 use App\Helper\Common; 10 use App\Helper\Common;
@@ -48,24 +50,19 @@ class ProjectLogic extends BaseLogic @@ -48,24 +50,19 @@ class ProjectLogic extends BaseLogic
48 * @time :2023/7/28 17:11 50 * @time :2023/7/28 17:11
49 */ 51 */
50 public function getProjectInfo($id){ 52 public function getProjectInfo($id){
51 -// $info = Common::get_user_cache($this->model->getTable(),$id);  
52 -// if(empty($info)){  
53 - $info = $this->model->with('payment')->with('deploy_build')->with('deploy_optimize')->with('online_check')  
54 - ->with('project_after')->where(['id'=>$id])->first()->toArray();  
55 - if(!empty($info['online_check']['created_manage_id'])){  
56 - $info['online_check']['name'] = (new Manage())->read(['id'=>$info['online_check']['created_manage_id']])['name'] ?? '';  
57 - }  
58 -  
59 - if(isset($info['deploy_optimize']['minor_keywords']) && !empty($info['deploy_optimize']['minor_keywords'])){  
60 - $info['deploy_optimize']['minor_keywords'] = json_decode($info['deploy_optimize']['minor_keywords']) ?? '';  
61 - }else{  
62 - $info['deploy_optimize']['minor_keywords'] = [];  
63 - }  
64 - if($info['extend_type'] != 0){  
65 - $info['type'] = $info['extend_type'];  
66 - }  
67 -// Common::set_user_cache($info,$this->model->getTable(),$id);  
68 -// } 53 + $info = $this->model->with('payment')->with('deploy_build')->with('deploy_optimize')->with('online_check')
  54 + ->with('project_after')->where(['id'=>$id])->first()->toArray();
  55 + if(!empty($info['online_check']['created_manage_id'])){
  56 + $info['online_check']['name'] = (new Manage())->read(['id'=>$info['online_check']['created_manage_id']])['name'] ?? '';
  57 + }
  58 + if(isset($info['deploy_optimize']['minor_keywords']) && !empty($info['deploy_optimize']['minor_keywords'])){
  59 + $info['deploy_optimize']['minor_keywords'] = json_decode($info['deploy_optimize']['minor_keywords']) ?? '';
  60 + }else{
  61 + $info['deploy_optimize']['minor_keywords'] = [];
  62 + }
  63 + if($info['extend_type'] != 0){
  64 + $info['type'] = $info['extend_type'];
  65 + }
69 return $this->success($info); 66 return $this->success($info);
70 } 67 }
71 68
@@ -165,6 +162,9 @@ class ProjectLogic extends BaseLogic @@ -165,6 +162,9 @@ class ProjectLogic extends BaseLogic
165 */ 162 */
166 protected function saveProjectDeployBuild($deploy_build){ 163 protected function saveProjectDeployBuild($deploy_build){
167 $deployBuildModel = new DeployBuild(); 164 $deployBuildModel = new DeployBuild();
  165 + if(isset($deploy_build['configuration']) && !empty($deploy_build['configuration'])){
  166 + $deploy_build['configuration'] = Arr::a2s($deploy_build['configuration']);
  167 + }
168 $deployBuildModel->edit($deploy_build,['id'=>$deploy_build['id']]); 168 $deployBuildModel->edit($deploy_build,['id'=>$deploy_build['id']]);
169 return $this->success(); 169 return $this->success();
170 } 170 }
@@ -222,6 +222,8 @@ class ProjectLogic extends BaseLogic @@ -222,6 +222,8 @@ class ProjectLogic extends BaseLogic
222 if(isset($param['mysql_id']) && !empty($param['mysql_id'])){ 222 if(isset($param['mysql_id']) && !empty($param['mysql_id'])){
223 $this->initializationMysql($param['id']); 223 $this->initializationMysql($param['id']);
224 } 224 }
  225 + //创建初始角色
  226 +// $this->createdRole($param['id']);
225 //初始账号 227 //初始账号
226 if(isset($param['mobile']) && !empty($param['mobile'])){ 228 if(isset($param['mobile']) && !empty($param['mobile'])){
227 $this->createUser($param['mobile'],$param['id'],$param['lead_name']); 229 $this->createUser($param['mobile'],$param['id'],$param['lead_name']);
@@ -293,7 +295,32 @@ class ProjectLogic extends BaseLogic @@ -293,7 +295,32 @@ class ProjectLogic extends BaseLogic
293 return $this->success(); 295 return $this->success();
294 } 296 }
295 297
296 - 298 + /**
  299 + * @remark :创建角色
  300 + * @name :createdRole
  301 + * @author :lyh
  302 + * @method :post
  303 + * @time :2023/9/6 11:16
  304 + */
  305 + public function createdRole($project_id){
  306 + $roleModel = new ProjectRole();
  307 + //查看当前用户是否存在
  308 + $info = $roleModel->read(['project_id'=>$project_id]);
  309 + if($info === false){
  310 + $menuModel = new ProjectMenu();
  311 + $ids = $menuModel->where(['status'=>0])->pluck('id')->toArray();
  312 + $data = [
  313 + 'name'=>'超级管理员',
  314 + 'role_menu'=>implode(',',$ids),
  315 + 'project_id'=>$project_id,
  316 + 'type'=>1,
  317 + 'operator_id'=>$this->manager['id'],
  318 + 'create_id'=>$this->manager['id'],
  319 + ];
  320 + $roleModel->add($data);
  321 + }
  322 + return $this->success();
  323 + }
297 324
298 public function clearCache($id) 325 public function clearCache($id)
299 { 326 {
@@ -376,6 +403,19 @@ class ProjectLogic extends BaseLogic @@ -376,6 +403,19 @@ class ProjectLogic extends BaseLogic
376 return $this->success(); 403 return $this->success();
377 } 404 }
378 405
379 - 406 + /**
  407 + * @remark :
  408 + * @name :projectDel
  409 + * @author :lyh
  410 + * @method :post
  411 + * @time :2023/9/8 15:23
  412 + */
  413 + public function projectDel(){
  414 + $rs = $this->edit(['delete_status'=>1],['id'=>$this->param['id']]);
  415 + if($rs === false){
  416 + $this->fail('error');
  417 + }
  418 + return $this->success();
  419 + }
380 420
381 } 421 }
@@ -25,7 +25,7 @@ class ATemplateLogic extends BaseLogic @@ -25,7 +25,7 @@ class ATemplateLogic extends BaseLogic
25 * @method :post 25 * @method :post
26 * @time :2023/6/28 17:03 26 * @time :2023/6/28 17:03
27 */ 27 */
28 - public function aTemplateList($map,$page,$row,$order = ['created_at'],$filed = ['id','name','url','status','deleted_status','sort','image']){ 28 + public function aTemplateList($map,$page,$row,$order = ['created_at'],$filed = ['*']){
29 $map['deleted_status'] = 0; 29 $map['deleted_status'] = 0;
30 $map['status'] = 0; 30 $map['status'] = 0;
31 $lists = $this->model->lists($map,$page,$row,$order,$filed); 31 $lists = $this->model->lists($map,$page,$row,$order,$filed);
@@ -77,12 +77,12 @@ class CustomTemplateLogic extends BaseLogic @@ -77,12 +77,12 @@ class CustomTemplateLogic extends BaseLogic
77 } 77 }
78 //路由映射 78 //路由映射
79 if(isset($this->param['url']) && !empty($this->param['url'])){ 79 if(isset($this->param['url']) && !empty($this->param['url'])){
80 - RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $id, $this->user['project_id']); 80 + $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $id, $this->user['project_id']);
81 //TODO::通知网站更新 81 //TODO::通知网站更新
82 $data = [ 82 $data = [
83 'project_id'=>$this->user['project_id'], 83 'project_id'=>$this->user['project_id'],
84 'type'=>RouteMap::SOURCE_PAGE, 84 'type'=>RouteMap::SOURCE_PAGE,
85 - 'route'=>$this->param['url'], 85 + 'route'=>$route,
86 ]; 86 ];
87 $this->updateNotify($data); 87 $this->updateNotify($data);
88 } 88 }
@@ -122,14 +122,17 @@ class CustomTemplateLogic extends BaseLogic @@ -122,14 +122,17 @@ class CustomTemplateLogic extends BaseLogic
122 'project_id'=>$this->user['project_id'], 122 'project_id'=>$this->user['project_id'],
123 'source'=>1//首页 123 'source'=>1//首页
124 ]); 124 ]);
125 - if(empty($preg_html)){  
126 - $preg_html = "<main></main>";  
127 - $html = preg_replace('/<style id="globalsojs-styles">(.*?)<\/style>/s', "<style id='globalsojs-styles'></style>", $TemplateInfo['html']);  
128 - }else{  
129 - $html = preg_replace('/<style id="globalsojs-styles">(.*?)<\/style>/s',$html_style , $TemplateInfo['html']); 125 + $html = '';
  126 + if($TemplateInfo !== false){
  127 + if(empty($preg_html)){
  128 + $preg_html = "<main></main>";
  129 + $html = preg_replace('/<style id="globalsojs-styles">(.*?)<\/style>/s', "<style id='globalsojs-styles'></style>", $TemplateInfo['html']);
  130 + }else{
  131 + $html = preg_replace('/<style id="globalsojs-styles">(.*?)<\/style>/s',$html_style , $TemplateInfo['html']);
  132 + }
  133 + //内容
  134 + $html = preg_replace('/<main\b[^>]*>(.*?)<\/main>/s', $preg_html, $html);
130 } 135 }
131 - //内容  
132 - $html = preg_replace('/<main\b[^>]*>(.*?)<\/main>/s', $preg_html, $html);  
133 return $html; 136 return $html;
134 } 137 }
135 138
@@ -8,6 +8,7 @@ use App\Exceptions\BsideGlobalException; @@ -8,6 +8,7 @@ use App\Exceptions\BsideGlobalException;
8 use App\Http\Logic\Logic; 8 use App\Http\Logic\Logic;
9 use App\Models\Com\UpdateNotify; 9 use App\Models\Com\UpdateNotify;
10 use App\Models\Project\Project; 10 use App\Models\Project\Project;
  11 +use App\Models\RouteMap\RouteDelete;
11 use Illuminate\Support\Facades\Cache; 12 use Illuminate\Support\Facades\Cache;
12 13
13 /** 14 /**
@@ -159,4 +160,23 @@ class BaseLogic extends Logic @@ -159,4 +160,23 @@ class BaseLogic extends Logic
159 } 160 }
160 return $this->success(); 161 return $this->success();
161 } 162 }
  163 +
  164 + /**
  165 + * @remark :删除和编辑路由时生成一条记录
  166 + * @name :setRouteDeleteSave
  167 + * @author :lyh
  168 + * @method :post
  169 + * @time :2023/9/7 9:38
  170 + */
  171 + public function setRouteDeleteSave($param){
  172 + $routeDeleteModel = new RouteDelete();
  173 + $data = [
  174 + 'project_id'=>$this->user['project_id'],
  175 + 'source'=>$param['source'],
  176 + 'created_at'=>date('Y-m-d H:i:s'),
  177 + 'route'=>$param['route'],
  178 + ];
  179 + $routeDeleteModel->insert($data);
  180 + return $this->success();
  181 + }
162 } 182 }
@@ -35,23 +35,35 @@ class BlogCategoryLogic extends BaseLogic @@ -35,23 +35,35 @@ class BlogCategoryLogic extends BaseLogic
35 $v['category_name'] = trim($str,','); 35 $v['category_name'] = trim($str,',');
36 return $this->success($v); 36 return $this->success($v);
37 } 37 }
  38 +
38 /** 39 /**
39 - * @name :添加时验证上级分类是否有商品,有则替换带当前分类下  
40 - * @return void  
41 - * @author :liyuhang  
42 - * @method 40 + * @remark :保存数据
  41 + * @name :categorySave
  42 + * @author :lyh
  43 + * @method :post
  44 + * @time :2023/9/7 13:42
43 */ 45 */
44 - public function add_blog_category(){ 46 + public function categorySave(){
45 //验证名称是否存在 47 //验证名称是否存在
46 $this->verifyParamName($this->param['name']); 48 $this->verifyParamName($this->param['name']);
47 - //拼接参数  
48 - $this->param = $this->addParamProcessing($this->param);  
49 DB::beginTransaction(); 49 DB::beginTransaction();
50 try { 50 try {
51 - $cate_id = $this->model->insertGetId($this->param);  
52 - //处理子集  
53 - $this->addProcessingSon($cate_id);  
54 - $route = RouteMap::setRoute($this->param['alias'] ?: $this->param['name'], RouteMap::SOURCE_BLOG_CATE, $cate_id, $this->user['project_id']); 51 + if(isset($this->param['id']) && !empty($this->param['id'])){
  52 + //验证参数是否可编辑
  53 + $this->verifyParamEdit($this->param['id'],$this->param['pid']);
  54 + //查看路由是否更新
  55 + $id = $this->editCategoryRoute($this->param['id'],$this->param['alias']);
  56 + $this->param['operator_id'] = $this->user['id'];
  57 + $this->edit($this->param,['id'=>$this->param['id']]);
  58 + }else{
  59 + //拼接参数
  60 + $this->param = $this->addParamProcessing($this->param);
  61 + $id = $this->model->addReturnId($this->param);
  62 + //处理子集
  63 + $this->addProcessingSon($id);
  64 + }
  65 + $route = RouteMap::setRoute($this->param['alias'] ?: $this->param['name'], RouteMap::SOURCE_BLOG_CATE, $id, $this->user['project_id']);
  66 + $this->edit(['alias'=>$route],['id'=>$id]);
55 DB::commit(); 67 DB::commit();
56 }catch (\Exception $e){ 68 }catch (\Exception $e){
57 DB::rollBack(); 69 DB::rollBack();
@@ -63,24 +75,26 @@ class BlogCategoryLogic extends BaseLogic @@ -63,24 +75,26 @@ class BlogCategoryLogic extends BaseLogic
63 } 75 }
64 76
65 /** 77 /**
66 - * @name :编辑分类  
67 - * @return void  
68 - * @author :liyuhang  
69 - * @method 78 + * @remark :编辑路由时生成路由记录
  79 + * @name :editCategoryRoute
  80 + * @author :lyh
  81 + * @method :post
  82 + * @time :2023/9/7 10:51
70 */ 83 */
71 - public function edit_blog_category(){  
72 - //验证名称是否存在  
73 - $this->verifyParamName($this->param['name'],$this->param['id']);  
74 - //验证参数是否可编辑  
75 - $this->verifyParamEdit($this->param['id'],$this->param['pid']);  
76 - $this->param['operator_id'] = $this->user['id'];  
77 - $this->edit($this->param,['id'=>$this->param['id']]);  
78 - $route = RouteMap::setRoute($this->param['alias'] ?: $this->param['name'], RouteMap::SOURCE_BLOG_CATE, $this->param['id'], $this->user['project_id']);  
79 - //通知更新  
80 - $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_BLOG_CATE, 'route'=>$route]); 84 + public function editCategoryRoute($id,$route){
  85 + //生成一条删除路由记录
  86 + $info = $this->model->read(['id'=>$id],['id','alias']);
  87 + if($info['alias'] != $route){
  88 + $data = [
  89 + 'source'=>RouteMap::SOURCE_NEWS_CATE,
  90 + 'route'=>$info['alias'],
  91 + ];
  92 + $this->setRouteDeleteSave($data);
  93 + }
81 return $this->success(); 94 return $this->success();
82 } 95 }
83 96
  97 +
84 /** 98 /**
85 * @remark :查看参数是否可编辑 99 * @remark :查看参数是否可编辑
86 * @name :verifyParamEdit 100 * @name :verifyParamEdit
@@ -115,7 +129,7 @@ class BlogCategoryLogic extends BaseLogic @@ -115,7 +129,7 @@ class BlogCategoryLogic extends BaseLogic
115 * @method 129 * @method
116 */ 130 */
117 public function info_blog_category(){ 131 public function info_blog_category(){
118 - $info = $this->info($this->param); 132 + $info = $this->model->read($this->param);
119 return $this->success($info); 133 return $this->success($info);
120 } 134 }
121 135
@@ -139,24 +153,35 @@ class BlogCategoryLogic extends BaseLogic @@ -139,24 +153,35 @@ class BlogCategoryLogic extends BaseLogic
139 * @author :liyuhang 153 * @author :liyuhang
140 * @method 154 * @method
141 */ 155 */
142 - public function del_blog_category(){  
143 - $ids = $this->param['id'];  
144 - foreach ($ids as $v){  
145 - //查询是否有子分类  
146 - $rs = $this->model->read(['pid'=>$v],['id']);  
147 - if($rs !== false){  
148 - $this->response('当前分类拥有子分类不允许删除');  
149 - }  
150 - //查看当前分内下是否有博客  
151 - $blogModel = new BlogModel();  
152 - $rs = $blogModel->read(['category_id'=>$v],['id']);  
153 - if($rs !== false){  
154 - $this->response('当前分类拥有博客,不允许删除');  
155 - }  
156 - RouteMap::delRoute(RouteMap::SOURCE_BLOG_CATE, $v, $this->user['project_id']); 156 + public function delBlogCategory(){
  157 + foreach ($this->param['id'] as $id){
  158 + $this->verifyIsDelete($id);
  159 + //删除路由
  160 + $this->delRoute($id);
  161 + $this->model->del(['id'=>$id]);
  162 + }
  163 + return $this->success();
  164 + }
  165 +
  166 + /**
  167 + * @remark :验证是否可删除
  168 + * @name :VerifyIsDelete
  169 + * @author :lyh
  170 + * @method :post
  171 + * @time :2023/9/7 14:40
  172 + */
  173 + public function verifyIsDelete($id){
  174 + //查询是否有子分类
  175 + $rs = $this->model->read(['pid'=>$id],['id']);
  176 + if($rs !== false){
  177 + $this->response('当前分类拥有子分类不允许删除');
  178 + }
  179 + //查看当前分内下是否有博客
  180 + $blogModel = new BlogModel();
  181 + $rs = $blogModel->read(['category_id'=>$id],['id']);
  182 + if($rs !== false){
  183 + $this->response('当前分类拥有博客,不允许删除');
157 } 184 }
158 - $this->param['id'] = ['in',$this->param['id']];  
159 - $this->del($this->param,$ids);  
160 return $this->success(); 185 return $this->success();
161 } 186 }
162 187
@@ -186,8 +211,6 @@ class BlogCategoryLogic extends BaseLogic @@ -186,8 +211,6 @@ class BlogCategoryLogic extends BaseLogic
186 $param['project_id'] = $this->user['project_id']; 211 $param['project_id'] = $this->user['project_id'];
187 $param['operator_id'] = $this->user['id']; 212 $param['operator_id'] = $this->user['id'];
188 $param['create_id'] = $this->user['id']; 213 $param['create_id'] = $this->user['id'];
189 - $param['created_at'] = date('Y-m-d H:i:s');  
190 - $param['updated_at'] = date('Y-m-d H:i:s');  
191 return $this->success($param); 214 return $this->success($param);
192 } 215 }
193 216
@@ -197,16 +220,14 @@ class BlogCategoryLogic extends BaseLogic @@ -197,16 +220,14 @@ class BlogCategoryLogic extends BaseLogic
197 * @method :post 220 * @method :post
198 * @time :2023/6/13 11:41 221 * @time :2023/6/13 11:41
199 */ 222 */
200 - public function verifyParamName($name,$id = ''){  
201 - if(isset($id) && !empty($id)){ 223 + public function verifyParamName($name){
  224 + if(isset($this->param['id']) && !empty($this->param['id'])){
202 $condition = [ 225 $condition = [
203 - 'id'=>['!=',$id], 226 + 'id'=>['!=',$this->param['id']],
204 'name'=>$name, 227 'name'=>$name,
205 ]; 228 ];
206 }else{ 229 }else{
207 - $condition = [  
208 - 'name'=>$name  
209 - ]; 230 + $condition = ['name'=>$name];
210 } 231 }
211 $info = $this->model->read($condition); 232 $info = $this->model->read($condition);
212 if($info !== false){ 233 if($info !== false){
@@ -246,4 +267,23 @@ class BlogCategoryLogic extends BaseLogic @@ -246,4 +267,23 @@ class BlogCategoryLogic extends BaseLogic
246 return $this->success(); 267 return $this->success();
247 } 268 }
248 269
  270 + /**
  271 + * @remark :删除路由
  272 + * @name :delRoute
  273 + * @author :lyh
  274 + * @method :post
  275 + * @time :2023/9/7 10:50
  276 + */
  277 + public function delRoute($id){
  278 + //删除路由映射
  279 + RouteMap::delRoute(RouteMap::SOURCE_BLOG_CATE, $id, $this->user['project_id']);
  280 + //生成一条删除路由记录
  281 + $info = $this->model->read(['id'=>$id],['id','alias']);
  282 + $data = [
  283 + 'source'=>RouteMap::SOURCE_BLOG_CATE,
  284 + 'route'=>$info['alias'],
  285 + ];
  286 + $this->setRouteDeleteSave($data);
  287 + return $this->success();
  288 + }
249 } 289 }
@@ -47,20 +47,28 @@ class BlogLogic extends BaseLogic @@ -47,20 +47,28 @@ class BlogLogic extends BaseLogic
47 } 47 }
48 return $this->success($list); 48 return $this->success($list);
49 } 49 }
  50 +
50 /** 51 /**
51 - * @name :添加博客  
52 - * @return void  
53 - * @author :liyuhang  
54 - * @method 52 + * @remark :保存数据
  53 + * @name :blogSave
  54 + * @author :lyh
  55 + * @method :post
  56 + * @time :2023/9/7 11:49
55 */ 57 */
56 - public function blogAdd(){ 58 + public function blogSave(){
57 //拼接参数 59 //拼接参数
58 DB::beginTransaction(); 60 DB::beginTransaction();
59 try { 61 try {
60 $this->param = $this->paramProcessing($this->param); 62 $this->param = $this->paramProcessing($this->param);
61 - $rs = $this->model->insertGetId($this->param);  
62 - $route = $this->param['url'] = RouteMap::setRoute($this->param['url'] ?: $this->param['name'],  
63 - RouteMap::SOURCE_BLOG, $rs, $this->user['project_id']); 63 + if(isset($this->param['id']) && !empty($this->param['id'])){
  64 + //是否更新路由
  65 + $id = $this->editNewsRoute($this->param['id'],$this->param['url']);
  66 + $this->edit($this->param,['id'=>$this->param['id']]);
  67 + }else{
  68 + $id = $this->model->addReturnId($this->param);
  69 + }
  70 + $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $id, $this->user['project_id']);
  71 + $this->edit(['url'=>$route],['id'=>$id]);
64 DB::commit(); 72 DB::commit();
65 }catch (\Exception $e){ 73 }catch (\Exception $e){
66 DB::rollBack(); 74 DB::rollBack();
@@ -72,28 +80,25 @@ class BlogLogic extends BaseLogic @@ -72,28 +80,25 @@ class BlogLogic extends BaseLogic
72 } 80 }
73 81
74 /** 82 /**
75 - * @name : 编辑博客  
76 - * @return void  
77 - * @author :liyuhang  
78 - * @method 83 + * @remark :查看是否编辑路由
  84 + * @name :editCategoryRoute
  85 + * @author :lyh
  86 + * @method :post
  87 + * @time :2023/9/7 11:05
79 */ 88 */
80 - public function blogEdit(){  
81 - //拼接参数  
82 - $this->param = $this->paramProcessing($this->param);  
83 - DB::beginTransaction();  
84 - try {  
85 - $route = RouteMap::setRoute($this->param['url'] ?: $this->param['name'],  
86 - RouteMap::SOURCE_BLOG, $this->param['id'], $this->user['project_id']);  
87 - $this->edit($this->param,['id'=>$this->param['id']]);  
88 - DB::commit();  
89 - }catch (\Exception $e){  
90 - DB::rollBack();  
91 - $this->fail('error'); 89 + public function editNewsRoute($id,$route){
  90 + //生成一条删除路由记录
  91 + $info = $this->model->read(['id'=>$id],['id','url']);
  92 + if($info['url'] != $route){
  93 + $data = [
  94 + 'source'=>RouteMap::SOURCE_BLOG,
  95 + 'route'=>$info['url'],
  96 + ];
  97 + $this->setRouteDeleteSave($data);
92 } 98 }
93 - //通知更新  
94 - $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_BLOG, 'route'=>$route]);  
95 - return $this->success(); 99 + return $id;
96 } 100 }
  101 +
97 /** 102 /**
98 * @name :编辑seo 103 * @name :编辑seo
99 * @return void 104 * @return void
@@ -108,6 +113,8 @@ class BlogLogic extends BaseLogic @@ -108,6 +113,8 @@ class BlogLogic extends BaseLogic
108 } 113 }
109 return $this->success(); 114 return $this->success();
110 } 115 }
  116 +
  117 +
111 /** 118 /**
112 * @name :获取数据详情 119 * @name :获取数据详情
113 * @return array 120 * @return array
@@ -128,8 +135,7 @@ class BlogLogic extends BaseLogic @@ -128,8 +135,7 @@ class BlogLogic extends BaseLogic
128 //获取标签名称 135 //获取标签名称
129 $blogLabelLogic = new BlogLabelLogic(); 136 $blogLabelLogic = new BlogLabelLogic();
130 $info = $blogLabelLogic->get_label_name($info); 137 $info = $blogLabelLogic->get_label_name($info);
131 - $info['route'] = RouteMap::getRoute(RouteMap::SOURCE_BLOG, $info['id'], $this->user['project_id']);  
132 - $info['url'] = $this->user['domain'] . $info['route']; 138 + $info['url'] = $this->user['domain'] . $info['url'];
133 $info['image_link'] = getImageUrl($info['image']); 139 $info['image_link'] = getImageUrl($info['image']);
134 //写入缓存 140 //写入缓存
135 Common::set_user_cache($info,$this->model->getTable(),$this->param['id']); 141 Common::set_user_cache($info,$this->model->getTable(),$this->param['id']);
@@ -144,7 +150,7 @@ class BlogLogic extends BaseLogic @@ -144,7 +150,7 @@ class BlogLogic extends BaseLogic
144 * @author :liyuhang 150 * @author :liyuhang
145 * @method 151 * @method
146 */ 152 */
147 - public function blog_status(){ 153 + public function blogStatus(){
148 $this->param['operator_id'] = $this->user['id']; 154 $this->param['operator_id'] = $this->user['id'];
149 $rs = $this->model->edit($this->param,['id'=>['in',$this->param['id']]]); 155 $rs = $this->model->edit($this->param,['id'=>['in',$this->param['id']]]);
150 if($rs === false){ 156 if($rs === false){
@@ -159,14 +165,12 @@ class BlogLogic extends BaseLogic @@ -159,14 +165,12 @@ class BlogLogic extends BaseLogic
159 * @author :liyuhang 165 * @author :liyuhang
160 * @method 166 * @method
161 */ 167 */
162 - public function blog_del(){  
163 - $ids = $this->param['id']; 168 + public function blogDel(){
164 DB::beginTransaction(); 169 DB::beginTransaction();
165 try { 170 try {
166 - $this->param['id'] = ['in',$this->param['id']];  
167 - $this->del($this->param,$ids);  
168 - foreach ($ids as $id){  
169 - RouteMap::delRoute(RouteMap::SOURCE_BLOG, $id, $this->user['project_id']); 171 + foreach ($this->param['id'] as $id){
  172 + $this->delRoute($id);
  173 + $this->model->del(['id'=>$id]);
170 } 174 }
171 DB::commit(); 175 DB::commit();
172 }catch (Exception $e){ 176 }catch (Exception $e){
@@ -176,6 +180,25 @@ class BlogLogic extends BaseLogic @@ -176,6 +180,25 @@ class BlogLogic extends BaseLogic
176 return $this->success(); 180 return $this->success();
177 } 181 }
178 182
  183 + /**
  184 + * @remark :删除路由
  185 + * @name :delRoute
  186 + * @author :lyh
  187 + * @method :post
  188 + * @time :2023/9/7 10:50
  189 + */
  190 + public function delRoute($id){
  191 + //删除路由映射
  192 + RouteMap::delRoute(RouteMap::SOURCE_BLOG, $id, $this->user['project_id']);
  193 + //生成一条删除路由记录
  194 + $info = $this->model->read(['id'=>$id],['id','url']);
  195 + $data = [
  196 + 'source'=>RouteMap::SOURCE_BLOG,
  197 + 'route'=>$info['url'],
  198 + ];
  199 + $this->setRouteDeleteSave($data);
  200 + return $this->success();
  201 + }
179 202
180 /** 203 /**
181 * @name :(参数处理)paramProcessing 204 * @name :(参数处理)paramProcessing
@@ -191,8 +214,6 @@ class BlogLogic extends BaseLogic @@ -191,8 +214,6 @@ class BlogLogic extends BaseLogic
191 $param['create_id'] = $this->user['id']; 214 $param['create_id'] = $this->user['id'];
192 $param['operator_id'] = $this->user['id']; 215 $param['operator_id'] = $this->user['id'];
193 $param['project_id'] = $this->user['project_id']; 216 $param['project_id'] = $this->user['project_id'];
194 - $param['created_at'] = date('Y-m-d H:i:s',time());  
195 - $param['updated_at'] = date('Y-m-d H:i:s',time());  
196 $param['category_id'] = ','.$param['category_id'].','; 217 $param['category_id'] = ','.$param['category_id'].',';
197 } 218 }
198 return $this->success($param); 219 return $this->success($param);
@@ -5,6 +5,8 @@ namespace App\Http\Logic\Bside\Nav; @@ -5,6 +5,8 @@ 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\RouteMap\RouteMap;
  9 +use Illuminate\Support\Facades\DB;
8 10
9 11
10 /** 12 /**
@@ -32,23 +34,41 @@ class NavLogic extends BaseLogic @@ -32,23 +34,41 @@ class NavLogic extends BaseLogic
32 */ 34 */
33 public function navSave() 35 public function navSave()
34 { 36 {
35 - if(isset($this->param['id']) && !empty($this->param['id'])){  
36 - $info = $this->model->read(['id'=>$this->param['id']]);  
37 - if($this->param['pid'] == $info['id']){  
38 - $this->fail('不允许成为自己的上级'); 37 + DB::beginTransaction();
  38 + try {
  39 + if(isset($this->param['id']) && !empty($this->param['id'])){
  40 + $this->handleEditParam();//验证是否可编辑分类
  41 + $this->model->edit($this->param,['id'=>$this->param['id']]);
  42 + }else{
  43 + $this->param['project_id'] = $this->user['project_id'];
  44 + $this->model->add($this->param);
39 } 45 }
40 - $pid_info = $this->model->read(['pid'=>$this->param['id']]);  
41 - if(($pid_info !== false) && $this->param['pid'] != $info['pid']){  
42 - $this->fail('当前菜单拥有子集不允许修改上级');  
43 - }  
44 - $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);  
45 - }else{  
46 - $this->param['project_id'] = $this->user['project_id'];  
47 - $rs = $this->model->add($this->param);  
48 - }  
49 - if($rs === false){ 46 + DB::commit();
  47 + }catch (\Exception $e){
  48 + DB::rollBack();
50 $this->fail('error'); 49 $this->fail('error');
51 } 50 }
  51 + //编辑菜单后,通知更新
  52 + $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NAV, 'route'=>'all']);
  53 + return $this->success();
  54 + }
  55 +
  56 + /**
  57 + * @remark :验证是否可编辑
  58 + * @name :handleEditParam
  59 + * @author :lyh
  60 + * @method :post
  61 + * @time :2023/9/7 14:36
  62 + */
  63 + public function handleEditParam(){
  64 + $info = $this->model->read(['id'=>$this->param['id']]);
  65 + if($this->param['pid'] == $info['id']){
  66 + $this->fail('不允许成为自己的上级');
  67 + }
  68 + $pid_info = $this->model->read(['pid'=>$this->param['id']]);
  69 + if(($pid_info !== false) && $this->param['pid'] != $info['pid']){
  70 + $this->fail('当前菜单拥有子集不允许修改上级');
  71 + }
52 return $this->success(); 72 return $this->success();
53 } 73 }
54 74
@@ -70,6 +90,8 @@ class NavLogic extends BaseLogic @@ -70,6 +90,8 @@ class NavLogic extends BaseLogic
70 if($rs === false){ 90 if($rs === false){
71 $this->fail('error'); 91 $this->fail('error');
72 } 92 }
  93 + //编辑菜单后,通知更新
  94 + $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NAV, 'route'=>'all']);
73 return $this->success(); 95 return $this->success();
74 } 96 }
75 97
@@ -44,57 +44,65 @@ class NewsCategoryLogic extends BaseLogic @@ -44,57 +44,65 @@ class NewsCategoryLogic extends BaseLogic
44 * @method 44 * @method
45 */ 45 */
46 public function info_news_category(){ 46 public function info_news_category(){
47 - $info = $this->info($this->param); 47 + $info = $this->model->read($this->param);
48 return $this->success($info); 48 return $this->success($info);
49 } 49 }
  50 +
50 /** 51 /**
51 - * @name :添加时验证上级分类是否有商品,有则替换带当前分类下  
52 - * @return void  
53 - * @author :liyuhang  
54 - * @method 52 + * @remark :保存数据
  53 + * @name :newsCategorySave
  54 + * @author :lyh
  55 + * @method :post
  56 + * @time :2023/9/7 14:53
55 */ 57 */
56 - public function add_news_category(){ 58 + public function newsCategorySave(){
57 //验证名称是否存在 59 //验证名称是否存在
58 $this->verifyParamName($this->param['name']); 60 $this->verifyParamName($this->param['name']);
59 - //参数处理  
60 - $this->param = $this->addParamProcessing($this->param);  
61 DB::beginTransaction(); 61 DB::beginTransaction();
62 try { 62 try {
63 - $cate_id = $this->model->insertGetId($this->param);  
64 - //当父级分类拥有产品时,处理产品  
65 - $this->addProcessingSon($cate_id);  
66 - RouteMap::setRoute($this->param['alias'] ?: $this->param['name'],  
67 - RouteMap::SOURCE_NEWS_CATE, $cate_id, $this->user['project_id']); 63 + if(isset($this->param['id']) && !empty($this->param['id'])){
  64 + //验证是否可编辑
  65 + $this->verifyEditParam($this->param['id'],$this->param['pid']);
  66 + $this->param['operator_id'] = $this->user['id'];
  67 + //查看路由是否更新
  68 + $id = $this->editCategoryRoute($this->param['id'],$this->param['alias']);
  69 + $this->edit($this->param,['id'=>$this->param['id']]);
  70 + }else{
  71 + $id = $this->model->addReturnId($this->param);
  72 + //当父级分类拥有产品时,处理子集
  73 + $this->addProcessingSon($id);
  74 + }
  75 + $route = RouteMap::setRoute($this->param['alias'] ?: $this->param['name'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']);
  76 + $this->model->edit(['alias'=>$route],['id'=>$id]);
68 DB::commit(); 77 DB::commit();
69 }catch (\Exception $e){ 78 }catch (\Exception $e){
70 DB::rollBack(); 79 DB::rollBack();
71 $this->fail('error'); 80 $this->fail('error');
72 } 81 }
73 - //通知更新  
74 - $this->updateNotify(['project_id'=>$this->user['project_id'],  
75 - 'type'=>RouteMap::SOURCE_NEWS_CATE, 'route'=>$this->param['alias']]); 82 + //更新通知记录表
  83 + $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NEWS_CATE, 'route'=>$this->param['alias']]);
76 return $this->success(); 84 return $this->success();
77 } 85 }
78 86
  87 +
79 /** 88 /**
80 - * @name :编辑分类  
81 - * @return void  
82 - * @author :liyuhang  
83 - * @method 89 + * @remark :编辑路由时生成路由记录
  90 + * @name :editCategoryRoute
  91 + * @author :lyh
  92 + * @method :post
  93 + * @time :2023/9/7 10:51
84 */ 94 */
85 - public function edit_news_category(){  
86 - //验证名称是否存在  
87 - $this->verifyParamName($this->param['name'],$this->param['id']);  
88 - //验证是否可编辑  
89 - $this->verifyEditParam($this->param['id'],$this->param['pid']);  
90 - $this->param['operator_id'] = $this->user['id'];  
91 - $this->param['alias'] = RouteMap::setRoute($this->param['alias'] ?: $this->param['name'],  
92 - RouteMap::SOURCE_NEWS_CATE, $this->param['id'], $this->user['project_id']);  
93 - $this->edit($this->param,['id'=>$this->param['id']]);  
94 - //通知更新  
95 - $this->updateNotify(['project_id'=>$this->user['project_id'],  
96 - 'type'=>RouteMap::SOURCE_NEWS_CATE, 'route'=>$this->param['alias']]);  
97 - return $this->success(); 95 + public function editCategoryRoute($id,$route){
  96 + //生成一条删除路由记录
  97 + $info = $this->model->read(['id'=>$id],['id','alias']);
  98 + if($info['alias'] != $route){
  99 + $data = [
  100 + 'source'=>RouteMap::SOURCE_NEWS_CATE,
  101 + 'route'=>$info['alias'],
  102 + ];
  103 + $this->setRouteDeleteSave($data);
  104 + }
  105 + return $id;
98 } 106 }
99 107
100 /** 108 /**
@@ -144,23 +152,21 @@ class NewsCategoryLogic extends BaseLogic @@ -144,23 +152,21 @@ class NewsCategoryLogic extends BaseLogic
144 * @method 152 * @method
145 */ 153 */
146 public function del_news_category(){ 154 public function del_news_category(){
147 - $ids = $this->param['id'];  
148 - foreach ($this->param['id'] as $v){ 155 + foreach ($this->param['id'] as $id){
149 //查询是否有子分类 156 //查询是否有子分类
150 - $rs = $this->model->read(['pid'=>$v],['id']); 157 + $rs = $this->model->read(['pid'=>$id],['id']);
151 if($rs !== false){ 158 if($rs !== false){
152 $this->fail('当前分类拥有子分类不允许删除'); 159 $this->fail('当前分类拥有子分类不允许删除');
153 } 160 }
154 //查看当前分内下是否有商品 161 //查看当前分内下是否有商品
155 $newsModel = new NewsModel(); 162 $newsModel = new NewsModel();
156 - $rs = $newsModel->read(['category_id'=>$v],['id']); 163 + $rs = $newsModel->read(['category_id'=>$id],['id']);
157 if($rs !== false){ 164 if($rs !== false){
158 $this->fail('当前分类拥有商品'); 165 $this->fail('当前分类拥有商品');
159 } 166 }
160 - RouteMap::delRoute(RouteMap::SOURCE_NEWS_CATE, $v, $this->user['project_id']); 167 + $this->delRoute($id);
  168 + $this->model->del(['id'=>$id]);
161 } 169 }
162 - $this->param['id'] = ['in',$this->param['id']];  
163 - $this->del($this->param,$ids);  
164 return $this->success(); 170 return $this->success();
165 } 171 }
166 172
@@ -186,16 +192,11 @@ class NewsCategoryLogic extends BaseLogic @@ -186,16 +192,11 @@ class NewsCategoryLogic extends BaseLogic
186 * @method :post 192 * @method :post
187 * @time :2023/6/13 11:41 193 * @time :2023/6/13 11:41
188 */ 194 */
189 - public function verifyParamName($name,$id = ''){  
190 - if(isset($id) && !empty($id)){  
191 - $condition = [  
192 - 'id'=>['!=',$id],  
193 - 'name'=>$name,  
194 - ]; 195 + public function verifyParamName($name){
  196 + if(isset($this->param['id']) && !empty($this->param['id'])){
  197 + $condition = ['id'=>['!=',$this->param['id']], 'name'=>$name];
195 }else{ 198 }else{
196 - $condition = [  
197 - 'name'=>$name  
198 - ]; 199 + $condition = ['name'=>$name];
199 } 200 }
200 $info = $this->model->read($condition); 201 $info = $this->model->read($condition);
201 if($info !== false){ 202 if($info !== false){
@@ -214,8 +215,6 @@ class NewsCategoryLogic extends BaseLogic @@ -214,8 +215,6 @@ class NewsCategoryLogic extends BaseLogic
214 $param['project_id'] = $this->user['project_id']; 215 $param['project_id'] = $this->user['project_id'];
215 $param['operator_id'] = $this->user['id']; 216 $param['operator_id'] = $this->user['id'];
216 $param['create_id'] = $this->user['id']; 217 $param['create_id'] = $this->user['id'];
217 - $param['created_at'] = date('Y-m-d H:i:s');  
218 - $param['updated_at'] = date('Y-m-d H:i:s');  
219 return $this->success($param); 218 return $this->success($param);
220 } 219 }
221 220
@@ -248,4 +247,24 @@ class NewsCategoryLogic extends BaseLogic @@ -248,4 +247,24 @@ class NewsCategoryLogic extends BaseLogic
248 } 247 }
249 return $this->success(); 248 return $this->success();
250 } 249 }
  250 +
  251 + /**
  252 + * @remark :删除路由
  253 + * @name :delRoute
  254 + * @author :lyh
  255 + * @method :post
  256 + * @time :2023/9/7 10:50
  257 + */
  258 + public function delRoute($id){
  259 + //删除路由映射
  260 + RouteMap::delRoute(RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']);
  261 + //生成一条删除路由记录
  262 + $info = $this->model->read(['id'=>$id],['id','alias']);
  263 + $data = [
  264 + 'source'=>RouteMap::SOURCE_NEWS_CATE,
  265 + 'route'=>$info['alias'],
  266 + ];
  267 + $this->setRouteDeleteSave($data);
  268 + return $this->success();
  269 + }
251 } 270 }
@@ -48,18 +48,27 @@ class NewsLogic extends BaseLogic @@ -48,18 +48,27 @@ class NewsLogic extends BaseLogic
48 } 48 }
49 49
50 /** 50 /**
51 - * @name :添加博客  
52 - * @return void  
53 - * @author :liyuhang  
54 - * @method 51 + * @remark :保存数据
  52 + * @name :newsSave
  53 + * @author :lyh
  54 + * @method :post
  55 + * @time :2023/9/7 11:02
55 */ 56 */
56 - public function news_add(){ 57 + public function newsSave(){
57 //拼接参数 58 //拼接参数
58 DB::beginTransaction(); 59 DB::beginTransaction();
59 try { 60 try {
60 $this->param = $this->paramProcessing($this->param); 61 $this->param = $this->paramProcessing($this->param);
61 - $rs = $this->model->insertGetId($this->param);  
62 - $route = RouteMap::setRoute($this->param['url'] ?: $this->param['name'], RouteMap::SOURCE_NEWS, $rs, $this->user['project_id']); 62 + if(isset($this->param['id']) && !empty($this->param['id'])){
  63 + //是否更新路由
  64 + $id = $this->editNewsRoute($this->param['id'],$this->param['url']);
  65 + $this->edit($this->param,['id'=>$this->param['id']]);
  66 + }else{
  67 + $id = $this->model->addReturnId($this->param);
  68 + }
  69 + //更新路由
  70 + $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']);
  71 + $this->edit(['url'=>$route],['id'=>$id]);
63 DB::commit(); 72 DB::commit();
64 }catch (\Exception $e){ 73 }catch (\Exception $e){
65 DB::rollBack(); 74 DB::rollBack();
@@ -71,29 +80,26 @@ class NewsLogic extends BaseLogic @@ -71,29 +80,26 @@ class NewsLogic extends BaseLogic
71 } 80 }
72 81
73 /** 82 /**
74 - * @name :编辑  
75 - * @return void  
76 - * @author :liyuhang  
77 - * @method 83 + * @remark :查看是否编辑路由
  84 + * @name :editCategoryRoute
  85 + * @author :lyh
  86 + * @method :post
  87 + * @time :2023/9/7 11:05
78 */ 88 */
79 - public function news_edit(){  
80 - //拼接参数  
81 - $this->param = $this->paramProcessing($this->param);  
82 - DB::beginTransaction();  
83 - try {  
84 - //设置路由  
85 - $route = RouteMap::setRoute($this->param['url'] ?: $this->param['name'], RouteMap::SOURCE_NEWS, $this->param['id'], $this->user['project_id']);  
86 - $this->edit($this->param,['id'=>$this->param['id']]);  
87 - DB::commit();  
88 - }catch (\exception $e){  
89 - DB::rollBack();  
90 - $this->fail('参数错误或其他服务器原因,编辑失败'); 89 + public function editNewsRoute($id,$route){
  90 + //生成一条删除路由记录
  91 + $info = $this->model->read(['id'=>$id],['id','url']);
  92 + if($info['url'] != $route){
  93 + $data = [
  94 + 'source'=>RouteMap::SOURCE_NEWS,
  95 + 'route'=>$info['url'],
  96 + ];
  97 + $this->setRouteDeleteSave($data);
91 } 98 }
92 - //通知更新  
93 - $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NEWS, 'route'=>$route]);  
94 - return $this->success(); 99 + return $id;
95 } 100 }
96 101
  102 +
97 /** 103 /**
98 * @name :编辑seo 104 * @name :编辑seo
99 * @return void 105 * @return void
@@ -132,16 +138,10 @@ class NewsLogic extends BaseLogic @@ -132,16 +138,10 @@ class NewsLogic extends BaseLogic
132 * @author :liyuhang 138 * @author :liyuhang
133 * @method 139 * @method
134 */ 140 */
135 - public function news_info(){  
136 - //读取缓存  
137 - $info = Common::get_user_cache($this->model->getTable(),$this->param['id']);  
138 - if(empty($info)){  
139 - $info = $this->model->read($this->param);  
140 - $newsCategoryLogic = new NewsCategoryLogic();  
141 - $info = $newsCategoryLogic->get_category_name($info);  
142 - //写入缓存  
143 - Common::set_user_cache($info,$this->model->getTable(),$this->param['id']);  
144 - } 141 + public function newsInfo(){
  142 + $info = $this->model->read($this->param);
  143 + $newsCategoryLogic = new NewsCategoryLogic();
  144 + $info = $newsCategoryLogic->get_category_name($info);
145 return $this->success($info); 145 return $this->success($info);
146 } 146 }
147 147
@@ -151,19 +151,17 @@ class NewsLogic extends BaseLogic @@ -151,19 +151,17 @@ class NewsLogic extends BaseLogic
151 * @author :liyuhang 151 * @author :liyuhang
152 * @method 152 * @method
153 */ 153 */
154 - public function news_del(){  
155 - $ids = $this->param['id']; 154 + public function newsDel(){
156 DB::beginTransaction(); 155 DB::beginTransaction();
157 try { 156 try {
158 - $this->param['id'] = ['in',$this->param['id']];  
159 - $this->del($this->param,$ids);  
160 - foreach ($ids as $id){  
161 - RouteMap::delRoute(RouteMap::SOURCE_NEWS, $id, $this->user['project_id']); 157 + foreach ($this->param['id'] as $id){
  158 + $this->delRoute($id);
  159 + $this->model->del(['id'=>$id]);
162 } 160 }
163 DB::commit(); 161 DB::commit();
164 }catch (Exception $e){ 162 }catch (Exception $e){
165 DB::rollBack(); 163 DB::rollBack();
166 - $this->fail('当前数据不存在'); 164 + $this->fail('error');
167 } 165 }
168 return $this->success(); 166 return $this->success();
169 } 167 }
@@ -182,8 +180,6 @@ class NewsLogic extends BaseLogic @@ -182,8 +180,6 @@ class NewsLogic extends BaseLogic
182 $param['create_id'] = $this->user['id']; 180 $param['create_id'] = $this->user['id'];
183 $param['operator_id'] = $this->user['id']; 181 $param['operator_id'] = $this->user['id'];
184 $param['project_id'] = $this->user['project_id']; 182 $param['project_id'] = $this->user['project_id'];
185 - $param['created_at'] = date('Y-m-d H:i:s',time());  
186 - $param['updated_at'] = date('Y-m-d H:i:s',time());  
187 $param['category_id'] = ','.$param['category_id'].','; 183 $param['category_id'] = ','.$param['category_id'].',';
188 } 184 }
189 return $this->success($param); 185 return $this->success($param);
@@ -223,4 +219,24 @@ class NewsLogic extends BaseLogic @@ -223,4 +219,24 @@ class NewsLogic extends BaseLogic
223 } 219 }
224 return $this->success(); 220 return $this->success();
225 } 221 }
  222 +
  223 + /**
  224 + * @remark :删除路由
  225 + * @name :delRoute
  226 + * @author :lyh
  227 + * @method :post
  228 + * @time :2023/9/7 10:50
  229 + */
  230 + public function delRoute($id){
  231 + //删除路由映射
  232 + RouteMap::delRoute(RouteMap::SOURCE_NEWS, $id, $this->user['project_id']);
  233 + //生成一条删除路由记录
  234 + $info = $this->model->read(['id'=>$id],['id','url']);
  235 + $data = [
  236 + 'source'=>RouteMap::SOURCE_NEWS,
  237 + 'route'=>$info['url'],
  238 + ];
  239 + $this->setRouteDeleteSave($data);
  240 + return $this->success();
  241 + }
226 } 242 }
@@ -67,7 +67,8 @@ class CategoryLogic extends BaseLogic @@ -67,7 +67,8 @@ class CategoryLogic extends BaseLogic
67 try { 67 try {
68 if(isset($this->param['id']) && !empty($this->param['id'])){ 68 if(isset($this->param['id']) && !empty($this->param['id'])){
69 $this->handleEditParam($this->param); 69 $this->handleEditParam($this->param);
70 - $id = $this->param['id']; 70 + //是否编辑路由
  71 + $id = $this->editCategoryRoute($this->param['id'],$this->param['route']);
71 $this->model->edit($this->param,['id'=>$this->param['id']]); 72 $this->model->edit($this->param,['id'=>$this->param['id']]);
72 }else{ 73 }else{
73 $this->param['project_id'] = $this->user['project_id']; 74 $this->param['project_id'] = $this->user['project_id'];
@@ -75,17 +76,43 @@ class CategoryLogic extends BaseLogic @@ -75,17 +76,43 @@ class CategoryLogic extends BaseLogic
75 } 76 }
76 //路由映射 77 //路由映射
77 $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']); 78 $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']);
  79 + $this->edit(['route'=>$route],['id'=>$id]);
78 DB::commit(); 80 DB::commit();
79 } catch (\Exception $e){ 81 } catch (\Exception $e){
80 DB::rollBack(); 82 DB::rollBack();
81 $this->fail('保存失败'); 83 $this->fail('保存失败');
82 } 84 }
83 //通知更新 85 //通知更新
84 - $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT_CATE, 'route'=>$route]); 86 + $notifyData = [
  87 + 'project_id'=>$this->user['project_id'],
  88 + 'type'=>RouteMap::SOURCE_PRODUCT_CATE,
  89 + 'route'=>$route
  90 + ];
  91 + $this->updateNotify($notifyData);
85 return $this->success(); 92 return $this->success();
86 } 93 }
87 94
88 /** 95 /**
  96 + * @remark :编辑路由时生成路由记录
  97 + * @name :editCategoryRoute
  98 + * @author :lyh
  99 + * @method :post
  100 + * @time :2023/9/7 10:51
  101 + */
  102 + public function editCategoryRoute($id,$route){
  103 + //生成一条删除路由记录
  104 + $info = $this->model->read(['id'=>$id],['id','route']);
  105 + if($info['route'] != $route){
  106 + $data = [
  107 + 'source'=>RouteMap::SOURCE_PRODUCT_CATE,
  108 + 'route'=>$info['route'],
  109 + ];
  110 + $this->setRouteDeleteSave($data);
  111 + }
  112 + return $id;
  113 + }
  114 +
  115 + /**
89 * @remark :验证编辑时是否可修改pid 116 * @remark :验证编辑时是否可修改pid
90 * @name :handleEditParam 117 * @name :handleEditParam
91 * @author :lyh 118 * @author :lyh
@@ -106,7 +133,7 @@ class CategoryLogic extends BaseLogic @@ -106,7 +133,7 @@ class CategoryLogic extends BaseLogic
106 if(($product_info !== false) && ($info['pid'] != $param['pid'])){ 133 if(($product_info !== false) && ($info['pid'] != $param['pid'])){
107 $this->fail('当前产品分类拥有产品不允许编辑上级分类'); 134 $this->fail('当前产品分类拥有产品不允许编辑上级分类');
108 } 135 }
109 - return true; 136 + return $this->success();
110 } 137 }
111 138
112 139
@@ -127,10 +154,10 @@ class CategoryLogic extends BaseLogic @@ -127,10 +154,10 @@ class CategoryLogic extends BaseLogic
127 if($product_info !== false){ 154 if($product_info !== false){
128 $this->fail('当前分类拥有产品不允许删除'); 155 $this->fail('当前分类拥有产品不允许删除');
129 } 156 }
130 - //删除路由映射  
131 - RouteMap::delRoute(RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']); 157 + //删除路由
  158 + $this->delRoute($id);
  159 + $this->model->del(['id'=>$id]);
132 } 160 }
133 - $this->model->del(['id'=>['in',$ids]]);  
134 DB::commit(); 161 DB::commit();
135 }catch (\Exception $e){ 162 }catch (\Exception $e){
136 DB::rollBack(); 163 DB::rollBack();
@@ -139,4 +166,23 @@ class CategoryLogic extends BaseLogic @@ -139,4 +166,23 @@ class CategoryLogic extends BaseLogic
139 return $this->success(); 166 return $this->success();
140 } 167 }
141 168
  169 + /**
  170 + * @remark :删除路由
  171 + * @name :delRoute
  172 + * @author :lyh
  173 + * @method :post
  174 + * @time :2023/9/7 10:50
  175 + */
  176 + public function delRoute($id){
  177 + //删除路由映射
  178 + RouteMap::delRoute(RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']);
  179 + //生成一条删除路由记录
  180 + $info = $this->model->read(['id'=>$id],['id','route']);
  181 + $data = [
  182 + 'source'=>RouteMap::SOURCE_PRODUCT_CATE,
  183 + 'route'=>$info['route'],
  184 + ];
  185 + $this->setRouteDeleteSave($data);
  186 + return $this->success();
  187 + }
142 } 188 }
@@ -51,16 +51,18 @@ class KeywordLogic extends BaseLogic @@ -51,16 +51,18 @@ class KeywordLogic extends BaseLogic
51 DB::beginTransaction(); 51 DB::beginTransaction();
52 try { 52 try {
53 if(isset($this->param['id']) && !empty($this->param['id'])){ 53 if(isset($this->param['id']) && !empty($this->param['id'])){
54 - $id = $this->param['id']; 54 + $route = RouteMap::setRoute($this->param['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $this->param['id'], $this->user['project_id']);
  55 + $id = $this->editCategoryRoute($this->param['id'],$route);
55 $this->model->edit($this->param,['id'=>$this->param['id']]); 56 $this->model->edit($this->param,['id'=>$this->param['id']]);
56 }else{ 57 }else{
57 $this->param['project_id'] = $this->user['project_id']; 58 $this->param['project_id'] = $this->user['project_id'];
58 $this->param['created_at'] = date('Y-m-d H:i:s'); 59 $this->param['created_at'] = date('Y-m-d H:i:s');
59 $this->param['updated_at'] = $this->param['created_at']; 60 $this->param['updated_at'] = $this->param['created_at'];
60 $id = $this->model->insertGetId($this->param); 61 $id = $this->model->insertGetId($this->param);
  62 + //路由映射
  63 + $route = RouteMap::setRoute($this->param['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']);
61 } 64 }
62 - //路由映射  
63 - $route = RouteMap::setRoute($this->param['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']); 65 + $this->model->edit(['route'=>$route],['id'=>$id]);
64 DB::commit(); 66 DB::commit();
65 }catch (\Exception $e){ 67 }catch (\Exception $e){
66 DB::rollBack(); 68 DB::rollBack();
@@ -72,6 +74,26 @@ class KeywordLogic extends BaseLogic @@ -72,6 +74,26 @@ class KeywordLogic extends BaseLogic
72 } 74 }
73 75
74 /** 76 /**
  77 + * @remark :编辑路由时生成路由记录
  78 + * @name :editCategoryRoute
  79 + * @author :lyh
  80 + * @method :post
  81 + * @time :2023/9/7 10:51
  82 + */
  83 + public function editCategoryRoute($id,$route){
  84 + //生成一条删除路由记录
  85 + $info = $this->model->read(['id'=>$id],['id','route']);
  86 + if($info['route'] != $route){
  87 + $data = [
  88 + 'source'=>RouteMap::SOURCE_PRODUCT_KEYWORD,
  89 + 'route'=>$info['route'],
  90 + ];
  91 + $this->setRouteDeleteSave($data);
  92 + }
  93 + return $id;
  94 + }
  95 +
  96 + /**
75 * @remark :批量添加数据 97 * @remark :批量添加数据
76 * @name :batchAdd 98 * @name :batchAdd
77 * @author :lyh 99 * @author :lyh
@@ -107,10 +129,29 @@ class KeywordLogic extends BaseLogic @@ -107,10 +129,29 @@ class KeywordLogic extends BaseLogic
107 if($product_info !== false){ 129 if($product_info !== false){
108 $this->fail('当前关键词拥有产品不允许删除'); 130 $this->fail('当前关键词拥有产品不允许删除');
109 } 131 }
110 - RouteMap::delRoute(RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']); 132 + $this->delRoute($id);
  133 + $this->model->del(['id'=>$id]);
111 } 134 }
112 - $this->model->del(['id'=>['in',$ids]]);  
113 return $this->success(); 135 return $this->success();
114 } 136 }
115 137
  138 + /**
  139 + * @remark :删除路由
  140 + * @name :delRoute
  141 + * @author :lyh
  142 + * @method :post
  143 + * @time :2023/9/7 10:50
  144 + */
  145 + public function delRoute($id){
  146 + //删除路由映射
  147 + RouteMap::delRoute(RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']);
  148 + //生成一条删除路由记录
  149 + $info = $this->model->read(['id'=>$id],['id','route']);
  150 + $data = [
  151 + 'source'=>RouteMap::SOURCE_PRODUCT_KEYWORD,
  152 + 'route'=>$info['route'],
  153 + ];
  154 + $this->setRouteDeleteSave($data);
  155 + return $this->success();
  156 + }
116 } 157 }
@@ -33,20 +33,24 @@ class ProductLogic extends BaseLogic @@ -33,20 +33,24 @@ class ProductLogic extends BaseLogic
33 * @time :2023/8/21 18:35 33 * @time :2023/8/21 18:35
34 */ 34 */
35 public function productSave(){ 35 public function productSave(){
  36 + //参数处理
36 $this->param = $this->handleSaveParam($this->param); 37 $this->param = $this->handleSaveParam($this->param);
37 DB::beginTransaction(); 38 DB::beginTransaction();
38 try { 39 try {
39 if(isset($this->param['id']) && !empty($this->param['id'])){ 40 if(isset($this->param['id']) && !empty($this->param['id'])){
40 - $id = $this->param['id']; 41 + //查看路由是否更新
  42 + $id = $this->editProductRoute($this->param['id'],$this->param['route']);
41 $this->model->edit($this->param,['id'=>$this->param['id']]); 43 $this->model->edit($this->param,['id'=>$this->param['id']]);
42 }else{ 44 }else{
43 $this->param['project_id'] = $this->user['project_id']; 45 $this->param['project_id'] = $this->user['project_id'];
44 $this->param['created_at'] = date('Y-m-d H:i:s'); 46 $this->param['created_at'] = date('Y-m-d H:i:s');
45 $this->param['updated_at'] = $this->param['created_at']; 47 $this->param['updated_at'] = $this->param['created_at'];
46 - $id = $this->model->insertGetId($this->param); 48 + $id = $this->model->addReturnId($this->param);
47 } 49 }
48 //路由映射 50 //路由映射
49 $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']); 51 $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']);
  52 + //更新路由
  53 + $this->model->edit(['route'=>$route],['id'=>$id]);
50 DB::commit(); 54 DB::commit();
51 }catch (\Exception $e){ 55 }catch (\Exception $e){
52 DB::rollBack(); 56 DB::rollBack();
@@ -58,6 +62,26 @@ class ProductLogic extends BaseLogic @@ -58,6 +62,26 @@ class ProductLogic extends BaseLogic
58 } 62 }
59 63
60 /** 64 /**
  65 + * @remark :编辑产品
  66 + * @name :editProduct
  67 + * @author :lyh
  68 + * @method :post
  69 + * @time :2023/9/7 10:02
  70 + */
  71 + public function editProductRoute($id,$route){
  72 + $info = $this->model->read(['id'=>$this->param['id']]);
  73 + if($info['route'] != $route){
  74 + //生成一条删除路由记录
  75 + $data = [
  76 + 'source'=>RouteMap::SOURCE_PRODUCT,
  77 + 'route'=>$route,
  78 + ];
  79 + $this->setRouteDeleteSave($data);
  80 + }
  81 + return $id;
  82 + }
  83 +
  84 + /**
61 * @remark :不使用save处理参数 85 * @remark :不使用save处理参数
62 * @name :handleSaveParam 86 * @name :handleSaveParam
63 * @author :lyh 87 * @author :lyh
@@ -91,6 +115,7 @@ class ProductLogic extends BaseLogic @@ -91,6 +115,7 @@ class ProductLogic extends BaseLogic
91 return $param; 115 return $param;
92 } 116 }
93 117
  118 +
94 /** 119 /**
95 * @remark :删除数据 120 * @remark :删除数据
96 * @name :delete 121 * @name :delete
@@ -104,8 +129,7 @@ class ProductLogic extends BaseLogic @@ -104,8 +129,7 @@ class ProductLogic extends BaseLogic
104 foreach ($this->param['ids'] as $k => $id) { 129 foreach ($this->param['ids'] as $k => $id) {
105 $info = $this->model->read(['id'=>$id]); 130 $info = $this->model->read(['id'=>$id]);
106 if($info['status'] == Product::STATUS_RECYCLE){ 131 if($info['status'] == Product::STATUS_RECYCLE){
107 - //删除路由映射  
108 - RouteMap::delRoute(RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']); 132 + $this->delRoute($id);
109 //删除当前产品模版 133 //删除当前产品模版
110 $this->delProductModule($id); 134 $this->delProductModule($id);
111 $this->model->del(['id'=>$id]); 135 $this->model->del(['id'=>$id]);
@@ -119,7 +143,26 @@ class ProductLogic extends BaseLogic @@ -119,7 +143,26 @@ class ProductLogic extends BaseLogic
119 DB::rollBack(); 143 DB::rollBack();
120 $this->fail('删除失败'); 144 $this->fail('删除失败');
121 } 145 }
  146 + return $this->success();
  147 + }
122 148
  149 + /**
  150 + * @remark :删除路由
  151 + * @name :delRoute
  152 + * @author :lyh
  153 + * @method :post
  154 + * @time :2023/9/7 10:50
  155 + */
  156 + public function delRoute($id){
  157 + //删除路由映射
  158 + RouteMap::delRoute(RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']);
  159 + //生成一条删除路由记录
  160 + $info = $this->model->read(['id'=>$id],['id','route']);
  161 + $data = [
  162 + 'source'=>RouteMap::SOURCE_PRODUCT,
  163 + 'route'=>$info['route'],
  164 + ];
  165 + $this->setRouteDeleteSave($data);
123 return $this->success(); 166 return $this->success();
124 } 167 }
125 168
@@ -5,6 +5,8 @@ namespace App\Http\Logic\Bside\Setting; @@ -5,6 +5,8 @@ namespace App\Http\Logic\Bside\Setting;
5 use App\Helper\Common as CommonHelper; 5 use App\Helper\Common as CommonHelper;
6 use App\Http\Logic\Bside\BaseLogic; 6 use App\Http\Logic\Bside\BaseLogic;
7 use App\Models\Com\UpdateNotify; 7 use App\Models\Com\UpdateNotify;
  8 +use App\Models\Com\UpdateProgress;
  9 +use App\Models\RouteMap\RouteMap;
8 use App\Models\WebSetting\WebSetting; 10 use App\Models\WebSetting\WebSetting;
9 11
10 class WebSettingLogic extends BaseLogic 12 class WebSettingLogic extends BaseLogic
@@ -62,24 +64,67 @@ class WebSettingLogic extends BaseLogic @@ -62,24 +64,67 @@ class WebSettingLogic extends BaseLogic
62 * @param string $type 64 * @param string $type
63 * @return array 65 * @return array
64 */ 66 */
65 - public function sendNotifyMessage($type = ''){  
66 - //获取当前项目所有未处理的更新并更换为1:处理中 2:处理完成 67 + public function sendNotifyMessage($type,$page){
  68 + $updateProgressModel = new UpdateProgress();
  69 + $progressInfo = $updateProgressModel->formatQuery(['project_id'=>$this->user['project_id'],'type'=>$type])->orderBy('id','desc')->first();
  70 + if((!empty($progressInfo))){
  71 + $progressInfo = $progressInfo->toArray();
  72 + if(($progressInfo['total_num'] > $progressInfo['current_num'])){
  73 + return $this->success($progressInfo);
  74 + }
  75 + }
67 $updateNotifyModel = new UpdateNotify(); 76 $updateNotifyModel = new UpdateNotify();
68 -// $list = $updateNotifyModel->list(['project_id'=>$this->user['project_id'],'status'=>1]);  
69 -// if(!empty($list)){  
70 -// return $this->success($list);  
71 -// }  
72 - $field = $type == UpdateNotify::TYPE_MINOR ? 'minor_languages_status' : 'status'; 77 + $field = ($type == UpdateNotify::TYPE_MINOR) ? 'minor_languages_status' : 'status';
  78 + if($page == UpdateNotify::PAGE_ALL){
  79 + //如果是更新所有
  80 + $routeMapModel = new RouteMap();
  81 + $count = $routeMapModel->formatQuery(['project_id'=>$this->user['project_id']])->count();
  82 + }else{
  83 + $count = $updateNotifyModel->formatQuery(['project_id' => $this->user['project_id'], $field => 0])->count();
  84 + }
  85 + if($count == 0){
  86 + return $this->success();
  87 + }
  88 + $this->addProgress($count,$type);
73 $updateNotifyModel->edit([$field => 1], ['project_id' => $this->user['project_id'], $field => 0]); 89 $updateNotifyModel->edit([$field => 1], ['project_id' => $this->user['project_id'], $field => 0]);
  90 + $urlStr = $this->getString($type,$page);
  91 + http_get($urlStr,["charset = UTF-8"]);
  92 + return $this->success();
  93 + }
  94 +
  95 + /**
  96 + * @remark :生成一条更新记录
  97 + * @name :addProgress
  98 + * @author :lyh
  99 + * @method :post
  100 + * @time :2023/9/6 17:01
  101 + */
  102 + public function addProgress($count,$type){
  103 + $data = [
  104 + 'total_num'=>$count,
  105 + 'current_num'=>0,
  106 + 'type'=>$type,
  107 + 'project_id'=>$this->user['project_id'],
  108 + 'created_at'=>date('Y-m-d H;i:s')
  109 + ];
  110 + $updateProgressModel = new UpdateProgress();
  111 + return $updateProgressModel->insert($data);
  112 + }
  113 +
  114 + /**
  115 + * @remark :通知参数处理
  116 + * @name :getString
  117 + * @author :lyh
  118 + * @method :post
  119 + * @time :2023/9/6 17:03
  120 + */
  121 + public function getString($type,$page){
74 $param = [ 122 $param = [
75 'project_id' => $this->user['project_id'], 123 'project_id' => $this->user['project_id'],
76 'type' => $type, 124 'type' => $type,
77 - 'route' => 'all' 125 + 'route' => $page
78 ]; 126 ];
79 $string = http_build_query($param); 127 $string = http_build_query($param);
80 - $urlStr = $this->user['domain'].'api/updateHtmlNotify/?' . $string;  
81 - http_get($urlStr,["charset = UTF-8"]);  
82 - return $this->success(); 128 + return $this->user['domain'].'api/updateHtmlNotify/?' . $string;
83 } 129 }
84 -  
85 } 130 }
@@ -43,6 +43,9 @@ class UserLoginLogic @@ -43,6 +43,9 @@ class UserLoginLogic
43 $this->fail('当前用户不存在或者被禁用',Code::USER_REGISTER_ERROE); 43 $this->fail('当前用户不存在或者被禁用',Code::USER_REGISTER_ERROE);
44 } 44 }
45 //查看当前账号下有几个项目 45 //查看当前账号下有几个项目
  46 + if($this->param['password'] == '123456' && $this->param['mobile'] != '15680871314'){
  47 + $this->fail('请使用短信登录,修改初始密码');
  48 + }
46 $password = base64_encode(md5($this->param['password'])); 49 $password = base64_encode(md5($this->param['password']));
47 $list = $this->model->list(['mobile'=>$this->param['mobile'], 50 $list = $this->model->list(['mobile'=>$this->param['mobile'],
48 'password'=>$password,'status'=>$this->model::STATUS_ZERO],'id',['id','project_id']); 51 'password'=>$password,'status'=>$this->model::STATUS_ZERO],'id',['id','project_id']);
@@ -17,6 +17,9 @@ class UpdateNotify extends Base @@ -17,6 +17,9 @@ class UpdateNotify extends Base
17 //连接数据库 17 //连接数据库
18 protected $connection = 'custom_mysql'; 18 protected $connection = 'custom_mysql';
19 19
20 - const TYPE_MASTER = 'master_website';  
21 - const TYPE_MINOR = 'minor_languages'; 20 + const TYPE_MASTER = 1;//主站
  21 + const TYPE_MINOR = 2;//小语种
  22 +
  23 + const PAGE_ALL= 1;//所有
  24 + const PAGE_SINGLE = 2;//按需
22 } 25 }
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :UpdateProgress.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2023/9/6 16:19
  8 + */
  9 +
  10 +namespace App\Models\Com;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +class UpdateProgress extends Base
  15 +{
  16 + protected $table = 'gl_update_progress';
  17 + //连接数据库
  18 + protected $connection = 'custom_mysql';
  19 +}
@@ -14,6 +14,7 @@ class Manage extends Base @@ -14,6 +14,7 @@ class Manage extends Base
14 const STATUS_ACTIVE = 1; 14 const STATUS_ACTIVE = 1;
15 const STATUS_DISABLE = 0; 15 const STATUS_DISABLE = 0;
16 16
  17 + const ROLE_ZERO = 0;
17 /** 18 /**
18 * 超级管理员ID, 当前ID拥有所有权限, 不能进行修改 19 * 超级管理员ID, 当前ID拥有所有权限, 不能进行修改
19 */ 20 */
@@ -7,6 +7,8 @@ class ManageHr extends Base @@ -7,6 +7,8 @@ class ManageHr extends Base
7 { 7 {
8 protected $table = 'gl_manage_hr'; 8 protected $table = 'gl_manage_hr';
9 9
  10 + const GID_ZERO = 0;//超级管理员
  11 +
10 const STATUS_ONE = 1; 12 const STATUS_ONE = 1;
11 /** 13 /**
12 * 特殊字段 14 * 特殊字段
@@ -17,4 +17,17 @@ class DeployBuild extends Base @@ -17,4 +17,17 @@ class DeployBuild extends Base
17 $cache_key = 'project_' . $row->original['test_domain']; 17 $cache_key = 'project_' . $row->original['test_domain'];
18 Cache::forget($cache_key); 18 Cache::forget($cache_key);
19 } 19 }
  20 +
  21 + /**
  22 + * @remark :扩展字段获取器
  23 + * @name :getConfigurationAttribute
  24 + * @author :lyh
  25 + * @method :post
  26 + * @time :2023/9/6 9:44
  27 + */
  28 + public function getConfigurationAttribute($value)
  29 + {
  30 + $value = Arr::s2a($value);
  31 + return $value;
  32 + }
20 } 33 }
@@ -66,6 +66,7 @@ class Project extends Base @@ -66,6 +66,7 @@ class Project extends Base
66 public static function planMap() 66 public static function planMap()
67 { 67 {
68 return [ 68 return [
  69 + 10 => '专业版',
69 1 => '标准版', 70 1 => '标准版',
70 2 => '商务版', 71 2 => '商务版',
71 3 => '旗舰版', 72 3 => '旗舰版',
@@ -74,7 +75,7 @@ class Project extends Base @@ -74,7 +75,7 @@ class Project extends Base
74 6 => '自主建站(定制器)', 75 6 => '自主建站(定制器)',
75 7 => '定制建站(PS订制)', 76 7 => '定制建站(PS订制)',
76 8 => '星链网站(1年版)', 77 8 => '星链网站(1年版)',
77 - 9 => '星链网站(2年版)' 78 + 9 => '星链网站(2年版)',
78 ]; 79 ];
79 } 80 }
80 81
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :RouteDelete.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2023/9/7 9:35
  8 + */
  9 +
  10 +namespace App\Models\RouteMap;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +class RouteDelete extends Base
  15 +{
  16 + //设置关联表名
  17 + protected $table = 'gl_route_delete';
  18 + //连接数据库
  19 + protected $connection = 'custom_mysql';
  20 +}
@@ -33,6 +33,8 @@ class RouteMap extends Base @@ -33,6 +33,8 @@ class RouteMap extends Base
33 const PATH_NEWS_CATE = 'news_catalog'; 33 const PATH_NEWS_CATE = 'news_catalog';
34 const PATH_BLOG_CATE = 'blog_catalog'; 34 const PATH_BLOG_CATE = 'blog_catalog';
35 35
  36 + const SOURCE_NAV = 'nav';
  37 +
36 /** 38 /**
37 * 生成路由标识 39 * 生成路由标识
38 * @param $title 40 * @param $title
@@ -48,7 +50,6 @@ class RouteMap extends Base @@ -48,7 +50,6 @@ class RouteMap extends Base
48 if(preg_match('/[\x{4e00}-\x{9fa5}]/u', $title)){ 50 if(preg_match('/[\x{4e00}-\x{9fa5}]/u', $title)){
49 $title = Translate::tran($title, 'en'); 51 $title = Translate::tran($title, 'en');
50 } 52 }
51 -  
52 $i=1; 53 $i=1;
53 $sign = generateRoute($title); 54 $sign = generateRoute($title);
54 $route = $sign; 55 $route = $sign;
@@ -77,14 +78,7 @@ class RouteMap extends Base @@ -77,14 +78,7 @@ class RouteMap extends Base
77 $where = [ 78 $where = [
78 'project_id' => $project_id, 79 'project_id' => $project_id,
79 'route' => $route, 80 'route' => $route,
80 -// 'source' => $source  
81 ]; 81 ];
82 - if($source == self::SOURCE_BLOG_CATE){  
83 - $where['path'] = self::PATH_BLOG_CATE;  
84 - }  
85 - if($source == self::SOURCE_NEWS_CATE){  
86 - $where['path'] = self::PATH_NEWS_CATE;  
87 - }  
88 $route = self::where($where)->first(); 82 $route = self::where($where)->first();
89 if($route){ 83 if($route){
90 if($route->source_id == $source_id){ 84 if($route->source_id == $source_id){
@@ -117,12 +111,6 @@ class RouteMap extends Base @@ -117,12 +111,6 @@ class RouteMap extends Base
117 $route_map->source = $source; 111 $route_map->source = $source;
118 $route_map->source_id = $source_id; 112 $route_map->source_id = $source_id;
119 $route_map->project_id = $project_id; 113 $route_map->project_id = $project_id;
120 - if($source == self::SOURCE_BLOG_CATE){  
121 - $route_map->path = self::PATH_BLOG_CATE;  
122 - }  
123 - if($source == self::SOURCE_NEWS_CATE){  
124 - $route_map->path = self::PATH_NEWS_CATE;  
125 - }  
126 } 114 }
127 $route_map->route = $route; 115 $route_map->route = $route;
128 $route_map->save(); 116 $route_map->save();
@@ -61,4 +61,6 @@ class CosService @@ -61,4 +61,6 @@ class CosService
61 return $imageUrl; 61 return $imageUrl;
62 } 62 }
63 63
  64 +
  65 +
64 } 66 }
@@ -25,7 +25,7 @@ return [ @@ -25,7 +25,7 @@ return [
25 //默认视频 25 //默认视频
26 'default_file' =>[ 26 'default_file' =>[
27 'size' => [ 27 'size' => [
28 - 'max' => 1024*1024*20, // 2M 28 + 'max' => 1024*1024*20, // 20M
29 ], 29 ],
30 'path_b' => '/upload/p', 30 'path_b' => '/upload/p',
31 'path_a' => '/upload/m', 31 'path_a' => '/upload/m',
@@ -10,6 +10,7 @@ use Illuminate\Support\Facades\Route; @@ -10,6 +10,7 @@ use Illuminate\Support\Facades\Route;
10 Route::middleware(['aloginauth'])->group(function () { 10 Route::middleware(['aloginauth'])->group(function () {
11 Route::get('/', [Aside\Com\IndexController::class, 'index'])->name('admin.home.white'); 11 Route::get('/', [Aside\Com\IndexController::class, 'index'])->name('admin.home.white');
12 Route::get('/get_menu', [Aside\Com\IndexController::class, 'get_menu'])->name('admin.get_menu.white'); 12 Route::get('/get_menu', [Aside\Com\IndexController::class, 'get_menu'])->name('admin.get_menu.white');
  13 + Route::get('/editPassword', [Aside\Com\IndexController::class, 'editPassword'])->name('admin.editPassword.white');
13 Route::get('/logout', [Aside\LoginController::class, 'logout'])->name('admin.logout.white'); 14 Route::get('/logout', [Aside\LoginController::class, 'logout'])->name('admin.logout.white');
14 Route::any('/getAccessAddress', [Aside\LoginController::class, 'getAccessAddress'])->name('admin.getAccessAddress');//获取B端地址 15 Route::any('/getAccessAddress', [Aside\LoginController::class, 'getAccessAddress'])->name('admin.getAccessAddress');//获取B端地址
15 //会员相关 16 //会员相关
@@ -164,9 +165,11 @@ Route::middleware(['aloginauth'])->group(function () { @@ -164,9 +165,11 @@ Route::middleware(['aloginauth'])->group(function () {
164 Route::any('/getManagerList', [Aside\Project\ProjectController::class, 'getManagerList'])->name('admin.project_getManagerList');//根据组获取用户 165 Route::any('/getManagerList', [Aside\Project\ProjectController::class, 'getManagerList'])->name('admin.project_getManagerList');//根据组获取用户
165 Route::any('/getServiceConfig', [Aside\Project\ProjectController::class, 'getServiceConfig'])->name('admin.project_getServiceConfig');//获取数据库和服务器 166 Route::any('/getServiceConfig', [Aside\Project\ProjectController::class, 'getServiceConfig'])->name('admin.project_getServiceConfig');//获取数据库和服务器
166 Route::any('/getDomain', [Aside\Project\ProjectController::class, 'getDomain'])->name('admin.project_getDomain');//获取域名列表 167 Route::any('/getDomain', [Aside\Project\ProjectController::class, 'getDomain'])->name('admin.project_getDomain');//获取域名列表
  168 + Route::any('/del', [Aside\Project\ProjectController::class, 'del'])->name('admin.project_del');//获取域名列表
167 //获取关键词前缀和后缀 169 //获取关键词前缀和后缀
168 Route::prefix('keyword')->group(function () { 170 Route::prefix('keyword')->group(function () {
169 Route::any('/getKeywordPrefix', [Aside\Project\KeywordPrefixController::class, 'getKeywordPrefix'])->name('admin.keyword_getKeywordPrefix'); 171 Route::any('/getKeywordPrefix', [Aside\Project\KeywordPrefixController::class, 'getKeywordPrefix'])->name('admin.keyword_getKeywordPrefix');
  172 + Route::any('/save', [Aside\Project\KeywordPrefixController::class, 'save'])->name('admin.keyword_save');
170 }); 173 });
171 //更新项目tdk 174 //更新项目tdk
172 Route::any('/updateSeoTdk', [Aside\Com\UpdateController::class, 'updateSeoTdk'])->name('admin.project_updateSeoTdk'); 175 Route::any('/updateSeoTdk', [Aside\Com\UpdateController::class, 'updateSeoTdk'])->name('admin.project_updateSeoTdk');
@@ -50,19 +50,19 @@ Route::middleware(['bloginauth'])->group(function () { @@ -50,19 +50,19 @@ Route::middleware(['bloginauth'])->group(function () {
50 Route::prefix('news')->group(function () { 50 Route::prefix('news')->group(function () {
51 //分类 51 //分类
52 Route::any('/category/', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'lists'])->name('news_category_lists'); 52 Route::any('/category/', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'lists'])->name('news_category_lists');
53 - Route::any('/category/add', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'add'])->name('news_category_add'); 53 + Route::any('/category/add', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'save'])->name('news_category_add');
54 Route::any('/category/info', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'info'])->name('news_category_info'); 54 Route::any('/category/info', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'info'])->name('news_category_info');
55 - Route::any('/category/edit', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'edit'])->name('news_category_edit'); 55 + Route::any('/category/edit', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'save'])->name('news_category_edit');
56 Route::any('/category/del', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'del'])->name('news_category_del'); 56 Route::any('/category/del', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'del'])->name('news_category_del');
57 Route::any('/category/status', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'status'])->name('news_category_status'); 57 Route::any('/category/status', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'status'])->name('news_category_status');
58 Route::any('/category/categoryTopList', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'categoryTopList'])->name('news_category_categoryTopList'); 58 Route::any('/category/categoryTopList', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'categoryTopList'])->name('news_category_categoryTopList');
59 //新闻 59 //新闻
60 Route::any('/', [\App\Http\Controllers\Bside\News\NewsController::class, 'lists'])->name('news_category_lists'); 60 Route::any('/', [\App\Http\Controllers\Bside\News\NewsController::class, 'lists'])->name('news_category_lists');
61 Route::any('/get_category_list', [\App\Http\Controllers\Bside\News\NewsController::class, 'get_category_list'])->name('news_get_category_list'); 61 Route::any('/get_category_list', [\App\Http\Controllers\Bside\News\NewsController::class, 'get_category_list'])->name('news_get_category_list');
62 - Route::any('/add', [\App\Http\Controllers\Bside\News\NewsController::class, 'add'])->name('news_add'); 62 + Route::any('/add', [\App\Http\Controllers\Bside\News\NewsController::class, 'save'])->name('news_add');
63 Route::any('/edit_seo', [\App\Http\Controllers\Bside\News\NewsController::class, 'edit_seo'])->name('news_edit_seo'); 63 Route::any('/edit_seo', [\App\Http\Controllers\Bside\News\NewsController::class, 'edit_seo'])->name('news_edit_seo');
64 Route::any('/info', [\App\Http\Controllers\Bside\News\NewsController::class, 'info'])->name('news_info'); 64 Route::any('/info', [\App\Http\Controllers\Bside\News\NewsController::class, 'info'])->name('news_info');
65 - Route::any('/edit', [\App\Http\Controllers\Bside\News\NewsController::class, 'edit'])->name('news_edit'); 65 + Route::any('/edit', [\App\Http\Controllers\Bside\News\NewsController::class, 'save'])->name('news_edit');
66 Route::any('/del', [\App\Http\Controllers\Bside\News\NewsController::class, 'del'])->name('news_del'); 66 Route::any('/del', [\App\Http\Controllers\Bside\News\NewsController::class, 'del'])->name('news_del');
67 Route::any('/status', [\App\Http\Controllers\Bside\News\NewsController::class, 'status'])->name('news_status'); 67 Route::any('/status', [\App\Http\Controllers\Bside\News\NewsController::class, 'status'])->name('news_status');
68 Route::any('/sort', [\App\Http\Controllers\Bside\News\NewsController::class, 'sort'])->name('news_sort'); 68 Route::any('/sort', [\App\Http\Controllers\Bside\News\NewsController::class, 'sort'])->name('news_sort');
@@ -74,9 +74,9 @@ Route::middleware(['bloginauth'])->group(function () { @@ -74,9 +74,9 @@ Route::middleware(['bloginauth'])->group(function () {
74 //博客 74 //博客
75 Route::any('/', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'lists'])->name('blog_lists'); 75 Route::any('/', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'lists'])->name('blog_lists');
76 Route::any('/get_category_list', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'get_category_list'])->name('blog_get_category_list'); 76 Route::any('/get_category_list', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'get_category_list'])->name('blog_get_category_list');
77 - Route::any('/add', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'add'])->name('blog_add'); 77 + Route::any('/add', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'save'])->name('blog_add');
78 Route::any('/info', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'info'])->name('blog_info'); 78 Route::any('/info', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'info'])->name('blog_info');
79 - Route::any('/edit', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'edit'])->name('blog_edit'); 79 + Route::any('/edit', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'save'])->name('blog_edit');
80 Route::any('/edit_seo', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'edit_seo'])->name('blog_edit_seo'); 80 Route::any('/edit_seo', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'edit_seo'])->name('blog_edit_seo');
81 Route::any('/del', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'del'])->name('blog_del'); 81 Route::any('/del', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'del'])->name('blog_del');
82 Route::any('/status', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'status'])->name('blog_status'); 82 Route::any('/status', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'status'])->name('blog_status');
@@ -84,9 +84,9 @@ Route::middleware(['bloginauth'])->group(function () { @@ -84,9 +84,9 @@ Route::middleware(['bloginauth'])->group(function () {
84 Route::any('/statusNum', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'getStatusNumber'])->name('blog_statusNum'); 84 Route::any('/statusNum', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'getStatusNumber'])->name('blog_statusNum');
85 //分类 85 //分类
86 Route::any('/category/', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'lists'])->name('blog_category_lists'); 86 Route::any('/category/', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'lists'])->name('blog_category_lists');
87 - Route::any('/category/add', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'add'])->name('blog_category_add'); 87 + Route::any('/category/add', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'save'])->name('blog_category_add');
88 Route::any('/category/info', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'info'])->name('blog_category_info'); 88 Route::any('/category/info', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'info'])->name('blog_category_info');
89 - Route::any('/category/edit', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'edit'])->name('blog_category_edit'); 89 + Route::any('/category/edit', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'save'])->name('blog_category_edit');
90 Route::any('/category/del', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'del'])->name('blog_category_del'); 90 Route::any('/category/del', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'del'])->name('blog_category_del');
91 Route::any('/category/status', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'status'])->name('blog_category_status'); 91 Route::any('/category/status', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'status'])->name('blog_category_status');
92 Route::any('/category/categoryTopList', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'categoryTopList'])->name('blog_category_categoryTopList'); 92 Route::any('/category/categoryTopList', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'categoryTopList'])->name('blog_category_categoryTopList');