作者 zhl

添加版本信息

... ... @@ -63,32 +63,34 @@ class ProjectController extends BaseController
* @method :post
* @time :2023/8/30 10:11
*/
public function lists(Project $project){
public function lists(Project $project)
{
$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')
->leftJoin('gl_web_setting_template', 'gl_project.id', '=', 'gl_web_setting_template.project_id')
->leftJoin('gl_project_association', 'gl_project.id', '=', 'gl_project_association.project_id')
->where('gl_project.delete_status',Project::TYPE_ZERO);
->where('gl_project.delete_status', Project::TYPE_ZERO);
$query = $this->searchParam($query);
$query = $this->orderByList($query);
$lists = $query->paginate($this->row, $this->selectParam(), 'page', $this->page)->toArray();
if(!empty($lists) && !empty($lists['list'])){
foreach ($lists['list'] as $k => $v){
if (!empty($lists) && !empty($lists['list'])) {
foreach ($lists['list'] as $k => $v) {
$v = $this->handleParam($v);
// 组装 工单UUID END
$lists['list'][$k] = $v;
}
}
$this->response('success',Code::SUCCESS,$lists);
$this->response('success', Code::SUCCESS, $lists);
}
/**
* 需要查询的字段
* @return array
*/
public function selectParam(){
public function selectParam()
{
$select = [
'gl_project.id AS id',
'gl_project.title AS title',
... ... @@ -144,10 +146,11 @@ class ProjectController extends BaseController
* @method :post
* @time :2023/12/29 17:14
*/
public function orderByList($query){
if(isset($this->map['seo_plan']) && $this->map['seo_plan'] == 1){
public function orderByList($query)
{
if (isset($this->map['seo_plan']) && $this->map['seo_plan'] == 1) {
$query = $query->orderBy('gl_project.cooperate_date', 'desc')->orderBy('gl_project.id', 'desc');
}else{
} else {
$query = $query->orderBy('gl_project.uptime', 'desc')->orderBy('gl_project.id', 'desc');
}
return $query;
... ... @@ -160,7 +163,8 @@ class ProjectController extends BaseController
* @method :post
* @time :2023/8/18 10:58
*/
public function searchParam(&$query){
public function searchParam(&$query)
{
//参数type
$query = $this->searchType($query);
//根据查看权限获取项目搜索条件(必带)
... ... @@ -185,18 +189,19 @@ class ProjectController extends BaseController
* @param $query
* @return mixed
*/
public function searchType(&$query){
if(isset($this->map['type'])){
$query->where('gl_project.extend_type', '!=' ,5)->where('gl_project.extend_type', '!=' ,8);
if (in_array($this->map['type'], [Project::TYPE_ZERO, Project::TYPE_ONE, Project::TYPE_TWO, Project::TYPE_THREE])){
public function searchType(&$query)
{
if (isset($this->map['type'])) {
$query->where('gl_project.extend_type', '!=', 5)->where('gl_project.extend_type', '!=', 8);
if (in_array($this->map['type'], [Project::TYPE_ZERO, Project::TYPE_ONE, Project::TYPE_TWO, Project::TYPE_THREE])) {
$query->where('gl_project.type', $this->map['type']);
} elseif ($this->map['type'] == 8){
$query->where('gl_project_online_check.id', null)->where('gl_project.type',Project::TYPE_TWO);
}else{
$query->whereIn('gl_project.type', [Project::TYPE_FOUR,Project::TYPE_SIX]);
} elseif ($this->map['type'] == 8) {
$query->where('gl_project_online_check.id', null)->where('gl_project.type', Project::TYPE_TWO);
} else {
$query->whereIn('gl_project.type', [Project::TYPE_FOUR, Project::TYPE_SIX]);
}
}
if(isset($this->map['uptime']) && is_array($this->map['uptime'])){
if (isset($this->map['uptime']) && is_array($this->map['uptime'])) {
$query->whereBetween('gl_project.uptime', $this->map['uptime']);
}
return $query;
... ... @@ -209,8 +214,9 @@ class ProjectController extends BaseController
* @method :post
* @time :2023/11/6 16:27
*/
public function searchUpgrade(&$query){
if(isset($this->map['is_upgrade'])){
public function searchUpgrade(&$query)
{
if (isset($this->map['is_upgrade'])) {
$query->where('gl_project.is_upgrade', $this->map['is_upgrade']);
}
return $query;
... ... @@ -221,31 +227,32 @@ class ProjectController extends BaseController
* @param $query
* @return mixed
*/
public function searchContent(&$query){
if(!empty($this->map['domain_type']) && !empty($this->map['domain_search'])){
if($this->map['domain_type'] == 'domain'){
public function searchContent(&$query)
{
if (!empty($this->map['domain_type']) && !empty($this->map['domain_search'])) {
if ($this->map['domain_type'] == 'domain') {
$parsedUrl = parse_url($this->map['domain_search']);
$this->map['domain_search'] = $parsedUrl['host'] ?? $this->map['domain_search'];
$ids = DomainInfoModel::where('domain', 'like', '%'.$this->map['domain_search'].'%')->pluck('id')->toArray();
$ids = DomainInfoModel::where('domain', 'like', '%' . $this->map['domain_search'] . '%')->pluck('id')->toArray();
$query->whereIn('gl_project_deploy_optimize.domain', $ids);
}else{
$query->where('gl_project_deploy_build.test_domain','like','%'.$this->map['domain_search'].'%');
} else {
$query->where('gl_project_deploy_build.test_domain', 'like', '%' . $this->map['domain_search'] . '%');
}
}
if(!empty($this->map['search']) && !empty($this->map['search_type'])){
if (!empty($this->map['search']) && !empty($this->map['search_type'])) {
$query->where(function ($subQuery) {
// 搜索域名
if ($this->map['search_type'] == 'domain') {
$parsedUrl = parse_url($this->map['search']);
$this->map['search'] = $parsedUrl['host'] ?? $this->map['search'];
$ids = DomainInfo::where('domain', 'like', '%'.$this->map['search'].'%')->pluck('id')->toArray();
$ids = DomainInfo::where('domain', 'like', '%' . $this->map['search'] . '%')->pluck('id')->toArray();
$subQuery->whereIn('gl_project_deploy_optimize.domain', $ids);
} else if($this->map['search_type'] == 'test_domain'){
$subQuery->where('gl_project_deploy_build.test_domain','like','%'.$this->map['search'].'%');
} else if ($this->map['search_type'] == 'test_domain') {
$subQuery->where('gl_project_deploy_build.test_domain', 'like', '%' . $this->map['search'] . '%');
} else {
// 搜索名称
$subQuery->orwhere('gl_project.company','like','%'.$this->map['search'].'%')
->orwhere('gl_project.title','like','%'.$this->map['search'].'%');
$subQuery->orwhere('gl_project.company', 'like', '%' . $this->map['search'] . '%')
->orwhere('gl_project.title', 'like', '%' . $this->map['search'] . '%');
}
});
}
... ... @@ -259,15 +266,16 @@ class ProjectController extends BaseController
* @method :post
* @time :2023/11/9 10:16
*/
public function searchChannel(&$query){
if(isset($this->map['zone_id']) && !empty($this->map['zone_id'])){
$query->where('gl_project.channel','like','%"zone_id": "'.$this->map['zone_id'].'"%');
public function searchChannel(&$query)
{
if (isset($this->map['zone_id']) && !empty($this->map['zone_id'])) {
$query->where('gl_project.channel', 'like', '%"zone_id": "' . $this->map['zone_id'] . '"%');
}
if(isset($this->map['channel_id']) && !empty($this->map['channel_id'])){
$query->where('gl_project.channel','like','%"channel_id": "'.$this->map['channel_id'].'"%');
if (isset($this->map['channel_id']) && !empty($this->map['channel_id'])) {
$query->where('gl_project.channel', 'like', '%"channel_id": "' . $this->map['channel_id'] . '"%');
}
if(isset($this->map['user_id']) && !empty($this->map['user_id'])){
$query->where('gl_project.channel','like','%"user_id": "'.$this->map['user_id'].'"%');
if (isset($this->map['user_id']) && !empty($this->map['user_id'])) {
$query->where('gl_project.channel', 'like', '%"user_id": "' . $this->map['user_id'] . '"%');
}
return $query;
}
... ... @@ -279,14 +287,15 @@ class ProjectController extends BaseController
* @method :post
* @time :2023/9/7 18:40
*/
public function searchDept(&$query){
if(!empty($this->map['dept_id'])){
if($this->map['dept_id'] == 7 || $this->map['dept_id'] == 9){//7,9代表合并组H+F组
$query->whereIn('gl_project_deploy_build.dept_id', [7,9]);
}else{
public function searchDept(&$query)
{
if (!empty($this->map['dept_id'])) {
if ($this->map['dept_id'] == 7 || $this->map['dept_id'] == 9) {//7,9代表合并组H+F组
$query->whereIn('gl_project_deploy_build.dept_id', [7, 9]);
} else {
$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']);
$subQuery->orwhere('gl_project_deploy_build.dept_id', $this->map['dept_id'])
->orwhere('gl_project_deploy_optimize.dept_id', $this->map['dept_id']);
});
}
}
... ... @@ -300,20 +309,21 @@ class ProjectController extends BaseController
* @method :post
* @time :2024/3/4 14:58
*/
public function searchTechMid(&$query){
if(isset($this->map['tech_mid'])){
$query = $query->where('gl_project_deploy_optimize.tech_mid',$this->map['tech_mid']);
public function searchTechMid(&$query)
{
if (isset($this->map['tech_mid'])) {
$query = $query->where('gl_project_deploy_optimize.tech_mid', $this->map['tech_mid']);
}
if(isset($this->map['optimize_optimist_mid'])){
$query = $query->where('gl_project_deploy_optimize.optimist_mid',$this->map['optimize_optimist_mid']);
if (isset($this->map['optimize_optimist_mid'])) {
$query = $query->where('gl_project_deploy_optimize.optimist_mid', $this->map['optimize_optimist_mid']);
}
if(isset($this->map['plan'])){
$query = $query->where('gl_project_deploy_build.plan',$this->map['plan']);
if (isset($this->map['plan'])) {
$query = $query->where('gl_project_deploy_build.plan', $this->map['plan']);
}
if(isset($this->map['friend_id'])){
if($this->map['friend_id'] == 1){
if (isset($this->map['friend_id'])) {
if ($this->map['friend_id'] == 1) {
$query = $query->where('gl_project_association.friend_id', '!=', 0);
}else{
} else {
$query = $query->where(function ($subQuery) {
$subQuery->where('gl_project_association.friend_id', 0)
->orWhereNull('gl_project_association.friend_id');
... ... @@ -327,25 +337,25 @@ class ProjectController extends BaseController
->orWhere('gl_project_deploy_build.seo_plan', '!=', 9);
});
}
if(isset($this->map['site_status'])){
$query = $query->where('gl_project.site_status',$this->map['site_status']);
if (isset($this->map['site_status'])) {
$query = $query->where('gl_project.site_status', $this->map['site_status']);
}
if(isset($this->map['domain'])){
if($this->map['domain'] == 0){
$query = $query->where('gl_project_deploy_optimize.domain',null);
}else{
$query = $query->where('gl_project_deploy_optimize.domain','!=',null);
if (isset($this->map['domain'])) {
if ($this->map['domain'] == 0) {
$query = $query->where('gl_project_deploy_optimize.domain', null);
} else {
$query = $query->where('gl_project_deploy_optimize.domain', '!=', null);
}
}
if(isset($this->map['project_type'])){
$query = $query->where('gl_project.project_type',$this->map['project_type']);
if (isset($this->map['project_type'])) {
$query = $query->where('gl_project.project_type', $this->map['project_type']);
}
if(isset($this->param['geo'])){
if($this->param['geo'] == 1){
$query = $query->where('gl_project.geo_status',1);
}else{
if (isset($this->param['geo'])) {
if ($this->param['geo'] == 1) {
$query = $query->where('gl_project.geo_status', 1);
} else {
$ids = GeoLink::pluck('project_id')->unique()->values()->all();
$query = $query->whereIn('gl_project.id',$ids);
$query = $query->whereIn('gl_project.id', $ids);
}
}
... ... @@ -359,14 +369,15 @@ class ProjectController extends BaseController
* @method :post
* @time :2023/9/7 17:28
*/
public function getManagerRole(&$query){
if(($this->manage['role'] != 1)){//1代表查看所有
public function getManagerRole(&$query)
{
if (($this->manage['role'] != 1)) {//1代表查看所有
//获取用户所在组
$managerHr = new ManageHr();
$info = $managerHr->read(['manage_id'=>$this->manage['id']]);
$info = $managerHr->read(['manage_id' => $this->manage['id']]);
//获取当前用户自己的项目
$query->where(function ($subQuery) use ($info) {
$subQuery->whereIn('gl_project.id', [1]) // 项目1 + 项目3默认显示
$subQuery->whereIn('gl_project.id', [1])// 项目1 + 项目3默认显示
->orWhere('gl_project_deploy_build.leader_mid', $info['id'])
->orWhere('gl_project_deploy_build.manager_mid', $info['id'])
->orWhere('gl_project_deploy_build.designer_mid', $info['id'])
... ... @@ -428,39 +439,40 @@ class ProjectController extends BaseController
* @method :post
* @time :2023/8/18 14:44
*/
public function handleParam(&$item){
if(($item['type'] != Project::TYPE_ZERO)){
public function handleParam(&$item)
{
if (($item['type'] != Project::TYPE_ZERO)) {
$data = APublicModel::getNumByProjectId($item['id']);
}
if($item['type'] == Project::TYPE_ONE){//建站中
if ($item['type'] == Project::TYPE_ONE) {//建站中
$processModel = new ProcessRecords();
$item['sign_project'] = 1;
$count = $processModel->counts(['project_id'=>$item['id']]);
if($count < 1){
$count = $processModel->counts(['project_id' => $item['id']]);
if ($count < 1) {
$item['sign_project'] = 0;
}else{
$proInfo = $processModel->read(['project_id'=>$item['id'],'date'=>['>=',date('Y-m-d', strtotime('-3 days'))]],['id']);
if($proInfo !== false){
} else {
$proInfo = $processModel->read(['project_id' => $item['id'], 'date' => ['>=', date('Y-m-d', strtotime('-3 days'))]], ['id']);
if ($proInfo !== false) {
$item['sign_project'] = 0;
}
}
}
if(!empty($item['extend_type'])){
if (!empty($item['extend_type'])) {
$item['type'] = $item['extend_type'];
}
$manageModel = new ManageHr();
//geo项目
if(($item['plan'] == 0) && ($item['seo_plan'] != 0)){
if (($item['plan'] == 0) && ($item['seo_plan'] != 0)) {
//geo项目负责人
$geoConfModel = new GeoConf();
$manage_id = $geoConfModel->getValue(['project_id'=>$item['id']],'manager_id');
$manage_id = $geoConfModel->getValue(['project_id' => $item['id']], 'manager_id');
$item['geo_manage_name'] = $manageModel->getName($manage_id);
$geoArticleModel = new GeoArticle();
$item['geo_article_num'] = $geoArticleModel->counts(['project_id'=>$item['id']]);//文章数量
$item['geo_article_num'] = $geoArticleModel->counts(['project_id' => $item['id']]);//文章数量
$geoLinkModel = new GeoLink();
$item['geo_link_num'] = $geoLinkModel->counts(['project_id'=>$item['id']]);//权威新闻数量
$item['geo_link_num'] = $geoLinkModel->counts(['project_id' => $item['id']]);//权威新闻数量
$questionResModel = new GeoQuestionResult();
$item['geo_qualify_num'] = $questionResModel->counts(['project_id'=>$item['id'],'hit'=>['!=',0],'platform'=>['in',['openai', 'gemini','google_ai_overview']]]);//排名
$item['geo_qualify_num'] = $questionResModel->counts(['project_id' => $item['id'], 'hit' => ['!=', 0], 'platform' => ['in', ['openai', 'gemini', 'google_ai_overview']]]);//排名
}
$item['build_leader'] = $manageModel->getName($item['leader_mid']);
$item['build_manager'] = $manageModel->getName($item['manager_mid']);
... ... @@ -498,14 +510,15 @@ class ProjectController extends BaseController
* @method :post
* @time :2023/8/17 16:42
*/
public function info(ProjectLogic $logic){
public function info(ProjectLogic $logic)
{
$this->request->validate([
'id'=>'required'
],[
'id' => 'required'
], [
'id.required' => 'ID不能为空'
]);
$data = $logic->getProjectInfo($this->param['id']);
$this->response('success',Code::SUCCESS,$data);
$this->response('success', Code::SUCCESS, $data);
}
/**
... ... @@ -515,14 +528,15 @@ class ProjectController extends BaseController
* @method :post
* @time :2024/6/18 11:53
*/
public function deleteMinorLanguages(ProjectLogic $logic){
public function deleteMinorLanguages(ProjectLogic $logic)
{
$this->request->validate([
'id'=>'required'
],[
'id' => 'required'
], [
'id.required' => 'ID不能为空'
]);
$data = $logic->deleteMinorLanguages();
$this->response('success',Code::SUCCESS,$data);
$this->response('success', Code::SUCCESS, $data);
}
/**
... ... @@ -535,9 +549,9 @@ class ProjectController extends BaseController
public function save(ProjectLogic $logic)
{
$this->request->validate([
'type'=>'required',
'serve_id'=>'required',
],[
'type' => 'required',
'serve_id' => 'required',
], [
'type.required' => '类型不能为空',
'serve_id.required' => '请选择服务器'
]);
... ... @@ -550,23 +564,24 @@ class ProjectController extends BaseController
* @author zbj
* @date 2023/5/17
*/
public function inquiry_set(Request $request, ProjectLogic $logic){
public function inquiry_set(Request $request, ProjectLogic $logic)
{
$request->validate([
'project_id'=>'required'
],[
'project_id' => 'required'
], [
'project_id.required' => '项目ID不能为空'
]);
if($request->isMethod('get')){
if ($request->isMethod('get')) {
$data = InquirySet::where('project_id', $request->project_id)->first();
if(!$data){
if (!$data) {
$data = ['emails' => '', 'phones' => ''];
}else{
} else {
$data = $data->toArray();
}
$this->response('success',Code::SUCCESS,$data);
$this->response('success', Code::SUCCESS, $data);
}
$data = $logic->saveInquirySet($this->param);
$this->response('success',Code::SUCCESS,$data);
$this->response('success', Code::SUCCESS, $data);
}
... ... @@ -577,9 +592,10 @@ class ProjectController extends BaseController
* @method :post
* @time :2023/12/7 10:41
*/
public function data_source(ProjectLogic $logic){
public function data_source(ProjectLogic $logic)
{
$data = $logic->dataSource();
$this->response('success',Code::SUCCESS,$data);
$this->response('success', Code::SUCCESS, $data);
}
/**
... ... @@ -587,9 +603,10 @@ class ProjectController extends BaseController
* @author zbj
* @date 2023/6/27
*/
public function city_source(){
public function city_source()
{
$data = City::source($this->param['id'] ?? 0);
$this->response('success',Code::SUCCESS,$data);
$this->response('success', Code::SUCCESS, $data);
}
/**
... ... @@ -597,9 +614,10 @@ class ProjectController extends BaseController
* @author zbj
* @date 2023/6/27
*/
public function channel_source(ProjectLogic $logic){
public function channel_source(ProjectLogic $logic)
{
$data = $logic->channelSource($this->param);
$this->response('success',Code::SUCCESS,$data);
$this->response('success', Code::SUCCESS, $data);
}
/**
... ... @@ -607,14 +625,15 @@ class ProjectController extends BaseController
* @author zbj
* @date 2023/6/25
*/
public function get_process_records(Request $request, ProcessRecordsLogic $logic){
public function get_process_records(Request $request, ProcessRecordsLogic $logic)
{
$request->validate([
'project_id'=>'required'
],[
'project_id' => 'required'
], [
'project_id.required' => '项目ID不能为空'
]);
$data = $logic->getInfo($this->param['project_id']);
$this->response('success',Code::SUCCESS,$data);
$this->response('success', Code::SUCCESS, $data);
}
... ... @@ -623,7 +642,8 @@ class ProjectController extends BaseController
* @author zbj
* @date 2023/6/25
*/
public function save_process_records(ProcessRecordsRequest $request, ProcessRecordsLogic $logic){
public function save_process_records(ProcessRecordsRequest $request, ProcessRecordsLogic $logic)
{
$request->validated();
$logic->recordSave();
$this->response('success');
... ... @@ -634,15 +654,16 @@ class ProjectController extends BaseController
* @author zbj
* @date 2023/6/27
*/
public function get_contract_bill(Request $request){
public function get_contract_bill(Request $request)
{
$request->validate([
'id'=>'required'
],[
'id' => 'required'
], [
'id.required' => 'ID不能为空'
]);
$payment = Payment::where('project_id', $this->param['id'])->select(['contract', 'bill'])->first();
$data = $payment->makeVisible(['contract', 'bill']);
$this->response('success',Code::SUCCESS,$data ? $data->toArray() : []);
$this->response('success', Code::SUCCESS, $data ? $data->toArray() : []);
}
/**
... ... @@ -652,10 +673,11 @@ class ProjectController extends BaseController
* @method :post
* @time :2023/12/2 9:59
*/
public function submit_check(OnlineCheckLogic $logic){
public function submit_check(OnlineCheckLogic $logic)
{
$this->request->validate([
'id'=>'required'
],[
'id' => 'required'
], [
'id.required' => 'ID不能为空'
]);
$logic->saveOnlineCheck();
... ... @@ -669,12 +691,13 @@ class ProjectController extends BaseController
* @method :post
* @time :2023/8/30 19:01
*/
public function online_check(OnlineCheckLogic $logic){
public function online_check(OnlineCheckLogic $logic)
{
$this->request->validate([
'id'=>'required',
'type'=>'required|in:optimist,qa',
'status'=>'required|in:0,1'
],[
'id' => 'required',
'type' => 'required|in:optimist,qa',
'status' => 'required|in:0,1'
], [
'id.required' => 'ID不能为空',
'type.required' => '请选择审核类型',
'type.in' => '审核类型值无效',
... ... @@ -692,15 +715,16 @@ class ProjectController extends BaseController
* @method :post
* @time :2023/8/4 16:27
*/
public function getBelongingGroup(){
public function getBelongingGroup()
{
$this->request->validate([
'type'=>'required',
],[
'type' => 'required',
], [
'type.required' => '请选择审核类型'
]);
$belongGroupModel = new BelongingGroup();
$lists = $belongGroupModel->list($this->map,'name',['id','name','type'],'asc');
$this->response('success',Code::SUCCESS,$lists);
$lists = $belongGroupModel->list($this->map, 'name', ['id', 'name', 'type'], 'asc');
$this->response('success', Code::SUCCESS, $lists);
}
/**
... ... @@ -710,21 +734,22 @@ class ProjectController extends BaseController
* @method :post
* @time :2023/8/8 10:29
*/
public function getManagerList(){
public function getManagerList()
{
$hrManagerModel = new ManageHr();
if(!isset($this->map['status'])){
if (!isset($this->map['status'])) {
$this->map['status'] = $hrManagerModel::STATUS_ONE;
}else{
if(!is_array($this->map['status'])){
} else {
if (!is_array($this->map['status'])) {
$this->map['status'] = [$this->map['status']];
}
$this->map['status'] = ['in',$this->map['status']];
$this->map['status'] = ['in', $this->map['status']];
}
if(isset($this->map['entry_position']) && !empty($this->map['entry_position'])){
$this->map['entry_position'] = ['in',$this->map['entry_position']];
if (isset($this->map['entry_position']) && !empty($this->map['entry_position'])) {
$this->map['entry_position'] = ['in', $this->map['entry_position']];
}
$lists = $hrManagerModel->list($this->map,['sort','id'],['id','manage_id','name','entry_position','is_leader']);
$this->response('success',Code::SUCCESS,$lists);
$lists = $hrManagerModel->list($this->map, ['sort', 'id'], ['id', 'manage_id', 'name', 'entry_position', 'is_leader']);
$this->response('success', Code::SUCCESS, $lists);
}
/**
... ... @@ -734,10 +759,11 @@ class ProjectController extends BaseController
* @method :post
* @time :2023/8/14 10:23 todo::后面删除
*/
public function getServiceConfig(){
public function getServiceConfig()
{
$serviceConfigModel = new ServerConfig();
$list = $serviceConfigModel->list($this->param,'id',['id','type','title','count','init_domain','service_type']);
$this->response('success',Code::SUCCESS,$list);
$list = $serviceConfigModel->list($this->param, 'id', ['id', 'type', 'title', 'count', 'init_domain', 'service_type']);
$this->response('success', Code::SUCCESS, $list);
}
/**
... ... @@ -747,15 +773,16 @@ class ProjectController extends BaseController
* @method :post
* @time :2023/8/14 10:29
*/
public function getDomain(){
public function getDomain()
{
$this->request->validate([
'project_id'=>'required',
],[
'project_id' => 'required',
], [
'project_id.required' => 'project_id不能为空',
]);
$domainModel = new DomainInfo();
$list = $domainModel->list(['status'=>0,'project_id'=>['or',$this->param['project_id']]]);
$this->response('success',Code::SUCCESS,$list);
$list = $domainModel->list(['status' => 0, 'project_id' => ['or', $this->param['project_id']]]);
$this->response('success', Code::SUCCESS, $list);
}
/**
... ... @@ -763,18 +790,19 @@ class ProjectController extends BaseController
* @author zbj
* @date 2023/9/4
*/
public function getProjectInService(){
public function getProjectInService()
{
$company = $this->param['company'];
if(!$company){
$this->response('企业名称必传',Code::SYSTEM_ERROR);
if (!$company) {
$this->response('企业名称必传', Code::SYSTEM_ERROR);
}
$project = Project::where('company', $company)->first();
if($project && ($project['remain_day'] > 0 || in_array($project['type'], [0, 1,6]))){
if ($project && ($project['remain_day'] > 0 || in_array($project['type'], [0, 1, 6]))) {
$in_service = 1;
}else{
} else {
$in_service = 0;
}
$this->response('success',Code::SUCCESS, ['in_service' => $in_service]);
$this->response('success', Code::SUCCESS, ['in_service' => $in_service]);
}
/**
... ... @@ -784,10 +812,11 @@ class ProjectController extends BaseController
* @method :post
* @time :2023/9/8 15:21
*/
public function del(ProjectLogic $logic){
public function del(ProjectLogic $logic)
{
$this->request->validate([
'id'=>'required',
],[
'id' => 'required',
], [
'id.required' => 'id不能为空',
]);
$logic->projectDel();
... ... @@ -799,7 +828,8 @@ class ProjectController extends BaseController
* @author zbj
* @date 2023/9/11
*/
public function getProjectByChannel(Request $request){
public function getProjectByChannel(Request $request)
{
$id = $this->param['id'] ?? '';
$notice_order_id = $this->param['notice_order_id'] ?? '';
$source_id = $this->param['channel_id'] ?? 0; //原系统渠道id
... ... @@ -810,32 +840,41 @@ class ProjectController extends BaseController
$order_by_sort = $request->input('order_by_sort', 'desc');
$start_time = $this->param['start_time'] ?? '';
$end_time = $this->param['end_time'] ?? '';
if(!$source_id && !$id){
$this->response('参数异常',Code::SYSTEM_ERROR);
$plan = $this->param['plan'] ?? '';
if (!$source_id && !$id) {
$this->response('参数异常', Code::SYSTEM_ERROR);
}
$channel_id = 0;
if($source_id){
if ($source_id) {
$channel = Channel::where('source_id', $source_id)->first();
if(!$channel){
$this->response('渠道不存在',Code::SYSTEM_ERROR);
if (!$channel) {
$this->response('渠道不存在', Code::SYSTEM_ERROR);
}
$channel_id = $channel->id;
}
if ($id){
if(!is_array($id)){
if ($id) {
if (!is_array($id)) {
$id = explode(',', $id);
}
}
if ($notice_order_id){
if(!is_array($notice_order_id)){
if ($notice_order_id) {
if (!is_array($notice_order_id)) {
$notice_order_id = explode(',', $notice_order_id);
}
}
$data = Project::with(['deploy_build', 'deploy_optimize', 'online_check'])
->whereHas('deploy_build', function ($query) use ($plan) {
if ($plan && in_array($plan, Project::planMap())) {
$query->where('plan', array_search($plan, Project::planMap()));
}
if ($plan && in_array($plan, Project::seoMap())) {
$query->where('seo_plan', array_search($plan, Project::seoMap()));
}
})
->where('delete_status', 0)
->where(function ($query) use ($channel_id, $type, $company, $id, $notice_order_id, $start_time, $end_time){
->where(function ($query) use ($channel_id, $type, $company, $id, $notice_order_id, $start_time, $end_time) {
if ($channel_id) {
$query->where('channel->channel_id', $channel_id);
}
... ... @@ -851,12 +890,12 @@ class ProjectController extends BaseController
if ($notice_order_id) {
$query->whereIn('notice_order_id', $notice_order_id);
}
if ($start_time && $end_time ) {
if ($start_time && $end_time) {
$query->whereBetween('uptime', [$start_time, $end_time]);
}
})->orderBy($order_by_field, $order_by_sort)->paginate($size)->toArray();
$list = [];
foreach ($data['list'] as $item){
foreach ($data['list'] as $item) {
$domain = '';
if ($item['deploy_optimize']['domain']) {
$domain_pro = DomainInfo::where('id', $item['deploy_optimize']['domain'])->first();
... ... @@ -882,6 +921,8 @@ class ProjectController extends BaseController
"last_inquiry_time" => $item['last_inquiry_time'],
"plan" => $item['deploy_build']['plan'] ?: 0,
"plan_text" => Project::planMap()[$item['deploy_build']['plan']] ?? '',
"geo_plan" => $item['deploy_build']['seo_plan'] ?: 0,
"geo_plan_text" => Project::seoMap()[$item['deploy_build']['seo_plan']] ?? '',
"start_date" => $item['deploy_optimize']['start_date'] ?? '',
"domain" => $domain ? 'https://' . $domain : $domain,
"test_domain" => $item['deploy_build']['test_domain'] ?? '',
... ... @@ -906,7 +947,8 @@ class ProjectController extends BaseController
$list[] = $param;
}
$data['list'] = $list;
$this->response('success',Code::SUCCESS, $data);
$data['plan'] = array_merge(Project::planMap(), Project::seoMap());
$this->response('success', Code::SUCCESS, $data);
}
/**
... ... @@ -916,9 +958,10 @@ class ProjectController extends BaseController
* @method :post
* @time :2023/9/28 9:09
*/
public function getRenewLog(RenewLog $renewLog){
$lists = $renewLog->lists($this->map,$this->page,$this->row,$this->order);
$this->response('success',Code::SUCCESS,$lists);
public function getRenewLog(RenewLog $renewLog)
{
$lists = $renewLog->lists($this->map, $this->page, $this->row, $this->order);
$this->response('success', Code::SUCCESS, $lists);
}
/**
... ... @@ -928,20 +971,21 @@ class ProjectController extends BaseController
* @method :post
* @time :2023/11/8 11:17
*/
public function tdkList(){
public function tdkList()
{
$this->request->validate([
'project_id'=>'required',
],[
'project_id' => 'required',
], [
'project_id.required' => '项目ID不能为空',
]);
$tdkModel = new ProjectUpdateTdk();
$list = $tdkModel->list(['project_id'=>$this->map['project_id']],'id',['*'],'desc',5);
if(!empty($list)){
foreach ($list as $k => $v){
$list = $tdkModel->list(['project_id' => $this->map['project_id']], 'id', ['*'], 'desc', 5);
if (!empty($list)) {
foreach ($list as $k => $v) {
$list[$k] = $this->handleTdk($v);
}
}
$this->response('success',Code::SUCCESS,$list);
$this->response('success', Code::SUCCESS, $list);
}
/**
... ... @@ -951,28 +995,29 @@ class ProjectController extends BaseController
* @method :post
* @time :2023/12/29 11:16
*/
public function handleTdk($item){
public function handleTdk($item)
{
$data = [
'gl_product'=>'产品',
'gl_product_category'=>'产品分类',
'gl_product_keyword'=>'产品关键字',
'gl_news'=>'新闻',
'gl_news_category'=>'新闻分类',
'gl_blog'=>'博客',
'gl_blog_category'=>'博客分类',
'gl_web_custom_template'=>'自定义页面',
'gl_product' => '产品',
'gl_product_category' => '产品分类',
'gl_product_keyword' => '产品关键字',
'gl_news' => '新闻',
'gl_news_category' => '新闻分类',
'gl_blog' => '博客',
'gl_blog_category' => '博客分类',
'gl_web_custom_template' => '自定义页面',
];
foreach ($data as $k => $v){
if(isset($item[$k])){
foreach ($data as $k => $v) {
if (isset($item[$k])) {
$data = Arr::s2a($item[$k]);
//{"des": 3500, "title": 0, "keyword": 3501, "total_page": 8458, "keyword_title": 3500, "keyword_content": 3500}
$item[$k] = $v.'总条数:'.$data['total_page'].
', title更新数:'.$data['title'].
',keyword更新数:'.$data['keyword'].
',des更新数:'.$data['des'];
if($k == 'gl_product_keyword'){
$item[$k] .= ',keyword_title更新数:'.($data['keyword_title']??0);
$item[$k] .= ',keyword_content更新数:'.($data['keyword_content']??0);
$item[$k] = $v . '总条数:' . $data['total_page'] .
', title更新数:' . $data['title'] .
',keyword更新数:' . $data['keyword'] .
',des更新数:' . $data['des'];
if ($k == 'gl_product_keyword') {
$item[$k] .= ',keyword_title更新数:' . ($data['keyword_title'] ?? 0);
$item[$k] .= ',keyword_content更新数:' . ($data['keyword_content'] ?? 0);
}
}
... ... @@ -987,14 +1032,15 @@ class ProjectController extends BaseController
* @method :post
* @time :2023/11/8 14:17
*/
public function copyProject(ProjectLogic $logic){
public function copyProject(ProjectLogic $logic)
{
$this->request->validate([
'project_id'=>'required',
],[
'project_id' => 'required',
], [
'project_id.required' => 'project_id不能为空',
]);
$data = $logic->copyProject();
$this->response('success',Code::SUCCESS,$data);
$this->response('success', Code::SUCCESS, $data);
}
/**
... ... @@ -1002,14 +1048,15 @@ class ProjectController extends BaseController
* @author zbj
* @date 2023/11/10
*/
public function site_token(ProjectLogic $logic){
public function site_token(ProjectLogic $logic)
{
$this->request->validate([
'project_id'=>'required',
],[
'project_id' => 'required',
], [
'project_id.required' => 'project_id不能为空',
]);
$token = $logic->getSiteToken($this->map);
$this->response('success',Code::SUCCESS,['site_token' => $token]);
$this->response('success', Code::SUCCESS, ['site_token' => $token]);
}
/**
... ... @@ -1019,12 +1066,13 @@ class ProjectController extends BaseController
* @method :post
* @time :2023/11/17 15:23
*/
public function saveOtherProject(ProjectLogic $logic){
public function saveOtherProject(ProjectLogic $logic)
{
$this->request->validate([
'id'=>'required',
'aicc'=>'required',
'hagro'=>'required',
],[
'id' => 'required',
'aicc' => 'required',
'hagro' => 'required',
], [
'id.required' => 'id不能为空',
'aicc.required' => 'aicc是否开启不能为空',
'hagro.required' => 'hagro是否开启不能为空',
... ... @@ -1040,14 +1088,15 @@ class ProjectController extends BaseController
* @method :post
* @time :2023/11/17 15:23
*/
public function getOtherProject(ProjectLogic $logic){
public function getOtherProject(ProjectLogic $logic)
{
$this->request->validate([
'id'=>'required',
],[
'id' => 'required',
], [
'id.required' => 'id不能为空',
]);
$info = $logic->getOtherProject();
$this->response('success',Code::SUCCESS,$info);
$this->response('success', Code::SUCCESS, $info);
}
/**
... ... @@ -1057,20 +1106,21 @@ class ProjectController extends BaseController
* @method :post
* @time :2023/11/17 16:08
*/
public function getChannel(){
public function getChannel()
{
$zoneModel = new Zone();
$zone_list = $zoneModel->list();
$channelModel = new Channel();
$channelUserModel = new User();
foreach ($zone_list as $k => $v){
$channel_list = $channelModel->list(['zone_id'=>$v['id']]);
foreach ($channel_list as $k1 => $v1){
$user_list = $channelUserModel->list(['channel_id'=>$v1['id']]);
foreach ($zone_list as $k => $v) {
$channel_list = $channelModel->list(['zone_id' => $v['id']]);
foreach ($channel_list as $k1 => $v1) {
$user_list = $channelUserModel->list(['channel_id' => $v1['id']]);
$channel_list[$k1]['sub'] = $user_list;
}
$zone_list[$k]['sub'] = $channel_list;
}
$this->response('success',Code::SUCCESS,$zone_list);
$this->response('success', Code::SUCCESS, $zone_list);
}
/**
... ... @@ -1080,10 +1130,11 @@ class ProjectController extends BaseController
* @method :post
* @time :2023/11/30 10:59
*/
public function languageLists(){
public function languageLists()
{
$webLanguageModel = new WebLanguage();
$lists = $webLanguageModel->list();
$this->response('success',Code::SUCCESS,$lists);
$this->response('success', Code::SUCCESS, $lists);
}
/**
... ... @@ -1091,8 +1142,9 @@ class ProjectController extends BaseController
* @author zbj
* @date 2024/1/19
*/
public function countryLists(){
$this->response('success',Code::SUCCESS, Country::getCountryList());
public function countryLists()
{
$this->response('success', Code::SUCCESS, Country::getCountryList());
}
/**
... ... @@ -1100,10 +1152,11 @@ class ProjectController extends BaseController
* @author zbj
* @date 2024/1/19
*/
public function saveInquiryFilterConfig(ProjectLogic $logic){
public function saveInquiryFilterConfig(ProjectLogic $logic)
{
$this->request->validate([
'project_id'=>'required',
],[
'project_id' => 'required',
], [
'project_id.required' => '项目id不能为空',
]);
$logic->saveInquiryFilterConfig($this->param);
... ... @@ -1115,10 +1168,11 @@ class ProjectController extends BaseController
* @author zbj
* @date 2024/3/29
*/
public function saveWebTrafficConfig(ProjectLogic $logic){
public function saveWebTrafficConfig(ProjectLogic $logic)
{
$this->request->validate([
'project_id'=>'required',
],[
'project_id' => 'required',
], [
'project_id.required' => '项目id不能为空',
]);
$logic->saveWebTrafficConfig($this->param);
... ... @@ -1132,28 +1186,29 @@ class ProjectController extends BaseController
* @method :post
* @time :2024/4/7 10:41
*/
public function updateProjectManager(ProjectLogic $logic){
public function updateProjectManager(ProjectLogic $logic)
{
$this->request->validate([
'old_id'=>'required',
'new_id'=>'required'
],[
'old_id' => 'required',
'new_id' => 'required'
], [
'old_id.required' => '参数不能为空',
'new_id.required' => '参数不能为空',
]);
//查看当前用户是否存在
$hrModel = new ManageHr();
$oldHrInfo = $hrModel->read(['id'=>$this->param['old_id']]);
if($oldHrInfo === false){
$this->response('当前用户不存在',Code::SYSTEM_ERROR);
$oldHrInfo = $hrModel->read(['id' => $this->param['old_id']]);
if ($oldHrInfo === false) {
$this->response('当前用户不存在', Code::SYSTEM_ERROR);
}
$newHrInfo = $hrModel->read(['id'=>$this->param['new_id'],'status'=>1]);
if($newHrInfo === false){
$this->response('变更的用户不存在',Code::SYSTEM_ERROR);
$newHrInfo = $hrModel->read(['id' => $this->param['new_id'], 'status' => 1]);
if ($newHrInfo === false) {
$this->response('变更的用户不存在', Code::SYSTEM_ERROR);
}
if($oldHrInfo['entry_position'] != $newHrInfo['entry_position']){
$this->response('不同岗位不允许变更',Code::SYSTEM_ERROR);
if ($oldHrInfo['entry_position'] != $newHrInfo['entry_position']) {
$this->response('不同岗位不允许变更', Code::SYSTEM_ERROR);
}
$logic->getManagerFiled($newHrInfo['entry_position'],$this->param['old_id'],$this->param['new_id'],$this->param['project_id'] ?? []);
$logic->getManagerFiled($newHrInfo['entry_position'], $this->param['old_id'], $this->param['new_id'], $this->param['project_id'] ?? []);
$this->response('success');
}
... ... @@ -1164,16 +1219,17 @@ class ProjectController extends BaseController
* @method :post
* @time :2024/6/19 10:07
*/
public function setIsParticiple(){
public function setIsParticiple()
{
$this->request->validate([
'project_id'=>'required',
'is_participle'=>'required'
],[
'project_id' => 'required',
'is_participle' => 'required'
], [
'project_id.required' => '项目id不能为空',
'is_participle.required' => '项目id不能为空',
]);
$deployBuildModel = new DeployBuild();
$deployBuildModel->edit(['is_participle'=>$this->param['is_participle']],['project_id'=>$this->param['project_id']]);
$deployBuildModel->edit(['is_participle' => $this->param['is_participle']], ['project_id' => $this->param['project_id']]);
$this->response('success');
}
... ... @@ -1185,54 +1241,55 @@ class ProjectController extends BaseController
* @method :post
* @time :2024/7/29 17:12
*/
public function saveSiteStatus(){
public function saveSiteStatus()
{
$this->request->validate([
'id'=>'required',
'site_status'=>'required'
],[
'id' => 'required',
'site_status' => 'required'
], [
'id.required' => '项目id不能为空',
'site_status.required' => '状态不能为空',
]);
//获取项目数据
$projectModel = new Project();
$projectInfo = $projectModel->read(['id'=>$this->param['id']],['project_type','serve_id','site_status','site_token']);
if(!$projectInfo){
$projectInfo = $projectModel->read(['id' => $this->param['id']], ['project_type', 'serve_id', 'site_status', 'site_token']);
if (!$projectInfo) {
$this->fail('获取项目数据失败');
}
if($projectInfo['site_status'] == $this->param['site_status']){
if ($projectInfo['site_status'] == $this->param['site_status']) {
$this->response('success');
}
//获取服务器数据
$serverIpModel = new ServersIp();
$serversIpInfo = $serverIpModel->read(['id' => $projectInfo['serve_id']], ['servers_id']);
if(!$serversIpInfo){
if (!$serversIpInfo) {
$this->fail('获取项目所属服务器失败');
}
if($serversIpInfo['servers_id'] == ServerConfig::SELF_SITE_ID){
if ($serversIpInfo['servers_id'] == ServerConfig::SELF_SITE_ID) {
//自建站项目
if($this->param['site_status'] == 1){
if ($this->param['site_status'] == 1) {
//关闭站点
$site_token = $projectInfo['site_token'] ? $projectInfo['site_token'].'_expired' : '';
}else{
$site_token = $projectInfo['site_token'] ? $projectInfo['site_token'] . '_expired' : '';
} else {
//开启站点
$site_token = str_replace('_expired','',$projectInfo['site_token']);
$site_token = str_replace('_expired', '', $projectInfo['site_token']);
}
$projectModel->edit(['site_status'=>$this->param['site_status'],'site_token'=>$site_token],['id'=>$this->param['id']]);
}else{
$projectModel->edit(['site_status' => $this->param['site_status'], 'site_token' => $site_token], ['id' => $this->param['id']]);
} else {
//普通项目
//获取域名数据
$domainModel = new DomainInfoModel();
$domainInfo = $domainModel->read(['project_id'=>$this->param['id']],['id','domain','amp_status']);
if(!$domainInfo){
$domainInfo = $domainModel->read(['project_id' => $this->param['id']], ['id', 'domain', 'amp_status']);
if (!$domainInfo) {
$this->fail('获取域名数据失败');
}
if($this->param['site_status'] == 1){
if ($this->param['site_status'] == 1) {
//关闭站点:通知C端
$re = curl_get('https://'.$domainInfo['domain'].'/api/stop_or_start_website');
if(isset($re['status']) && $re['status'] !== 200){
$re = curl_get('https://' . $domainInfo['domain'] . '/api/stop_or_start_website');
if (isset($re['status']) && $re['status'] !== 200) {
$this->fail($re['message']);
}
}else{
} else {
//开启站点:创建建站任务
if ($projectInfo['project_type'] == Project::PROJECT_TYPE_SEO) {
$type = DomainCreateTask::TYPE_BLOG;
... ... @@ -1253,7 +1310,7 @@ class ProjectController extends BaseController
]);
}
if($domainInfo['amp_status']){
if ($domainInfo['amp_status']) {
$task_info_amp = $domainCreateTaskModel->read(['type' => DomainCreateTask::TYPE_AMP, 'domain_id' => $domainInfo['id'], 'is_open' => DomainCreateTask::IS_OPEN, 'status' => ['<', DomainCreateTask::STATUS_SUC]], ['id']);
if (!$task_info_amp) {
$domainCreateTaskModel->add([
... ... @@ -1266,7 +1323,7 @@ class ProjectController extends BaseController
}
}
}
$projectModel->edit(['site_status'=>$this->param['site_status']],['id'=>$this->param['id']]);
$projectModel->edit(['site_status' => $this->param['site_status']], ['id' => $this->param['id']]);
}
$this->response('success');
}
... ... @@ -1290,15 +1347,16 @@ class ProjectController extends BaseController
* @method :post
* @time :2025/6/10 10:51
*/
public function generateCountCharts(){
public function generateCountCharts()
{
$this->request->validate([
'project_id'=>'required',
],[
'project_id' => 'required',
], [
'project_id.required' => '项目id不能为空',
]);
$noticeModel = new NoticeLog();
$info = $noticeModel->read(['type'=>NoticeLog::TYPE_GENERATE_COUNT_CHARTS,'status'=>0,'data'=>['like','%"'.$this->param['project_id'].'"%']]);
if($info !== false){
$info = $noticeModel->read(['type' => NoticeLog::TYPE_GENERATE_COUNT_CHARTS, 'status' => 0, 'data' => ['like', '%"' . $this->param['project_id'] . '"%']]);
if ($info !== false) {
$this->fail('当前数据在生成中');
}
NoticeLog::createLog(NoticeLog::TYPE_GENERATE_COUNT_CHARTS, ['project_id' => $this->param['project_id']]);
... ... @@ -1312,16 +1370,17 @@ class ProjectController extends BaseController
* @method :post
* @time :2025/7/2 11:04
*/
public function updateTdk(){
public function updateTdk()
{
$this->request->validate([
'project_id'=>'required',
'url'=>'required'
],[
'project_id' => 'required',
'url' => 'required'
], [
'project_id.required' => '项目id不能为空',
'url.required' => '文件路径不为空',
]);
NoticeLog::createLog(NoticeLog::TYPE_UPDATE_PROJECT_TDK, ['project_id' => $this->param['project_id'],'url'=>$this->param['url']]);
$this->response('success',Code::SUCCESS,['url'=>$this->param['url']]);
NoticeLog::createLog(NoticeLog::TYPE_UPDATE_PROJECT_TDK, ['project_id' => $this->param['project_id'], 'url' => $this->param['url']]);
$this->response('success', Code::SUCCESS, ['url' => $this->param['url']]);
}
/**
... ... @@ -1331,11 +1390,12 @@ class ProjectController extends BaseController
* @method :post
* @time :2025/8/5 9:50
*/
public function videoSetting(){
public function videoSetting()
{
$videoModel = new AiVideoTask();
$data['videoSetting'] = $videoModel->videoSetting();
$data['videoFrequency'] =$videoModel->videoFrequency();
$this->response('success',Code::SUCCESS,$data);
$data['videoFrequency'] = $videoModel->videoFrequency();
$this->response('success', Code::SUCCESS, $data);
}
/**
... ...