作者 赵彬吉

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