Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into develop
正在显示
14 个修改的文件
包含
256 行增加
和
51 行删除
| @@ -6,6 +6,7 @@ use App\Helper\Arr; | @@ -6,6 +6,7 @@ use App\Helper\Arr; | ||
| 6 | use App\Models\Product\Category; | 6 | use App\Models\Product\Category; |
| 7 | use App\Models\Product\Product; | 7 | use App\Models\Product\Product; |
| 8 | use App\Models\RouteMap\RouteMap; | 8 | use App\Models\RouteMap\RouteMap; |
| 9 | +use App\Services\ProjectServer; | ||
| 9 | use GuzzleHttp\Client; | 10 | use GuzzleHttp\Client; |
| 10 | use GuzzleHttp\Promise\Utils; | 11 | use GuzzleHttp\Promise\Utils; |
| 11 | use Illuminate\Console\Command; | 12 | use Illuminate\Console\Command; |
| @@ -230,20 +231,26 @@ class WebTraffic extends Command | @@ -230,20 +231,26 @@ class WebTraffic extends Command | ||
| 230 | */ | 231 | */ |
| 231 | protected function getProductUrls($project_id){ | 232 | protected function getProductUrls($project_id){ |
| 232 | //产品分类页面 | 233 | //产品分类页面 |
| 233 | - $product_cate_ids = Category::where('project_id', $project_id)->where('status', Category::STATUS_ACTIVE)->pluck('id')->toArray(); | ||
| 234 | - $data['urls_cats'] = RouteMap::where('project_id', $project_id)->where('source', RouteMap::SOURCE_PRODUCT_CATE)->whereIn('source_id', $product_cate_ids)->get()->toArray(); | 234 | + ProjectServer::useProject($project_id); |
| 235 | + $product_cate_ids = DB::connection('custom_mysql')->table('gl_product_category') | ||
| 236 | + ->where('project_id', $project_id)->where('status', 1)->pluck('id')->toArray(); | ||
| 237 | + $data['urls_cats'] = DB::connection('custom_mysql')->table('gl_route_map') | ||
| 238 | + ->where('project_id', $project_id)->where('source', 'product_category')->whereIn('source_id', $product_cate_ids)->get()->toArray(); | ||
| 235 | //单页面 | 239 | //单页面 |
| 236 | //todo 发布状态的单页面id | 240 | //todo 发布状态的单页面id |
| 237 | - $data['urls_page'] = RouteMap::where('project_id', $project_id)->where('source', RouteMap::SOURCE_PAGE)->get()->toArray(); | 241 | + $data['urls_page'] = DB::connection('custom_mysql')->table('gl_route_map') |
| 242 | + ->where('project_id', $project_id)->where('source', 'page')->get()->toArray(); | ||
| 238 | //产品详情页 | 243 | //产品详情页 |
| 239 | - $product_ids = Product::where('project_id', $project_id)->where('status', Product::STATUS_ON)->pluck('id')->toArray(); | ||
| 240 | - $data['urls_details'] = RouteMap::where('project_id', $project_id)->where('source', RouteMap::SOURCE_PRODUCT)->whereIn('source_id', $product_ids)->get()->toArray(); | 244 | + $product_ids = DB::connection('custom_mysql')->table('gl_product_category') |
| 245 | + ->where('project_id', $project_id)->where('status', 1)->pluck('id')->toArray(); | ||
| 246 | + $data['urls_details'] = DB::connection('custom_mysql')->table('gl_route_map') | ||
| 247 | + ->where('project_id', $project_id)->where('source', 'product')->whereIn('source_id', $product_ids)->get()->toArray(); | ||
| 241 | 248 | ||
| 242 | $data['urls_cats'] = array_merge($data['urls_cats'], $data['urls_page']); | 249 | $data['urls_cats'] = array_merge($data['urls_cats'], $data['urls_page']); |
| 243 | if(empty($data['urls_cats'])){ | 250 | if(empty($data['urls_cats'])){ |
| 244 | $data['urls_cats'] = $data['urls_details']; | 251 | $data['urls_cats'] = $data['urls_details']; |
| 245 | } | 252 | } |
| 246 | - | 253 | + DB::disconnect('custom_mysql'); |
| 247 | return $data; | 254 | return $data; |
| 248 | } | 255 | } |
| 249 | 256 | ||
| @@ -312,10 +319,10 @@ class WebTraffic extends Command | @@ -312,10 +319,10 @@ class WebTraffic extends Command | ||
| 312 | 319 | ||
| 313 | $url = []; | 320 | $url = []; |
| 314 | if($res_sdzb == 0){//深度一页 | 321 | if($res_sdzb == 0){//深度一页 |
| 315 | - $url[] = $project_urls[$res_ymzb] ? Arr::random($project_urls[$res_ymzb])['route'] : ''; | 322 | + $url[] = $project_urls[$res_ymzb] ? Arr::random($project_urls[$res_ymzb])->route : ''; |
| 316 | }elseif($res_sdzb == 1){//深度两页 | 323 | }elseif($res_sdzb == 1){//深度两页 |
| 317 | $url[] = $project_urls['home']; | 324 | $url[] = $project_urls['home']; |
| 318 | - $url[] = $project_urls[$res_ymzb] ? Arr::random($project_urls[$res_ymzb])['route'] : ''; | 325 | + $url[] = $project_urls[$res_ymzb] ? Arr::random($project_urls[$res_ymzb])->route : ''; |
| 319 | }elseif($res_sdzb == 2){//深度3-6页 | 326 | }elseif($res_sdzb == 2){//深度3-6页 |
| 320 | $yms = rand(2,5); //随机页面数 | 327 | $yms = rand(2,5); //随机页面数 |
| 321 | $url = Arr::pluck(Arr::random($all_url, $yms), 'route'); | 328 | $url = Arr::pluck(Arr::random($all_url, $yms), 'route'); |
| @@ -39,6 +39,7 @@ class BaseController extends Controller | @@ -39,6 +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 | $this->uid = $info['id']; | 43 | $this->uid = $info['id']; |
| 43 | } | 44 | } |
| 44 | } | 45 | } |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :ManagerLogController.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2023/9/5 16:09 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Controllers\Aside\Manage; | ||
| 11 | + | ||
| 12 | +use App\Enums\Common\Code; | ||
| 13 | +use App\Http\Controllers\Aside\BaseController; | ||
| 14 | +use App\Models\Manage\LoginLog; | ||
| 15 | +use App\Models\Manage\Manage; | ||
| 16 | + | ||
| 17 | +class ManagerLogController extends BaseController | ||
| 18 | +{ | ||
| 19 | + /** | ||
| 20 | + * @remark :管理员日志列表 | ||
| 21 | + * @name :lists | ||
| 22 | + * @author :lyh | ||
| 23 | + * @method :post | ||
| 24 | + * @time :2023/9/5 16:10 | ||
| 25 | + */ | ||
| 26 | + public function lists(LoginLog $manageLogin){ | ||
| 27 | + $map = $this->searchParam(); | ||
| 28 | + $lists = $manageLogin->lists($map,$this->page,$this->row,$this->order); | ||
| 29 | + if(!empty($lists) && !empty($lists['list'])){ | ||
| 30 | + $managerModel = new Manage(); | ||
| 31 | + foreach ($lists['list'] as $k => $v){ | ||
| 32 | + $info = $managerModel->read(['id'=>$v['manage_id']]); | ||
| 33 | + $v['mobile'] = $info['mobile'] ?? ''; | ||
| 34 | + $v['name'] = $info['name'] ?? ''; | ||
| 35 | + $v['type'] = (isset($v['type']) && $v['type'] == 1) ? '账号密码登录' : '验证码登录'; | ||
| 36 | + $lists['list'][$k] = $v; | ||
| 37 | + } | ||
| 38 | + } | ||
| 39 | + $this->response('success',Code::SUCCESS,$lists); | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * @remark :搜索参数 | ||
| 44 | + * @name :searchParam | ||
| 45 | + * @author :lyh | ||
| 46 | + * @method :post | ||
| 47 | + * @time :2023/9/5 16:56 | ||
| 48 | + */ | ||
| 49 | + public function searchParam(){ | ||
| 50 | + $map = []; | ||
| 51 | + $managerModel = new Manage(); | ||
| 52 | + if(isset($this->map['mobile']) && !empty($this->map['mobile'])){ | ||
| 53 | + $ids = $managerModel->where('mobile', 'like', '%' . $this->map['mobile'] . '%')->pluck('id')->toArray(); | ||
| 54 | + $map['manage_id'] = ['in',$ids]; | ||
| 55 | + }elseif (isset($this->map['name']) && !empty($this->map['name'])){ | ||
| 56 | + $ids = $managerModel->where('name', 'like', '%' . $this->param['name'] . '%')->pluck('id')->toArray(); | ||
| 57 | + $map['manage_id'] = ['in',$ids]; | ||
| 58 | + } | ||
| 59 | + if(isset($this->map['created_at'])){ | ||
| 60 | + $map['created_at'] = $this->map['created_at']; | ||
| 61 | + } | ||
| 62 | + return $map; | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | +} |
| @@ -95,7 +95,9 @@ class OnlineController extends BaseController | @@ -95,7 +95,9 @@ class OnlineController extends BaseController | ||
| 95 | * @time :2023/8/18 14:44 | 95 | * @time :2023/8/18 14:44 |
| 96 | */ | 96 | */ |
| 97 | public function handleParam(&$item){ | 97 | public function handleParam(&$item){ |
| 98 | - $data = APublicModel::getNumByProjectId($item['id']); | 98 | + if($item['type'] != Project::TYPE_ZERO){ |
| 99 | + $data = APublicModel::getNumByProjectId($item['id']); | ||
| 100 | + } | ||
| 99 | $manageModel = new Manage(); | 101 | $manageModel = new Manage(); |
| 100 | $item['channel'] = Channel::getChannelText($item['channel']['user_id'] ?? 0); | 102 | $item['channel'] = Channel::getChannelText($item['channel']['user_id'] ?? 0); |
| 101 | $item['build_leader'] = $manageModel->getName($item['leader_mid']); | 103 | $item['build_leader'] = $manageModel->getName($item['leader_mid']); |
| @@ -5,6 +5,7 @@ namespace App\Http\Controllers\Aside\Optimize; | @@ -5,6 +5,7 @@ namespace App\Http\Controllers\Aside\Optimize; | ||
| 5 | use App\Enums\Common\Code; | 5 | use App\Enums\Common\Code; |
| 6 | use App\Http\Controllers\Aside\BaseController; | 6 | use App\Http\Controllers\Aside\BaseController; |
| 7 | use App\Http\Logic\Aside\Optimize\OptimizeLogic; | 7 | use App\Http\Logic\Aside\Optimize\OptimizeLogic; |
| 8 | +use App\Models\Domain\DomainInfo; | ||
| 8 | use App\Models\Manage\Manage; | 9 | use App\Models\Manage\Manage; |
| 9 | use App\Models\Project\Project; | 10 | use App\Models\Project\Project; |
| 10 | use Illuminate\Support\Facades\DB; | 11 | use Illuminate\Support\Facades\DB; |
| @@ -32,11 +33,13 @@ class OptimizeController extends BaseController | @@ -32,11 +33,13 @@ class OptimizeController extends BaseController | ||
| 32 | $lists = $query->paginate($this->row, $this->selectParam(), 'page', $this->page)->toArray(); | 33 | $lists = $query->paginate($this->row, $this->selectParam(), 'page', $this->page)->toArray(); |
| 33 | if(!empty($lists['list'])){ | 34 | if(!empty($lists['list'])){ |
| 34 | $manager = new Manage(); | 35 | $manager = new Manage(); |
| 36 | + $domainModel = new DomainInfo(); | ||
| 35 | foreach ($lists['list'] as $k => $v){ | 37 | foreach ($lists['list'] as $k => $v){ |
| 36 | $v['plan'] = $project::planMap()[$v['plan']]; | 38 | $v['plan'] = $project::planMap()[$v['plan']]; |
| 37 | $v['optimist_mid_name'] = $manager->getName($v['optimist_mid']); | 39 | $v['optimist_mid_name'] = $manager->getName($v['optimist_mid']); |
| 38 | $v['tech_mid_name'] = $manager->getName($v['tech_mid']); | 40 | $v['tech_mid_name'] = $manager->getName($v['tech_mid']); |
| 39 | $v['autologin_code'] = getAutoLoginCode($v['id']); | 41 | $v['autologin_code'] = getAutoLoginCode($v['id']); |
| 42 | + $v['domain'] = $domainModel->getDomain($v['domain']); | ||
| 40 | $lists['list'][$k] = $v; | 43 | $lists['list'][$k] = $v; |
| 41 | } | 44 | } |
| 42 | } | 45 | } |
| @@ -55,13 +55,15 @@ class ProjectController extends BaseController | @@ -55,13 +55,15 @@ class ProjectController extends BaseController | ||
| 55 | $map['type'] = $this->searchType($this->map['type']); | 55 | $map['type'] = $this->searchType($this->map['type']); |
| 56 | $map['extend_type'] = 0;//排除未续费项目 | 56 | $map['extend_type'] = 0;//排除未续费项目 |
| 57 | } | 57 | } |
| 58 | - $filed = ['id', 'title', 'mysql_id' ,'channel','cooperate_date' ,'type', 'created_at']; | ||
| 59 | - $lists = $project->formatQuery($map)->select($filed)->with('payment')->with('deploy_build') | 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); | 60 | ->with('deploy_optimize')->with('online_check')->paginate($this->row, ['*'], 'page', $this->page); |
| 61 | if(!empty($lists)){ | 61 | if(!empty($lists)){ |
| 62 | $lists = $lists->toArray(); | 62 | $lists = $lists->toArray(); |
| 63 | + $manageModel = new Manage(); | ||
| 64 | + $domainModel = new DomainInfo(); | ||
| 63 | foreach ($lists['list'] as $k=>$item){ | 65 | foreach ($lists['list'] as $k=>$item){ |
| 64 | - $item = $this->handleParam($item); | 66 | + $item = $this->handleParam($item,$manageModel,$domainModel); |
| 65 | $lists['list'][$k] = $item; | 67 | $lists['list'][$k] = $item; |
| 66 | } | 68 | } |
| 67 | } | 69 | } |
| @@ -75,8 +77,7 @@ class ProjectController extends BaseController | @@ -75,8 +77,7 @@ class ProjectController extends BaseController | ||
| 75 | * @method :post | 77 | * @method :post |
| 76 | * @time :2023/8/30 11:07 | 78 | * @time :2023/8/30 11:07 |
| 77 | */ | 79 | */ |
| 78 | - public function handleParam(&$item){ | ||
| 79 | - $manageModel = new Manage(); | 80 | + public function handleParam(&$item,&$manageModel,&$domainModel){ |
| 80 | if($item['mysql_id'] != 0 && $item['type'] != 0){ | 81 | if($item['mysql_id'] != 0 && $item['type'] != 0){ |
| 81 | $data = APublicModel::getNumByProjectId($item['id']); | 82 | $data = APublicModel::getNumByProjectId($item['id']); |
| 82 | } | 83 | } |
| @@ -98,7 +99,7 @@ class ProjectController extends BaseController | @@ -98,7 +99,7 @@ class ProjectController extends BaseController | ||
| 98 | 'type' => $item['type'], | 99 | 'type' => $item['type'], |
| 99 | 'test_domain' => $item['deploy_build']['test_domain'] ?? 0, | 100 | 'test_domain' => $item['deploy_build']['test_domain'] ?? 0, |
| 100 | 'plan' =>Project::planMap()[$item['deploy_build']['plan']], | 101 | 'plan' =>Project::planMap()[$item['deploy_build']['plan']], |
| 101 | - 'domain' => !empty($item['deploy_optimize']['domain']) ? (new DomainInfo())->getDomain($item['deploy_optimize']['domain']) : '', | 102 | + 'domain' => !empty($item['deploy_optimize']['domain']) ? $domainModel->getDomain($item['deploy_optimize']['domain']) : '', |
| 102 | 'created_at' => date('Y年m月d日', strtotime($item['created_at'])), | 103 | 'created_at' => date('Y年m月d日', strtotime($item['created_at'])), |
| 103 | 'product_num' => $data['product'] ?? 0, | 104 | 'product_num' => $data['product'] ?? 0, |
| 104 | 'keyword_num' => $item['deploy_build']['keyword_num'] ?? 0, | 105 | 'keyword_num' => $item['deploy_build']['keyword_num'] ?? 0, |
| @@ -107,31 +108,12 @@ class ProjectController extends BaseController | @@ -107,31 +108,12 @@ class ProjectController extends BaseController | ||
| 107 | 'task_pending_num' => Task::getNumByProjectId($item['id'], [Task::STATUS_DONGING, Task::STATUS_WAIT]), | 108 | 'task_pending_num' => Task::getNumByProjectId($item['id'], [Task::STATUS_DONGING, Task::STATUS_WAIT]), |
| 108 | 'optimist_status'=>$item['online_check']['optimist_status'] ?? 0, | 109 | 'optimist_status'=>$item['online_check']['optimist_status'] ?? 0, |
| 109 | 'qa_status'=>$item['online_check']['qa_status'] ?? 0, | 110 | 'qa_status'=>$item['online_check']['qa_status'] ?? 0, |
| 110 | - 'service_day'=>$item['deploy_build']['service_duration'] - $this->compliance_day($item['id']), | 111 | + 'service_day'=>$item['remain_day'] ?? 0, |
| 111 | ]; | 112 | ]; |
| 112 | return $item; | 113 | return $item; |
| 113 | } | 114 | } |
| 114 | 115 | ||
| 115 | /** | 116 | /** |
| 116 | - * @param $yesterday | ||
| 117 | - * @name :(服务达标天数)compliance_day | ||
| 118 | - * @author :lyh | ||
| 119 | - * @method :post | ||
| 120 | - * @time :2023/6/14 15:48 | ||
| 121 | - */ | ||
| 122 | - public function compliance_day($project_id){ | ||
| 123 | - //服务达标天数 | ||
| 124 | - $rankDataModel = new RankData(); | ||
| 125 | - $rank_info = $rankDataModel->where(['project_id'=>$project_id,'lang'=>''])->select(['compliance_day'])->first(); | ||
| 126 | - if(empty($rank_info)){ | ||
| 127 | - $compliance_day = 0; | ||
| 128 | - }else{ | ||
| 129 | - $compliance_day = $rank_info->compliance_day; | ||
| 130 | - } | ||
| 131 | - return $compliance_day; | ||
| 132 | - } | ||
| 133 | - | ||
| 134 | - /** | ||
| 135 | * @remark :type类型 | 117 | * @remark :type类型 |
| 136 | * @name :searchType | 118 | * @name :searchType |
| 137 | * @author :lyh | 119 | * @author :lyh |
| @@ -384,7 +366,7 @@ class ProjectController extends BaseController | @@ -384,7 +366,7 @@ class ProjectController extends BaseController | ||
| 384 | 'type.required' => '请选择审核类型' | 366 | 'type.required' => '请选择审核类型' |
| 385 | ]); | 367 | ]); |
| 386 | $belongGroupModel = new BelongingGroup(); | 368 | $belongGroupModel = new BelongingGroup(); |
| 387 | - $lists = $belongGroupModel->list($this->map,'id',['id','name','type'],'asc'); | 369 | + $lists = $belongGroupModel->list($this->map,'name',['id','name','type'],'asc'); |
| 388 | $this->response('success',Code::SUCCESS,$lists); | 370 | $this->response('success',Code::SUCCESS,$lists); |
| 389 | } | 371 | } |
| 390 | 372 |
| @@ -16,6 +16,7 @@ use App\Http\Logic\Aside\Project\ProjectLogic; | @@ -16,6 +16,7 @@ use App\Http\Logic\Aside\Project\ProjectLogic; | ||
| 16 | use App\Http\Logic\Aside\Project\RenewLogic; | 16 | use App\Http\Logic\Aside\Project\RenewLogic; |
| 17 | use App\Models\ASide\APublicModel; | 17 | use App\Models\ASide\APublicModel; |
| 18 | use App\Models\Channel\Channel; | 18 | use App\Models\Channel\Channel; |
| 19 | +use App\Models\Domain\DomainInfo; | ||
| 19 | use App\Models\HomeCount\Count; | 20 | use App\Models\HomeCount\Count; |
| 20 | use App\Models\Manage\Manage; | 21 | use App\Models\Manage\Manage; |
| 21 | use App\Models\Project\DeployBuild; | 22 | use App\Models\Project\DeployBuild; |
| @@ -39,13 +40,15 @@ class RenewProjectController extends BaseController | @@ -39,13 +40,15 @@ class RenewProjectController extends BaseController | ||
| 39 | $this->searchParam($map,$this->map,$arr); | 40 | $this->searchParam($map,$this->map,$arr); |
| 40 | //按类型搜索 | 41 | //按类型搜索 |
| 41 | $map['id'] = ['in', $arr]; | 42 | $map['id'] = ['in', $arr]; |
| 42 | - $filed = ['id', 'title', 'mysql_id' ,'channel','cooperate_date' ,'type', 'created_at']; | 43 | + $filed = ['id', 'title', 'mysql_id' ,'channel','cooperate_date' ,'type', 'remain_day' ,'created_at']; |
| 43 | $lists = $project->formatQuery($map)->select($filed)->with('payment')->with('deploy_build') | 44 | $lists = $project->formatQuery($map)->select($filed)->with('payment')->with('deploy_build') |
| 44 | ->with('deploy_optimize')->with('online_check')->paginate($this->row, ['*'], 'page', $this->page); | 45 | ->with('deploy_optimize')->with('online_check')->paginate($this->row, ['*'], 'page', $this->page); |
| 45 | if(!empty($lists)){ | 46 | if(!empty($lists)){ |
| 46 | $lists = $lists->toArray(); | 47 | $lists = $lists->toArray(); |
| 48 | + $manageModel = new Manage(); | ||
| 49 | + $domainModel = new DomainInfo(); | ||
| 47 | foreach ($lists['list'] as $k=>$item){ | 50 | foreach ($lists['list'] as $k=>$item){ |
| 48 | - $item = $this->handleParam($item); | 51 | + $item = $this->handleParam($item,$manageModel,$domainModel); |
| 49 | $lists['list'][$k] = $item; | 52 | $lists['list'][$k] = $item; |
| 50 | } | 53 | } |
| 51 | } | 54 | } |
| @@ -138,8 +141,10 @@ class RenewProjectController extends BaseController | @@ -138,8 +141,10 @@ class RenewProjectController extends BaseController | ||
| 138 | ->with('project_after')->paginate($this->row, ['*'], 'page', $this->page); | 141 | ->with('project_after')->paginate($this->row, ['*'], 'page', $this->page); |
| 139 | if(!empty($lists)){ | 142 | if(!empty($lists)){ |
| 140 | $lists = $lists->toArray(); | 143 | $lists = $lists->toArray(); |
| 144 | + $manageModel = new Manage(); | ||
| 145 | + $domainModel = new DomainInfo(); | ||
| 141 | foreach ($lists['list'] as $k=>$item){ | 146 | foreach ($lists['list'] as $k=>$item){ |
| 142 | - $item = $this->handleParam($item); | 147 | + $item = $this->handleParam($item,$manageModel,$domainModel); |
| 143 | $lists['list'][$k] = $item; | 148 | $lists['list'][$k] = $item; |
| 144 | } | 149 | } |
| 145 | } | 150 | } |
| @@ -153,9 +158,10 @@ class RenewProjectController extends BaseController | @@ -153,9 +158,10 @@ class RenewProjectController extends BaseController | ||
| 153 | * @method :post | 158 | * @method :post |
| 154 | * @time :2023/8/18 14:44 | 159 | * @time :2023/8/18 14:44 |
| 155 | */ | 160 | */ |
| 156 | - public function handleParam(&$item){ | ||
| 157 | - $manageModel = new Manage(); | ||
| 158 | - $data = APublicModel::getNumByProjectId($item['id']); | 161 | + public function handleParam(&$item,&$manageModel,&$domainModel){ |
| 162 | + if($item['type'] != Project::TYPE_ZERO){ | ||
| 163 | + $data = APublicModel::getNumByProjectId($item['id']); | ||
| 164 | + } | ||
| 159 | $item = [ | 165 | $item = [ |
| 160 | 'id' => $item['id'], | 166 | 'id' => $item['id'], |
| 161 | 'title' => $item['title'], | 167 | 'title' => $item['title'], |
| @@ -174,7 +180,7 @@ class RenewProjectController extends BaseController | @@ -174,7 +180,7 @@ class RenewProjectController extends BaseController | ||
| 174 | 'type' => $item['type'], | 180 | 'type' => $item['type'], |
| 175 | 'test_domain' => $item['deploy_build']['test_domain'] ?? 0, | 181 | 'test_domain' => $item['deploy_build']['test_domain'] ?? 0, |
| 176 | 'plan' =>Project::planMap()[$item['deploy_build']['plan']], | 182 | 'plan' =>Project::planMap()[$item['deploy_build']['plan']], |
| 177 | - 'domain' => $item['deploy_optimize']['domain'] ?? 0, | 183 | + 'domain' => !empty($item['deploy_optimize']['domain']) ? $domainModel->getDomain($item['deploy_optimize']['domain']) : '', |
| 178 | 'created_at' => date('Y年m月d日', strtotime($item['created_at'])), | 184 | 'created_at' => date('Y年m月d日', strtotime($item['created_at'])), |
| 179 | 'autologin_code' => getAutoLoginCode($item['id']), | 185 | 'autologin_code' => getAutoLoginCode($item['id']), |
| 180 | 'product_num' => $data['product'] ?? 0, | 186 | 'product_num' => $data['product'] ?? 0, |
| @@ -184,6 +190,7 @@ class RenewProjectController extends BaseController | @@ -184,6 +190,7 @@ class RenewProjectController extends BaseController | ||
| 184 | 'task_pending_num' => Task::getNumByProjectId($item['id'], [Task::STATUS_DONGING, Task::STATUS_WAIT]), | 190 | 'task_pending_num' => Task::getNumByProjectId($item['id'], [Task::STATUS_DONGING, Task::STATUS_WAIT]), |
| 185 | 'optimist_status'=>$item['online_check']['optimist_status'] ?? 0, | 191 | 'optimist_status'=>$item['online_check']['optimist_status'] ?? 0, |
| 186 | 'qa_status'=>$item['online_check']['qa_status'] ?? 0, | 192 | 'qa_status'=>$item['online_check']['qa_status'] ?? 0, |
| 193 | + 'service_day'=>$item['remain_day'] ?? 0, | ||
| 187 | ]; | 194 | ]; |
| 188 | return $item; | 195 | return $item; |
| 189 | } | 196 | } |
| @@ -215,10 +215,11 @@ class TaskController extends BaseController | @@ -215,10 +215,11 @@ class TaskController extends BaseController | ||
| 215 | */ | 215 | */ |
| 216 | public function getUserTaskList(){ | 216 | public function getUserTaskList(){ |
| 217 | $taskOwnerModel = new TaskOwner(); | 217 | $taskOwnerModel = new TaskOwner(); |
| 218 | - $this->map['manage_id'] = $this->manage['id']; | ||
| 219 | - $lists = $taskOwnerModel->lists($this->map,$this->page,$this->row,$this->order); | 218 | + |
| 219 | + $taskModel = new Task(); | ||
| 220 | + $map = $this->searchUserParam($taskOwnerModel,$taskModel); | ||
| 221 | + $lists = $taskOwnerModel->lists($map,$this->page,$this->row,$this->order); | ||
| 220 | if(!empty($lists) && !empty($lists['list'])){ | 222 | if(!empty($lists) && !empty($lists['list'])){ |
| 221 | - $taskModel = new Task(); | ||
| 222 | $managerModel = new Manage(); | 223 | $managerModel = new Manage(); |
| 223 | foreach ($lists['list'] as $k => $v){ | 224 | foreach ($lists['list'] as $k => $v){ |
| 224 | $taskInfo = $taskModel->read(['id'=>$v['task_id']]); | 225 | $taskInfo = $taskModel->read(['id'=>$v['task_id']]); |
| @@ -230,4 +231,32 @@ class TaskController extends BaseController | @@ -230,4 +231,32 @@ class TaskController extends BaseController | ||
| 230 | } | 231 | } |
| 231 | $this->response('success',Code::SUCCESS,$lists); | 232 | $this->response('success',Code::SUCCESS,$lists); |
| 232 | } | 233 | } |
| 234 | + | ||
| 235 | + /** | ||
| 236 | + * @remark :我的任务搜索参数 | ||
| 237 | + * @name :searchUserParam | ||
| 238 | + * @author :lyh | ||
| 239 | + * @method :post | ||
| 240 | + * @time :2023/9/5 15:00 | ||
| 241 | + */ | ||
| 242 | + public function searchUserParam(&$taskOwnerModel,&$taskModel){ | ||
| 243 | + $map = []; | ||
| 244 | + if (isset($this->map['search_type']) && !empty($this->map['search_type'])){ | ||
| 245 | + if(isset($this->map['search']) && !empty($this->map['search'])) { | ||
| 246 | + $projectModel = new Project(); | ||
| 247 | + if($this->map['search_type'] == 'project'){ | ||
| 248 | + $ids = $projectModel->where('title', 'like', '%' . $this->map['search'] . '%')->pluck('id')->toArray(); | ||
| 249 | + $manage_ids = $taskOwnerModel->formatQuery(['project'=>['in',$ids],'manage_id'=>$this->manage['id']])->pluck('manage_id')->toArray(); | ||
| 250 | + $map['manage_id'] = ['in',$manage_ids]; | ||
| 251 | + }else{ | ||
| 252 | + $ids = $taskModel->where('content', 'like','%'.$this->map['search'].'%')->pluck('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]; | ||
| 255 | + } | ||
| 256 | + } | ||
| 257 | + }else{ | ||
| 258 | + $map['manage_id'] = $this->manage['id']; | ||
| 259 | + } | ||
| 260 | + return $map; | ||
| 261 | + } | ||
| 233 | } | 262 | } |
| @@ -6,6 +6,7 @@ use App\Enums\Common\Code; | @@ -6,6 +6,7 @@ use App\Enums\Common\Code; | ||
| 6 | use App\Http\Controllers\Aside\BaseController; | 6 | use App\Http\Controllers\Aside\BaseController; |
| 7 | use App\Http\Logic\Aside\User\UserLogic; | 7 | use App\Http\Logic\Aside\User\UserLogic; |
| 8 | use App\Http\Requests\Aside\User\UserRequest; | 8 | use App\Http\Requests\Aside\User\UserRequest; |
| 9 | +use App\Models\Project\Project; | ||
| 9 | use App\Models\User\ProjectRole; | 10 | use App\Models\User\ProjectRole; |
| 10 | use App\Models\User\User; | 11 | use App\Models\User\User; |
| 11 | use App\Models\User\User as UserModel; | 12 | use App\Models\User\User as UserModel; |
| @@ -162,4 +163,16 @@ class ProjectUserController extends BaseController | @@ -162,4 +163,16 @@ class ProjectUserController extends BaseController | ||
| 162 | $userLogic->setParamStatus(); | 163 | $userLogic->setParamStatus(); |
| 163 | $this->response('success'); | 164 | $this->response('success'); |
| 164 | } | 165 | } |
| 166 | + | ||
| 167 | + /** | ||
| 168 | + * @remark :保存用户获取项目列表 | ||
| 169 | + * @name :getProjectList | ||
| 170 | + * @author :lyh | ||
| 171 | + * @method :post | ||
| 172 | + * @time :2023/9/6 9:06 | ||
| 173 | + */ | ||
| 174 | + public function getProjectList(Project $project){ | ||
| 175 | + $lists = $project->list(['type'=>['!=',$project::TYPE_ZERO]],'id',['id','title']); | ||
| 176 | + $this->response('success',Code::SUCCESS,$lists); | ||
| 177 | + } | ||
| 165 | } | 178 | } |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :UserLogController.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2023/9/5 16:07 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Controllers\Aside\User; | ||
| 11 | + | ||
| 12 | +use App\Enums\Common\Code; | ||
| 13 | +use App\Http\Controllers\Aside\BaseController; | ||
| 14 | +use App\Models\Manage\Manage; | ||
| 15 | +use App\Models\User\User; | ||
| 16 | +use App\Models\User\UserLogin; | ||
| 17 | + | ||
| 18 | +class UserLogController extends BaseController | ||
| 19 | +{ | ||
| 20 | + /** | ||
| 21 | + * @remark :用户日志 | ||
| 22 | + * @name :lists | ||
| 23 | + * @author :lyh | ||
| 24 | + * @method :post | ||
| 25 | + * @time :2023/9/5 16:10 | ||
| 26 | + */ | ||
| 27 | + public function lists(UserLogin $user){ | ||
| 28 | + $userModel = new User(); | ||
| 29 | + $map = $this->searchParam($userModel); | ||
| 30 | + $lists = $user->lists($map,$this->page,$this->row,$this->order); | ||
| 31 | + if(!empty($lists) && !empty($lists['list'])){ | ||
| 32 | + foreach ($lists['list'] as $k => $v){ | ||
| 33 | + $info = $userModel->read(['id'=>$v['user_id']]); | ||
| 34 | + $v['mobile'] = $info['mobile'] ?? ''; | ||
| 35 | + $v['name'] = $info['name'] ?? ''; | ||
| 36 | + $v['type'] = ($v['type'] == 0) ? '用户登录' : '管理员登录'; | ||
| 37 | + if(!empty($v['remark'])){ | ||
| 38 | + $v['remark'] = $this->handleRemark($userModel,$v['remark']); | ||
| 39 | + } | ||
| 40 | + $lists['list'][$k] = $v; | ||
| 41 | + } | ||
| 42 | + } | ||
| 43 | + $this->response('success',Code::SUCCESS,$lists); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * @remark :搜索参数 | ||
| 48 | + * @name :searchParam | ||
| 49 | + * @author :lyh | ||
| 50 | + * @method :post | ||
| 51 | + * @time :2023/9/5 16:56 | ||
| 52 | + */ | ||
| 53 | + public function searchParam(&$userModel){ | ||
| 54 | + $map = []; | ||
| 55 | + if(isset($this->map['mobile']) && !empty($this->map['mobile'])){ | ||
| 56 | + $ids = $userModel->where('mobile', 'like', '%' . $this->map['mobile'] . '%')->pluck('id')->toArray(); | ||
| 57 | + $map['user_id'] = ['in',$ids]; | ||
| 58 | + }elseif (isset($this->map['name']) && !empty($this->map['name'])){ | ||
| 59 | + $ids = $userModel->where('name', 'like', '%' . $this->param['name'] . '%')->pluck('id')->toArray(); | ||
| 60 | + $map['user_id'] = ['in',$ids]; | ||
| 61 | + } | ||
| 62 | + if(isset($this->map['created_at'])){ | ||
| 63 | + $map['created_at'] = $this->map['created_at']; | ||
| 64 | + } | ||
| 65 | + return $map; | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + /** | ||
| 69 | + * @remark :处理备注 | ||
| 70 | + * @name :handleRemark | ||
| 71 | + * @author :lyh | ||
| 72 | + * @method :post | ||
| 73 | + * @time :2023/9/5 17:21 | ||
| 74 | + */ | ||
| 75 | + public function handleRemark(&$managerModel,$remark){ | ||
| 76 | + $arr = explode(':',$remark); | ||
| 77 | + $managerInfo = $managerModel->read(['id'=>$arr[1]]); | ||
| 78 | + if($managerInfo !== false){ | ||
| 79 | + $remark = $arr[0].':'.$managerInfo['name']; | ||
| 80 | + } | ||
| 81 | + return $remark; | ||
| 82 | + } | ||
| 83 | +} |
| @@ -40,8 +40,11 @@ class LoginLogic extends BaseLogic | @@ -40,8 +40,11 @@ class LoginLogic extends BaseLogic | ||
| 40 | if (Manage::STATUS_DISABLE == $manage->status) { | 40 | if (Manage::STATUS_DISABLE == $manage->status) { |
| 41 | $this->fail('帐号已被禁用'); | 41 | $this->fail('帐号已被禁用'); |
| 42 | } | 42 | } |
| 43 | + $type = 1;//账号密码登录 | ||
| 43 | if (!Hash::check($this->param['password'], $manage->password)) { | 44 | if (!Hash::check($this->param['password'], $manage->password)) { |
| 45 | + //验证验证码 | ||
| 44 | $this->verifyCode($this->param['mobile'],$this->param['password']); | 46 | $this->verifyCode($this->param['mobile'],$this->param['password']); |
| 47 | + $type = 2;//验证码登录 | ||
| 45 | } | 48 | } |
| 46 | if(!empty($manage['token'])){ | 49 | if(!empty($manage['token'])){ |
| 47 | //清除上一次用户缓存 | 50 | //清除上一次用户缓存 |
| @@ -51,14 +54,14 @@ class LoginLogic extends BaseLogic | @@ -51,14 +54,14 @@ class LoginLogic extends BaseLogic | ||
| 51 | $token = md5(uniqid().$manage['id']); | 54 | $token = md5(uniqid().$manage['id']); |
| 52 | //存储缓存 | 55 | //存储缓存 |
| 53 | $manage['token'] = $token; | 56 | $manage['token'] = $token; |
| 54 | - Cache::add(Common::MANAGE_TOKEN . $token,$manage); | 57 | + Cache::add(Common::MANAGE_TOKEN . $token,$manage,3600); |
| 55 | //更新用户信息 | 58 | //更新用户信息 |
| 56 | $manage->token = $token; | 59 | $manage->token = $token; |
| 57 | $res = $manage->save(); | 60 | $res = $manage->save(); |
| 58 | if(!$res){ | 61 | if(!$res){ |
| 59 | $this->fail('系统错误,请联系管理员'); | 62 | $this->fail('系统错误,请联系管理员'); |
| 60 | } | 63 | } |
| 61 | - LoginLog::addLog($manage->id); | 64 | + LoginLog::addLog($manage->id,$type); |
| 62 | //获取当前用户特殊模块权限 | 65 | //获取当前用户特殊模块权限 |
| 63 | $manage['special'] = $this->getSpecialMenu($manage['id']); | 66 | $manage['special'] = $this->getSpecialMenu($manage['id']); |
| 64 | return $this->success($manage->makeVisible('token')->toArray()); | 67 | return $this->success($manage->makeVisible('token')->toArray()); |
| @@ -2,11 +2,9 @@ | @@ -2,11 +2,9 @@ | ||
| 2 | 2 | ||
| 3 | namespace App\Http\Logic\Bside\Product; | 3 | namespace App\Http\Logic\Bside\Product; |
| 4 | 4 | ||
| 5 | -use App\Exceptions\BsideGlobalException; | ||
| 6 | use App\Helper\Arr; | 5 | use App\Helper\Arr; |
| 7 | use App\Http\Logic\Bside\BaseLogic; | 6 | use App\Http\Logic\Bside\BaseLogic; |
| 8 | use App\Models\Product\Category; | 7 | use App\Models\Product\Category; |
| 9 | -use App\Models\Product\CategoryRelated; | ||
| 10 | use App\Models\Product\Product; | 8 | use App\Models\Product\Product; |
| 11 | use App\Models\RouteMap\RouteMap; | 9 | use App\Models\RouteMap\RouteMap; |
| 12 | use Illuminate\Support\Facades\DB; | 10 | use Illuminate\Support\Facades\DB; |
| @@ -18,10 +18,11 @@ class LoginLog extends Base | @@ -18,10 +18,11 @@ class LoginLog extends Base | ||
| 18 | * @author zbj | 18 | * @author zbj |
| 19 | * @date 2023/4/20 | 19 | * @date 2023/4/20 |
| 20 | */ | 20 | */ |
| 21 | - public static function addLog($manage_id){ | 21 | + public static function addLog($manage_id,$type){ |
| 22 | $log = new self(); | 22 | $log = new self(); |
| 23 | $log->manage_id = $manage_id; | 23 | $log->manage_id = $manage_id; |
| 24 | $log->ip = request()->ip(); | 24 | $log->ip = request()->ip(); |
| 25 | + $log->type = $type; | ||
| 25 | $log->save(); | 26 | $log->save(); |
| 26 | } | 27 | } |
| 27 | } | 28 | } |
| @@ -21,6 +21,7 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -21,6 +21,7 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 21 | Route::any('/del', [Aside\User\ProjectUserController::class, 'del'])->name('admin.user_del'); | 21 | Route::any('/del', [Aside\User\ProjectUserController::class, 'del'])->name('admin.user_del'); |
| 22 | Route::any('/getRole', [Aside\User\ProjectUserController::class, 'getRole'])->name('admin.user_getRole'); | 22 | Route::any('/getRole', [Aside\User\ProjectUserController::class, 'getRole'])->name('admin.user_getRole'); |
| 23 | Route::any('/sort', [Aside\User\ProjectUserController::class, 'sort'])->name('admin.user_sort'); | 23 | Route::any('/sort', [Aside\User\ProjectUserController::class, 'sort'])->name('admin.user_sort'); |
| 24 | + Route::any('/getProjectList', [Aside\User\ProjectUserController::class, 'getProjectList'])->name('admin.user_getProjectList'); | ||
| 24 | 25 | ||
| 25 | //角色管理 | 26 | //角色管理 |
| 26 | Route::prefix('role')->group(function () { | 27 | Route::prefix('role')->group(function () { |
| @@ -50,6 +51,11 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -50,6 +51,11 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 50 | Route::any('/read', [Aside\User\ProjectDeptController::class, 'read'])->name('admin.user_group_info'); | 51 | Route::any('/read', [Aside\User\ProjectDeptController::class, 'read'])->name('admin.user_group_info'); |
| 51 | Route::any('/getDeptUser', [Aside\User\ProjectDeptController::class, 'getDeptUser'])->name('admin.user_getDeptUser'); | 52 | Route::any('/getDeptUser', [Aside\User\ProjectDeptController::class, 'getDeptUser'])->name('admin.user_getDeptUser'); |
| 52 | }); | 53 | }); |
| 54 | + | ||
| 55 | + //用户日志 | ||
| 56 | + Route::prefix('log')->group(function () { | ||
| 57 | + Route::any('/', [Aside\User\UserLogController::class, 'lists'])->name('admin.user_log_lists'); | ||
| 58 | + }); | ||
| 53 | }); | 59 | }); |
| 54 | 60 | ||
| 55 | //ai指令 | 61 | //ai指令 |
| @@ -127,6 +133,11 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -127,6 +133,11 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 127 | Route::post('/save', [Aside\Manage\HrController::class, 'save'])->name('admin.hr_save'); | 133 | Route::post('/save', [Aside\Manage\HrController::class, 'save'])->name('admin.hr_save'); |
| 128 | Route::get('/getSearchParamsList', [Aside\Manage\HrController::class, 'getSearchParamsList'])->name('admin.hr_getSearchParamsList'); | 134 | Route::get('/getSearchParamsList', [Aside\Manage\HrController::class, 'getSearchParamsList'])->name('admin.hr_getSearchParamsList'); |
| 129 | }); | 135 | }); |
| 136 | + | ||
| 137 | + //管理员日志 | ||
| 138 | + Route::prefix('log')->group(function () { | ||
| 139 | + Route::any('/', [Aside\Manage\ManagerLogController::class, 'lists'])->name('admin.manager_log_lists'); | ||
| 140 | + }); | ||
| 130 | }); | 141 | }); |
| 131 | 142 | ||
| 132 | //企业服务配置信息 | 143 | //企业服务配置信息 |
-
请 注册 或 登录 后发表评论