作者 刘锟

Merge remote-tracking branch 'origin/develop' into akun

正在显示 109 个修改的文件 包含 2657 行增加890 行删除
... ... @@ -4,12 +4,15 @@ namespace App\Console\Commands\DayCount;
use App\Helper\Common;
use App\Helper\FormGlobalsoApi;
use App\Models\Domain\DomainInfo;
use App\Models\Project\DeployBuild;
use App\Models\Project\DeployOptimize;
use App\Models\Project\Project;
use App\Services\ProjectServer;
use Carbon\Carbon;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class Count extends Command
{
... ... @@ -28,6 +31,7 @@ class Count extends Command
* @var string
*/
protected $description = '统计昨日数据';
/**
* @name :(定时执行生成昨日数据统计)handle
* @author :lyh
... ... @@ -39,35 +43,51 @@ class Count extends Command
$list = DB::table('gl_project')->where('gl_project.extend_type','!=',5)
->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')
->select($this->selectParam())->get()->toArray();
$data = [];
$yesterday = Carbon::yesterday()->toDateString();
foreach ($list as $v){
$v = (array)$v;
if($v['domain'] != ''){
$v['test_domain'] = $v['domain'];
->select($this->selectParam())->get();
try {
if(!empty($list)){
$list = $list->toArray();
$data = [];
$yesterday = Carbon::yesterday()->toDateString();
$domainInfo = new DomainInfo();
foreach ($list as $v){
$v = (array)$v;
if($v['type'] == Project::TYPE_ZERO){
continue;
}
if(!empty($v['domain'])){
$info = $domainInfo->read(['id'=>$v['domain']]);
if($info !== false){
$v['test_domain'] = $info['domain'];
}
}
$arr = [];
//统计时间
$arr['date'] = $yesterday;
ProjectServer::useProject($v['id']);
//pv统计
$arr['pv_num'] = $this->pv_num($yesterday,$v['test_domain']);
//ip统计
$arr['ip_num'] = $this->ip_num($yesterday,$v['test_domain']);
DB::disconnect('custom_mysql');
//服务达标天数
$arr['compliance_day'] = $this->compliance_day($v['id']);
//剩余服务时常
$arr['service_day'] = $v['remain_day'];
//项目id
$arr['project_id'] = $v['project_id'];
$arr['created_at'] = date('Y-m-d H:i:s');
$arr['updated_at'] = date('Y-m-d H:i:s');
//询盘统计
$arr = $this->inquiry($arr,$v['test_domain']);
$data[] = $arr;
}
//判断数据是否存在
DB::table('gl_count')->insert($data);
}
$arr = [];
//统计时间
$arr['date'] = $yesterday;
//pv统计
$arr['pv_num'] = $this->pv_num($yesterday,$v['test_domain']);
//ip统计
$arr['ip_num'] = $this->ip_num($yesterday,$v['test_domain']);
//服务达标天数
$arr['compliance_day'] = $this->compliance_day($v['test_domain']);
//剩余服务时常
$arr['service_day'] = ((int)$v['service_duration'] - (int)$arr['compliance_day']) > 0 ? ((int)$v['service_duration'] - (int)$arr['compliance_day']) : 0;
//项目id
$arr['project_id'] = $v['project_id'];
$arr['created_at'] = date('Y-m-d H:i:s');
$arr['updated_at'] = date('Y-m-d H:i:s');
//询盘统计
$arr = $this->inquiry($arr,$v['test_domain']);
$data[] = $arr;
}catch (\Exception $e){
Log::error('同步数据执行失败');
}
//判断数据是否存在
DB::table('gl_count')->insert($data);
echo $this->error;
}
... ... @@ -78,7 +98,7 @@ class Count extends Command
* @time :2023/6/14 15:40
*/
public function pv_num($yesterday,$domain){
$pv = DB::table('gl_customer_visit_item')->whereDate('updated_date', $yesterday)->where('domain',$domain)->count();
$pv = DB::connection('custom_mysql')->table('gl_customer_visit_item')->whereDate('updated_date', $yesterday)->where('domain',$domain)->count();
return $pv;
}
... ... @@ -89,7 +109,7 @@ class Count extends Command
* @time :2023/6/14 15:40
*/
public function ip_num($yesterday,$domain){
$ip = DB::table('gl_customer_visit')->whereDate('updated_date', $yesterday)->where('domain',$domain)->count();
$ip = DB::connection('custom_mysql')->table('gl_customer_visit')->whereDate('updated_date', $yesterday)->where('domain',$domain)->count();
return $ip;
}
... ... @@ -150,8 +170,10 @@ class Count extends Command
*/
public function selectParam(){
$select = [
'gl_project.id AS user_id',
'gl_project.id AS id',
'gl_project.type AS type',
'gl_project.extend_type AS extend_type',
'gl_project.remain_day AS remain_day',
'gl_project_deploy_build.test_domain AS test_domain',
'gl_project_deploy_optimize.domain AS domain',
'gl_project_deploy_build.project_id AS project_id',
... ...
... ... @@ -38,7 +38,7 @@ class InquiryDelay extends Command
{
$inquiryInfoModel = new InquiryInfo();
$param = $inquiryInfoModel->formatQuery(['status'=>$inquiryInfoModel::STATUS_FOUR])->orderBy('send_time','asc')->first();
if($param !== false){
if(!empty($param)){
$time = date('Y-m-d H:i:s');
if($time >= $param['send_time']){
$data = [];
... ...
<?php
/**
* @remark :
* @name :DomainInfo.php
* @author :lyh
* @method :post
* @time :2023/9/11 14:37
*/
namespace App\Console\Commands\Domain;
use Illuminate\Console\Command;
use App\Models\Domain\DomainInfo as DomainInfoModel;
class DomainInfo extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'domain_info';
/**
* The console command description.
*
* @var string
*/
protected $description = '域名相关';
/**
* @remark :更新证书+证书有效时间
* @name :handle
* @author :lyh
* @method :post
* @time :2023/9/11 15:09
*/
public function handle(){
$domainModel = new DomainInfoModel();
$map = ['status'=>['!=',2]];
$list = $domainModel->list($map);
foreach ($list as $v){
$ssl = $this->updateDomainSsl($v['domain']);
$time = $this->updateDomain($v['domain']);
$data = [
'certificate_start_time'=>$ssl['from'],
'certificate_end_time'=>$ssl['to'],
'domain_start_time'=>$time['start'],
'domain_end_time'=>$time['end']
];
$domainModel->edit($data,['id'=>$v['id']]);
}
return 1;
}
/**
* @remark :更新域名证书
* @name :updateDomainSsl
* @author :lyh
* @method :post
* @time :2023/9/11 15:07
*/
public function updateDomainSsl($domain){
try {
$context = stream_context_create([
'ssl' => [
'capture_peer_cert' => true,
'capture_peer_cert_chain' => false,
],
]);
$stream = stream_socket_client('ssl://'.$domain.':443', $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $context);
if(!$stream) {
die("Failed to connect: $errno - $errstr");
}
$remote_cert = stream_context_get_params($stream)['options']['ssl']['peer_certificate'];
if(!$remote_cert) {
die("Failed to retrieve certificate");
}
$valid_from = date('Y-m-d H:i:s', openssl_x509_parse($remote_cert)['validFrom_time_t']);
$valid_to = date('Y-m-d H:i:s', openssl_x509_parse($remote_cert)['validTo_time_t']);
fclose($stream);
}catch (\Exception $e){
$valid_from = date('Y-m-d H:i:s');
$valid_to = date('Y-m-d H:i:s');
}
return ['from'=>$valid_from,'to'=>$valid_to];
}
/**
* @remark :更新域名有限时间
* @name :updateDomain
* @author :lyh
* @method :post
* @time :2023/9/11 15:11
*/
public function updateDomain($domain){
$url = 'http://openai.waimaoq.com/v1/whois_api?domain='.$domain;
$response = http_get($url);
$start = '';
$end = '';
if($response['code'] == 200){
$start = $response['text']['creation_date'];
$end = $response['text']['expiration_date'];
}
return ['start'=>$start,'end'=>$end];
}
}
... ...
... ... @@ -43,8 +43,13 @@ class ImportManager extends Command
$info = $model->read(['type'=>5]);
$values = json_decode($info['values']);
$values = array_reverse($values);
$hrModel = new ManageHr();
foreach ($values as $k => $v){
$v = (array)$v;
$info = $hrModel->read(['mobile'=>$v['mobile']]);
if($info !== false){
continue;
}
$data = [
'name'=>$v['name'],
'mobile'=>$v['mobile'],
... ... @@ -97,22 +102,26 @@ class ImportManager extends Command
if($entry_position !== false){
$entry_position = $entry_position['id'];
}else{
$entry_position = '';
$entry_position = 0;
}
//获取级别
$jobLevelModel = new JobLevel();
$p_level = $jobLevelModel->read(['name'=>$v['p_level']]);
if($entry_position !== false){
$p_level = $p_level['id'];
if(!empty($v['p_level'])){
$p_level = $jobLevelModel->read(['name'=>$v['p_level']]);
if($p_level !== false){
$p_level = $p_level['id'];
}else{
$p_level = 0;
}
}else{
$p_level = '';
$p_level = 0;
}
$manager_data = [
'manage_id'=>$manager_id ?? '',
'manage_id'=>$manager_id,
'name'=>$v['name'],
'id_card'=>$v['id_card'],
'mobile'=>$v['mobile'],
'birthday'=>$v['birthday'],
'birthday'=>!empty($v['birthday']) ? $v['birthday'] : date('Y-m-d'),
'address'=>$v['address'],
'sex'=>$v['sex'],
'nationality'=>$v['nationality'],
... ... @@ -121,7 +130,7 @@ class ImportManager extends Command
'major'=>$v['major'],
'graduate_school'=>$v['graduate_school'],
'english_level'=>$v['english_level'],
'entry_position'=>$entry_position,
'entry_position'=>$entry_position ?? 0,
'p_level'=>$p_level,
'residential_address'=>$v['residential_address'],
'emergency_contact'=>$v['emergency_contact'],
... ... @@ -134,12 +143,11 @@ class ImportManager extends Command
'dangyuan'=>$v['dangyuan'],
'dangzhibu'=>$v['dangzhibu'],
'dang_address'=>$v['dang_address'],
'join_date'=>$v['join_date'],
'status'=>($v['status'] == '在职') ? 1 : 2,
'join_date'=>!empty($v['join_date']) ? $v['join_date'] : date('Y-m-d'),
'status'=> 1,
'computer_account'=>$v['computer_account'],
'qq_account'=>$v['qq_account']
];
$hrModel = new ManageHr();
$hrModel->add($manager_data);
}
return 1;
... ...
<?php
namespace App\Console\Commands;
use App\Helper\Arr;
use App\Helper\FormGlobalsoApi;
use App\Http\Logic\Bside\InquiryLogic;
use App\Models\Product\Category;
use App\Models\Product\Product;
use App\Models\Project\OnlineCheck;
use App\Models\Project\Project;
use App\Models\RankData\RankData as GoogleRankModel;
use App\Models\RouteMap\RouteMap;
use GuzzleHttp\Client;
use GuzzleHttp\Promise\Utils;
use Illuminate\Console\Command;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
/**
* 最近一次询盘
* Class InquiryList
* @package App\Console\Commands
* @author zbj
* @date 2023/9/11
*/
class LastInquiry extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'last_inquiry';
/**
* The console command description.
*
* @var string
*/
protected $description = '询盘列表';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* @return bool
*/
public function handle()
{
$list = Project::with('deploy_optimize')->whereIn('type', [2,3,4])->get();
foreach ($list as $item){
if(empty($item['deploy_optimize']['domain'])){
continue;
}
$api = new FormGlobalsoApi();
$res = $api->getInquiryList($item['deploy_optimize']['domain']);
if($res && $res['status'] == 200){
if(empty($res['data']['data'][0])){
continue;
}
$item->last_inquiry_time = $res['data']['data'][0]['submit_time'];
$item->save();
}
}
}
}
... ...
... ... @@ -3,6 +3,9 @@
namespace App\Console\Commands\MonthlyCount;
use App\Helper\FormGlobalsoApi;
use App\Models\Domain\DomainInfo;
use App\Models\Project\Project;
use App\Services\ProjectServer;
use Carbon\Carbon;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
... ... @@ -41,16 +44,25 @@ class InquiryMonthlyCount extends Command
$startTime = Carbon::now()->subMonth()->startOfMonth()->toDateString();
// 获取上个月的结束时间
$endTime = Carbon::now()->subMonth()->endOfMonth()->toDateString();
$domainInfo = new DomainInfo();
foreach ($list as $value){
$value = (array)$value;
if($value['domain'] != ''){
$value['test_domain'] = $value['domain'];
if($value['type'] == Project::TYPE_ZERO){
continue;
}
if(!empty($value['domain'])){
$info = $domainInfo->read(['id'=>$value['domain']]);
if($info !== false){
$value['test_domain'] = $value['domain'];
}
}
$arr = [];
//按月统计询盘记录
$arr = $this->inquiryCount($arr,$startTime,$endTime,$value['test_domain']);
$arr = $this->flowCount($arr,$startTime,$endTime,$value['project_id']);
ProjectServer::useProject($value['project_id']);
$arr = $this->sourceCount($arr,$value['test_domain'],$startTime,$endTime);
DB::disconnect('custom_mysql');
$arr['created_at'] = date('Y-m-d H:i:s');
$arr['updated_at'] = date('Y-m-d H:i:s');
$arr['project_id'] = $value['project_id'];
... ... @@ -128,21 +140,21 @@ class InquiryMonthlyCount extends Command
*/
public function sourceCount(&$arr,$domain,$startTime,$endTime){
//访问来源前10
$source = DB::table('gl_customer_visit')
$source = DB::connection('custom_mysql')->table('gl_customer_visit')
->select('referrer_url', DB::raw('COUNT(*) as count'))
->groupBy('referrer_url')->where(['domain'=>$domain])
->whereBetween('updated_date', [$startTime,$endTime])
->orderByDesc('count')->limit(10)->get()->toArray();
$arr['source'] = json_encode($source);
//访问国家前15
$source_country = DB::table('gl_customer_visit')
$source_country = DB::connection('custom_mysql')->table('gl_customer_visit')
->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv'))
->groupBy('country')->where(['domain'=>$domain])
->whereBetween('updated_date', [$startTime,$endTime])
->orderBy('ip','desc')->limit(15)->get()->toArray();
$arr['source_country'] = json_encode($source_country);
//受访界面前15
$referrer_url = DB::table('gl_customer_visit')
$referrer_url = DB::connection('custom_mysql')->table('gl_customer_visit')
->select('url',DB::raw('COUNT(*) as num'))
->orderBy('num','desc')->where(['domain'=>$domain])
->whereBetween('updated_date', [$startTime,$endTime])
... ... @@ -150,7 +162,7 @@ class InquiryMonthlyCount extends Command
->limit(15)->get()->toArray();
$arr['referrer_url'] = json_encode($referrer_url);
//访问端口
$referrer_port = DB::table('gl_customer_visit')
$referrer_port = DB::connection('custom_mysql')->table('gl_customer_visit')
->select('device_port',DB::raw('COUNT(*) as num'))
->orderBy('num','desc')->where(['domain'=>$domain])
->whereBetween('updated_date', [$startTime,$endTime])
... ... @@ -168,7 +180,8 @@ class InquiryMonthlyCount extends Command
*/
public function selectParam(){
$select = [
'gl_project.id AS user_id',
'gl_project.id AS id',
'gl_project.type AS type',
'gl_project.extend_type AS extend_type',
'gl_project_deploy_build.test_domain AS test_domain',
'gl_project_deploy_optimize.domain AS domain',
... ...
... ... @@ -6,6 +6,7 @@ use App\Helper\Arr;
use App\Helper\SemrushApi;
use App\Models\RankData\ExternalLinks as ExternalLinksModel;
use App\Models\Project\DeployOptimize;
use App\Utils\LogUtils;
/**
* Class ExternalLinks
... ... @@ -39,7 +40,7 @@ class ExternalLinks extends BaseCommands
$semrushApi = new SemrushApi();
//有排名api编号的项目
$list = DeployOptimize::where('api_no', '>', 0)->pluck('domain', 'project_id')->toArray();
LogUtils::info('start rank_data_external_links:' . count($list));
foreach ($list as $project_id => $domain) {
if(!$domain){
continue;
... ...
... ... @@ -5,6 +5,7 @@ namespace App\Console\Commands\RankData;
use App\Helper\QuanqiusouApi;
use App\Models\Project\DeployOptimize;
use App\Models\RankData\IndexedPages as IndexedPagesModel;
use App\Utils\LogUtils;
/**
* Class IndexedPages
... ... @@ -38,7 +39,7 @@ class IndexedPages extends BaseCommands
$api = new QuanqiusouApi();
//有排名api编号的项目
$list = DeployOptimize::where('api_no', '>', 0)->pluck('api_no', 'project_id')->toArray();
LogUtils::info('start rank_data_indexed_pages:' . count($list));
foreach ($list as $project_id => $api_no) {
$model = IndexedPagesModel::where('project_id', $project_id)->first();
if($model && $model->updated_date == getThisWeekStarDate()){
... ...
... ... @@ -6,7 +6,9 @@ use App\Helper\Arr;
use App\Helper\QuanqiusouApi;
use App\Models\Project\DeployBuild;
use App\Models\Project\DeployOptimize;
use App\Models\Project\Project;
use App\Models\RankData\RankData as GoogleRankModel;
use App\Utils\LogUtils;
/**
* Class GoogleRank
... ... @@ -41,6 +43,7 @@ class RankData extends BaseCommands
$api = new QuanqiusouApi();
//有排名api编号的项目
$list = DeployOptimize::where('api_no', '>' , 0)->select('api_no','minor_languages','project_id')->get();
LogUtils::info('start rank_data:' . count($list));
//当日所有站点谷歌收录数据
$site_res = $api->getSiteRes();
if(!$site_res){
... ... @@ -141,11 +144,13 @@ class RankData extends BaseCommands
}
//关键词达标天数
$model->is_compliance = 0;
if($model->updated_date != date('Y-m-d')){
//保证关键词数
$keyword_num = DeployBuild::where('project_id', $project_id)->value('keyword_num');
if($first_page_num >= $keyword_num){
$model->compliance_day = $model->compliance_day + 1;
$model->is_compliance = 1;
}
}
... ...
... ... @@ -7,6 +7,7 @@ use App\Helper\Arr;
use App\Helper\QuanqiusouApi;
use App\Models\Project\DeployOptimize;
use App\Models\RankData\RankWeek as RankWeekModel;
use App\Utils\LogUtils;
/**
* Class WeekRank
... ... @@ -49,7 +50,7 @@ class RankWeek extends BaseCommands
$res = Arr::s2a($res);
//有排名api编号的项目
$list = DeployOptimize::where('api_no', '>', 0)->pluck('api_no', 'project_id')->toArray();
LogUtils::info('start rank_data_week:' . count($list));
foreach ($list as $project_id => $api_no) {
$rank_week = RankWeekModel::where('project_id', $project_id)->first();
if ($rank_week && $rank_week->updated_date == getThisWeekStarDate()) {
... ...
... ... @@ -5,6 +5,7 @@ namespace App\Console\Commands\RankData;
use App\Helper\SemrushApi;
use App\Models\RankData\RecommDomain as RecommDomainModel;
use App\Models\Project\DeployOptimize;
use App\Utils\LogUtils;
/**
* Class RecommDomain
... ... @@ -38,7 +39,7 @@ class RecommDomain extends BaseCommands
$semrushApi = new SemrushApi();
//有排名api编号的项目
$list = DeployOptimize::where('api_no', '>', 0)->pluck('domain', 'project_id')->toArray();
LogUtils::info('start rank_data_recomm_domain:' . count($list));
foreach ($list as $project_id => $domain) {
if(!$domain){
continue;
... ...
... ... @@ -6,6 +6,7 @@ use App\Helper\Arr;
use App\Helper\GoogleSpeedApi;
use App\Models\Project\DeployOptimize;
use App\Models\RankData\Speed as GoogleSpeedModel;
use App\Utils\LogUtils;
/**
* Class GoogleSpeed
... ... @@ -42,7 +43,7 @@ class Speed extends BaseCommands
//有排名api编号的项目
$list = DeployOptimize::where('api_no', '>', 0)->pluck('domain', 'project_id')->toArray();
LogUtils::info('start rank_data_speed:' . count($list));
foreach ($list as $project_id => $domain) {
$model = GoogleSpeedModel::where('project_id', $project_id)->first();
if ($model && $model->updated_date == getThisWeekStarDate()) {
... ...
<?php
namespace App\Console\Commands;
use App\Helper\Arr;
use App\Models\Product\Category;
use App\Models\Product\Product;
use App\Models\Project\OnlineCheck;
use App\Models\Project\Project;
use App\Models\RankData\RankData as GoogleRankModel;
use App\Models\RouteMap\RouteMap;
use GuzzleHttp\Client;
use GuzzleHttp\Promise\Utils;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
/**
* 剩余服务时长
* Class Traffic
* @package App\Console\Commands
* @author zbj
* @date 2023/5/18
*/
class RemainDay extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'remain_day';
/**
* The console command description.
*
* @var string
*/
protected $description = '网站服务剩余时长';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* @return bool
*/
public function handle()
{
$list = Project::whereIn('type', [2,3,4])->get();
foreach ($list as $item){
if($item['type'] == 3){
//排名达标天数
$compliance_day = GoogleRankModel::where(['project_id' => $item['id'], 'lang' => ''])->value('compliance_day') ?: 0;
$remain_day = $item['deploy_build']['service_duration'] - $compliance_day;
}else{
//审核上线后开始
$check_time = OnlineCheck::where('project_id', $item['id'])->where('status', 1)->value('created_at') ?: '';
if(!$check_time){
$remain_day = $item['deploy_build']['service_duration'];
}else{
$diff = time() - strtotime($check_time);
$remain_day = floor($diff / (60 * 60 * 24));
}
}
$item->remain_day = $remain_day > 0 ? $remain_day : 0;
$item->save();
}
}
}
... ...
... ... @@ -16,6 +16,7 @@ use App\Models\Project\ProjectRenew;
use App\Utils\LogUtils;
use Hashids\Hashids;
use Illuminate\Console\Command;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Http;
... ... @@ -57,37 +58,41 @@ class SyncProject extends Command
*/
public function handle()
{
$list = NoticeLog::where('type', NoticeLog::TYPE_PROJECT)->where('status', NoticeLog::STATUS_PENDING)->get();
foreach ($list as $item){
try {
$api = new OaGlobalsoApi();
$data = $api->order_info($item['data']['order_id']);
if(!$data || empty($data['data'])){
LogUtils::error('OaGlobalsoApi order_info error', $data);
$this->retry($item);
}
if($data['data']['order_type'] == '首次'){
$this->sync($data['data']);
while (true){
$list = NoticeLog::where('type', NoticeLog::TYPE_PROJECT)->where('status', NoticeLog::STATUS_PENDING)->get();
foreach ($list as $item){
try {
$api = new OaGlobalsoApi();
$data = $api->order_info($item['data']['order_id']);
if(!$data || empty($data['data'])){
LogUtils::error('OaGlobalsoApi order_info error', $data);
$this->retry($item);
}
if($data['data']['order_type'] == '首次'){
$this->sync($data['data']);
//同步aicc
if($data['data']['exclusive_aicc']){
$this->toAicc($data['data']);
//同步aicc
if($data['data']['exclusive_aicc']){
$this->toAicc($data['data']);
}
//同步hagro
if($data['data']['exclusive_hagro']){
$this->toHagro($data['data']);
}
}
//同步hagro
if($data['data']['exclusive_hagro']){
$this->toHagro($data['data']);
if($data['data']['order_type'] == '续费'){
$this->renewSync($data['data']);
}
$item->status = NoticeLog::STATUS_SUCCESS;
$item->save();
}catch (\Exception $e){
errorLog('项目同步失败', $item, $e);
$this->retry($item);
}
if($data['data']['order_type'] == '续费'){
$this->renewSync($data['data']);
}
$item->status = NoticeLog::STATUS_SUCCESS;
$item->save();
}catch (\Exception $e){
errorLog('项目同步失败', $item, $e);
$this->retry($item);
}
sleep(2);
}
}
/**
... ... @@ -190,14 +195,10 @@ class SyncProject extends Command
'project_after' => [],
'payment' => [
'amount' => $param['plan_price'],
'contract'=>$param['files'],
'bill'=>$param['images']
],
];
if(!empty($param['files'])){
$data['payment']['contract'] = json_encode($param['files']);
}
if(!empty($param['images'])){
$data['payment']['bill'] = json_encode($param['images']);
}
DB::beginTransaction();
try {
$id = $this->saveProject($data['project']);
... ... @@ -209,7 +210,7 @@ class SyncProject extends Command
DB::commit();
}catch (\Exception $e){
DB::rollBack();
errorLog('项目同步失败', $data, $e);
throw new \Exception($e->getMessage());
}
}
... ... @@ -242,7 +243,13 @@ class SyncProject extends Command
$param['channel'] = Arr::a2s($param['channel']);
}
$projectModel = new Project();
return $projectModel->addReturnId($param);
$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'];
}else{
return $projectModel->addReturnId($param);
}
}
/**
... ... @@ -254,7 +261,12 @@ class SyncProject extends Command
$param['project_id'] = $id;
//查询数据是否存在
$afterModel = new After();
return $afterModel->add($param);
$info = $afterModel->read(['project_id'=>$id]);
if($info !== false){
$afterModel->edit($param,['id'=>$info['id']]);
}else{
$afterModel->add($param);
}
}
/**
... ... @@ -267,13 +279,18 @@ class SyncProject extends Command
protected function savePayment($param,$id){
$param['project_id'] = $id;
$paymentModel= new Payment();
if(isset($param['contract']) && !empty($param['contract'])){
// if(isset($param['contract']) && !empty($param['contract'])){
$param['contract'] = Arr::a2s($param['contract']);
}
if(isset($param['bill']) && !empty($param['bill'])){
// }
// if(isset($param['bill']) && !empty($param['bill'])){
$param['bill'] = Arr::a2s($param['bill']);
// }
$info = $paymentModel->read(['project_id'=>$id]);
if($info !== false){
$paymentModel->edit($param,['id'=>$info['id']]);
}else{
$paymentModel->add($param);
}
return $paymentModel->add($param);
}
/**
... ... @@ -289,7 +306,12 @@ class SyncProject extends Command
$code = $hashids->encode($id);
$param['test_domain'] = 'https://v6-' . $code . '.globalso.site/';
$deployBuildModel = new DeployBuild();
return $deployBuildModel->add($param);
$info = $deployBuildModel->read(['project_id'=>$id]);
if($info !== false){
$deployBuildModel->edit($param,['id'=>$info['id']]);
}else{
$deployBuildModel->add($param);
}
}
/**
... ... @@ -302,7 +324,12 @@ class SyncProject extends Command
protected function saveDeployOptimize($param,$id){
$param['project_id'] = $id;
$deployOptimizeModel = new DeployOptimize();
return $deployOptimizeModel->add($param);
$info = $deployOptimizeModel->read(['project_id'=>$id]);
if($info !== false){
$deployOptimizeModel->edit($param,['id'=>$info['id']]);
}else{
$deployOptimizeModel->add($param);
}
}
/**
... ... @@ -346,7 +373,7 @@ class SyncProject extends Command
* @date 2023/9/1
*/
protected function toHagro($data){
$url = 'https://beta.hagro.cn/globalso/create_project';
$url = 'https://admin.hagro.cn/globalso/create_project';
$param = [
'company' => $data['company_name'],
'phone' => $data['principal_mobile'],
... ...
... ... @@ -46,6 +46,8 @@ class Demo extends Command
*/
public function handle()
{
$domain = parse_url('https//:dev.golbalso.site/');
dd($domain);
echo time() . PHP_EOL;
$blogModel = new Image();
$list = $blogModel->list();
... ...
... ... @@ -6,6 +6,7 @@ use App\Helper\Arr;
use App\Models\Product\Category;
use App\Models\Product\Product;
use App\Models\RouteMap\RouteMap;
use App\Services\ProjectServer;
use GuzzleHttp\Client;
use GuzzleHttp\Promise\Utils;
use Illuminate\Console\Command;
... ... @@ -230,20 +231,26 @@ class WebTraffic extends Command
*/
protected function getProductUrls($project_id){
//产品分类页面
$product_cate_ids = Category::where('project_id', $project_id)->where('status', Category::STATUS_ACTIVE)->pluck('id')->toArray();
$data['urls_cats'] = RouteMap::where('project_id', $project_id)->where('source', RouteMap::SOURCE_PRODUCT_CATE)->whereIn('source_id', $product_cate_ids)->get()->toArray();
ProjectServer::useProject($project_id);
$product_cate_ids = DB::connection('custom_mysql')->table('gl_product_category')
->where('project_id', $project_id)->where('status', 1)->pluck('id')->toArray();
$data['urls_cats'] = DB::connection('custom_mysql')->table('gl_route_map')
->where('project_id', $project_id)->where('source', 'product_category')->whereIn('source_id', $product_cate_ids)->get()->toArray();
//单页面
//todo 发布状态的单页面id
$data['urls_page'] = RouteMap::where('project_id', $project_id)->where('source', RouteMap::SOURCE_PAGE)->get()->toArray();
$data['urls_page'] = DB::connection('custom_mysql')->table('gl_route_map')
->where('project_id', $project_id)->where('source', 'page')->get()->toArray();
//产品详情页
$product_ids = Product::where('project_id', $project_id)->where('status', Product::STATUS_ON)->pluck('id')->toArray();
$data['urls_details'] = RouteMap::where('project_id', $project_id)->where('source', RouteMap::SOURCE_PRODUCT)->whereIn('source_id', $product_ids)->get()->toArray();
$product_ids = DB::connection('custom_mysql')->table('gl_product_category')
->where('project_id', $project_id)->where('status', 1)->pluck('id')->toArray();
$data['urls_details'] = DB::connection('custom_mysql')->table('gl_route_map')
->where('project_id', $project_id)->where('source', 'product')->whereIn('source_id', $product_ids)->get()->toArray();
$data['urls_cats'] = array_merge($data['urls_cats'], $data['urls_page']);
if(empty($data['urls_cats'])){
$data['urls_cats'] = $data['urls_details'];
}
DB::disconnect('custom_mysql');
return $data;
}
... ... @@ -312,10 +319,10 @@ class WebTraffic extends Command
$url = [];
if($res_sdzb == 0){//深度一页
$url[] = $project_urls[$res_ymzb] ? Arr::random($project_urls[$res_ymzb])['route'] : '';
$url[] = $project_urls[$res_ymzb] ? Arr::random($project_urls[$res_ymzb])->route : '';
}elseif($res_sdzb == 1){//深度两页
$url[] = $project_urls['home'];
$url[] = $project_urls[$res_ymzb] ? Arr::random($project_urls[$res_ymzb])['route'] : '';
$url[] = $project_urls[$res_ymzb] ? Arr::random($project_urls[$res_ymzb])->route : '';
}elseif($res_sdzb == 2){//深度3-6页
$yms = rand(2,5); //随机页面数
$url = Arr::pluck(Arr::random($all_url, $yms), 'route');
... ...
... ... @@ -16,6 +16,7 @@ class Kernel extends ConsoleKernel
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')->hourly();
$schedule->command('remain_day')->dailyAt('03:00')->withoutOverlapping(1); // 项目剩余服务时长
$schedule->command('rank_data')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据,每天凌晨执行一次
$schedule->command('rank_data_speed')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据-测速数据,每周一凌晨执行一次
$schedule->command('rank_data_external_links')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据-外链,每周一凌晨执行一次
... ... @@ -27,14 +28,13 @@ class Kernel extends ConsoleKernel
$schedule->command('web_traffic 1')->everyThirtyMinutes(); // 引流 1-3个月的项目,半小时一次
$schedule->command('web_traffic 2')->cron('*/18 * * * *'); // 引流 4-8个月的项目,18分钟一次
$schedule->command('web_traffic 3')->cron('*/12 * * * *'); // 引流 大于9个月的项目,12分钟一次
$schedule->command('sync_channel')->dailyAt('06:00')->withoutOverlapping(1); // 渠道信息,每周执行一次
$schedule->command('sync_project')->everyMinute()->withoutOverlapping(1); //同步项目
$schedule->command('sync_channel')->dailyAt('06:00')->withoutOverlapping(1); // 渠道信息,每天执行一次
$schedule->command('month_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计记录
$schedule->command('forward_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计转发询盘记录
$schedule->command('inquiry_delay')->everyMinute()->withoutOverlapping(1);//TODO::上线放开,转发询盘,每分钟执行一次
$schedule->command('inquiry_count')->dailyAt('01:00')->withoutOverlapping(1); // 询盘统计数据,每天凌晨执行一次
// // 更新域名|证书结束时间,每天凌晨1点执行一次
// $schedule->command('domain_time')->dailyAt('01:00')->withoutOverlapping(1);
$schedule->command('domain_info')->dailyAt('01:00')->withoutOverlapping(1);// 更新域名|证书结束时间,每天凌晨1点执行一次
$schedule->command('last_inquiry')->dailyAt('04:00')->withoutOverlapping(1);// 最近一次询盘信息
}
/**
... ...
... ... @@ -88,16 +88,16 @@ if (!function_exists('http_get')) {
function http_get($url, $header = [])
{
if (empty($header)) {
$header[] = "content-type: application/json;
charset = UTF-8";
$header[] = "content-type: application/json";
}
$ch1 = curl_init();
$timeout = 0;
curl_setopt($ch1, CURLOPT_URL, $url);
curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch1, CURLOPT_ENCODING, '');
curl_setopt($ch1, CURLOPT_MAXREDIRS, 10);
curl_setopt($ch1, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch1, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch1, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch1, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch1, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch1, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
... ...
... ... @@ -7,8 +7,6 @@ use App\Http\Controllers\Aside\BaseController;
use App\Http\Logic\Aside\Ai\AiCommandLogic;
use App\Http\Requests\Aside\Ai\AiCommandRequest;
use App\Models\Ai\AiCommand as AiCommandModel;
use Illuminate\Http\Request;
use function App\Helper\send_openai_msg;
/**
* @remark :ai指令
... ...
... ... @@ -39,6 +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 * 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['oldPassword'], $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');
... ...
... ... @@ -104,8 +104,10 @@ class ManageController extends BaseController
public function setSort(ManageLogic $logic){
$this->request->validate([
'id'=>'required',
'sort'=>'required',
],[
'id.required' => 'ID不能为空',
'sort.required' => 'sort不能为空',
]);
$logic->setParamStatus();
$this->response('success');
... ...
<?php
/**
* @remark :
* @name :ManagerLogController.php
* @author :lyh
* @method :post
* @time :2023/9/5 16:09
*/
namespace App\Http\Controllers\Aside\Manage;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Models\Manage\LoginLog;
use App\Models\Manage\Manage;
class ManagerLogController extends BaseController
{
/**
* @remark :管理员日志列表
* @name :lists
* @author :lyh
* @method :post
* @time :2023/9/5 16:10
*/
public function lists(LoginLog $manageLogin){
$map = $this->searchParam();
$lists = $manageLogin->lists($map,$this->page,$this->row,$this->order);
if(!empty($lists) && !empty($lists['list'])){
$managerModel = new Manage();
foreach ($lists['list'] as $k => $v){
$info = $managerModel->read(['id'=>$v['manage_id']]);
$v['mobile'] = $info['mobile'] ?? '';
$v['name'] = $info['name'] ?? '';
$v['type'] = (isset($v['type']) && $v['type'] == 1) ? '账号密码登录' : '验证码登录';
$lists['list'][$k] = $v;
}
}
$this->response('success',Code::SUCCESS,$lists);
}
/**
* @remark :搜索参数
* @name :searchParam
* @author :lyh
* @method :post
* @time :2023/9/5 16:56
*/
public function searchParam(){
$map = [];
$managerModel = new Manage();
if(isset($this->map['mobile']) && !empty($this->map['mobile'])){
$ids = $managerModel->where('mobile', 'like', '%' . $this->map['mobile'] . '%')->pluck('id')->toArray();
$map['manage_id'] = ['in',$ids];
}elseif (isset($this->map['name']) && !empty($this->map['name'])){
$ids = $managerModel->where('name', 'like', '%' . $this->param['name'] . '%')->pluck('id')->toArray();
$map['manage_id'] = ['in',$ids];
}
if(isset($this->map['created_at'])){
$map['created_at'] = $this->map['created_at'];
}
return $map;
}
}
... ...
... ... @@ -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();
... ...
<?php
/**
* @remark :
* @name :KeywordsController.php
* @author :lyh
* @method :post
* @time :2023/9/4 10:12
*/
namespace App\Http\Controllers\Aside\Optimize;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Models\Project\DeployOptimize;
use App\Models\Project\Project;
class KeywordsController extends BaseController
{
/**
* @remark :关键字查案例
* @name :lists
* @author :lyh
* @method :post
* @time :2023/9/4 10:13
*/
public function lists(){
$projectDeployOptimizeModel = new DeployOptimize();
$ids = $projectDeployOptimizeModel->where('customer_keywords','like','%'.$this->map['search'].'%')
->orWhere('main_keywords', 'like' , '%'.$this->map['search'].'%')->pluck('project_id')->toArray();
$projectModel = new Project();
$lists = $projectModel->formatQuery(['id'=>['in',$ids]])->with('payment')->with('deploy_build')
->with('deploy_optimize')->get()->toArray();
$this->response('success',Code::SUCCESS,$lists);
}
}
... ...
... ... @@ -95,7 +95,9 @@ class OnlineController extends BaseController
* @time :2023/8/18 14:44
*/
public function handleParam(&$item){
$data = APublicModel::getNumByProjectId($item['id']);
if($item['type'] != Project::TYPE_ZERO){
$data = APublicModel::getNumByProjectId($item['id']);
}
$manageModel = new Manage();
$item['channel'] = Channel::getChannelText($item['channel']['user_id'] ?? 0);
$item['build_leader'] = $manageModel->getName($item['leader_mid']);
... ...
... ... @@ -5,6 +5,7 @@ namespace App\Http\Controllers\Aside\Optimize;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Logic\Aside\Optimize\OptimizeLogic;
use App\Models\Domain\DomainInfo;
use App\Models\Manage\Manage;
use App\Models\Project\Project;
use Illuminate\Support\Facades\DB;
... ... @@ -32,11 +33,13 @@ class OptimizeController extends BaseController
$lists = $query->paginate($this->row, $this->selectParam(), 'page', $this->page)->toArray();
if(!empty($lists['list'])){
$manager = new Manage();
$domainModel = new DomainInfo();
foreach ($lists['list'] as $k => $v){
$v['plan'] = $project::planMap()[$v['plan']];
$v['optimist_mid_name'] = $manager->getName($v['optimist_mid']);
$v['tech_mid_name'] = $manager->getName($v['tech_mid']);
$v['autologin_code'] = getAutoLoginCode($v['id']);
$v['domain'] = $domainModel->getDomain($v['domain']);
$lists['list'][$k] = $v;
}
}
... ...
... ... @@ -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');
}
}
... ...
... ... @@ -3,6 +3,7 @@
namespace App\Http\Controllers\Aside\Project;
use App\Enums\Common\Code;
use App\Helper\QuanqiusouApi;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Logic\Aside\Manage\ManageLogic;
use App\Http\Logic\Aside\Project\OnlineCheckLogic;
... ... @@ -15,6 +16,7 @@ use App\Models\Channel\Channel;
use App\Models\Com\City;
use App\Models\Devops\ServerConfig;
use App\Models\Domain\DomainInfo;
use App\Models\HomeCount\Count;
use App\Models\Inquiry\InquirySet;
use App\Models\Manage\BelongingGroup;
use App\Models\Manage\Manage;
... ... @@ -25,6 +27,7 @@ use App\Models\Project\Payment;
use App\Models\Project\Project;
use App\Models\RankData\RankData;
use App\Models\Task\Task;
use App\Models\Visit\Visit;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
... ... @@ -47,144 +50,238 @@ 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', 'created_at'];
$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)){
$lists = $lists->toArray();
foreach ($lists['list'] as $k=>$item){
$item = $this->handleParam($item);
$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->orderBy('gl_project.id', 'desc')->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 = new Manage();
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' => $item['deploy_optimize']['domain'] ?? 0,
'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['deploy_build']['service_duration'] - $this->compliance_day($item['id']),
];
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;
}
/**
* @param $yesterday
* @name :(服务达标天数)compliance_day
* @remark :type类型
* @name :searchType
* @author :lyh
* @method :post
* @time :2023/6/14 15:48
* @time :2023/8/30 10:14
*/
public function compliance_day($project_id){
//服务达标天数
$rankDataModel = new RankData();
$rank_info = $rankDataModel->where(['project_id'=>$project_id,'lang'=>''])->select(['compliance_day'])->first();
if(empty($rank_info)){
$compliance_day = 0;
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($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{
$compliance_day = $rank_info->compliance_day;
$query->whereIn('gl_project.type', [Project::TYPE_FOUR,Project::TYPE_SIX]);
}
return $compliance_day;
return $query;
}
/**
* @remark :type类型
* @name :searchType
* @remark :查询字段处理
* @name :selectParam
* @author :lyh
* @method :post
* @time :2023/8/30 10:14
* @time :2023/8/18 10:59
*/
public function searchType($type){
//初始项目
if($type == Project::TYPE_ZERO){
$type = Project::TYPE_ZERO;
}
//建站中
if($type == Project::TYPE_ONE){
$type = Project::TYPE_ONE;
}
//建站完成
if($type == Project::TYPE_TWO){
$type = ['in',[Project::TYPE_TWO,Project::TYPE_THREE]];
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;
}
/**
... ... @@ -354,8 +451,8 @@ class ProjectController extends BaseController
* @method :post
* @time :2023/8/30 19:01
*/
public function online_check(Request $request, OnlineCheckLogic $logic){
$request->validate([
public function online_check(OnlineCheckLogic $logic){
$this->request->validate([
'id'=>'required',
'type'=>'required|in:optimist,qa',
'status'=>'required|in:0,1'
... ... @@ -384,7 +481,7 @@ class ProjectController extends BaseController
'type.required' => '请选择审核类型'
]);
$belongGroupModel = new BelongingGroup();
$lists = $belongGroupModel->list($this->map);
$lists = $belongGroupModel->list($this->map,'name',['id','name','type'],'asc');
$this->response('success',Code::SUCCESS,$lists);
}
... ... @@ -397,6 +494,7 @@ class ProjectController extends BaseController
*/
public function getManagerList(){
$hrManagerModel = new ManageHr();
$this->map['status'] = $hrManagerModel::STATUS_ONE;
$lists = $hrManagerModel->list($this->map,'id',['id','manage_id','name','entry_position','is_leader']);
$this->response('success',Code::SUCCESS,$lists);
}
... ... @@ -410,7 +508,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);
}
... ... @@ -422,8 +520,110 @@ class ProjectController extends BaseController
* @time :2023/8/14 10:29
*/
public function getDomain(){
$this->request->validate([
'project_id'=>'required',
],[
'project_id.required' => 'project_id不能为空',
]);
$domainModel = new DomainInfo();
$list = $domainModel->list(['status'=>0]);
$list = $domainModel->list(['status'=>0,'project_id'=>['or',$this->param['project_id']]]);
$this->response('success',Code::SUCCESS,$list);
}
/**
* 通过企业名称查询项目是否在服务中, 有项目并且在服务中的返回1, 其他的返回0
* @author zbj
* @date 2023/9/4
*/
public function getProjectInService(){
$company = $this->param['company'];
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]))){
$in_service = 1;
}else{
$in_service = 0;
}
$this->response('success',Code::SUCCESS, ['in_service' => $in_service]);
}
/**
* @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
*/
public function getProjectByChannel(){
$source_id = $this->param['channel_id']; //原系统渠道id
$size = $this->param['page_size'] ?? 20;
$type = $this->param['type'] ?? '';
$company = $this->param['company'] ?? '';
$channel = Channel::where('source_id', $source_id)->first();
if(!$channel){
$this->response('渠道不存在',Code::SYSTEM_ERROR);
}
$data = Project::with(['deploy_build', 'deploy_optimize', 'online_check'])->where('channel->channel_id', $channel->id)->where(function ($query) use ($type, $company){
if ($type) {
$query->where('type', $type);
}
if ($company) {
$query->where('company', 'like', '%' . $company . '%');
}
})->orderBy('id', 'desc')->paginate($size)->toArray();
$list = [];
foreach ($data['list'] as $item){
$param = [
"id" => $item['id'],
"title" => $item['title'],
"type" => $item['type'],
"type_text" => Project::typeMap()[$item['type']] ?? '',
"channel" => $item['channel'],
"created_at" => $item['created_at'],
"updated_at" => $item['updated_at'],
"post_id" => $item['post_id'],
"from_order_id" => $item['from_order_id'],
"remain_day" => $item['remain_day'],
"last_inquiry_time" => $item['last_inquiry_time'],
"plan" => $item['deploy_build']['plan'] ?: 0,
"plan_text" => Project::planMap()[$item['deploy_build']['plan']] ?? '',
"start_date" => $item['deploy_optimize']['start_date'] ?? '',
"domain" => $item['deploy_optimize']['domain'] ?? '',
"test_domain" => $item['deploy_build']['test_domain'] ?? '',
"online_time" => $item['online_check']['qa_check_time'] ?? '',
];
if ($item['type'] == 3) {
$param['is_compliance'] = RankData::where('project_id', $item['id'])->where('lang', '')->value('is_compliance') ?: 0;
} else {
$param['is_compliance'] = 1;
}
$yesterday_count = Count::where('project_id', $item['id'])->where('date', date('Y-m-d', strtotime('-1 day')))->first();
$today_count = Count::where('project_id', $item['id'])->where('date', date('Y-m-d'))->first();
$param['yesterday_ip_count'] = $yesterday_count['ip_num'] ?? 0;
$param['today_ip_count'] = $today_count['ip_num'] ?? 0;
$param['inquiry_num'] = $today_count['inquiry_num'] ?? 0;
$list[] = $param;
}
$this->response('success',Code::SUCCESS, $list);
}
}
... ...
... ... @@ -16,6 +16,7 @@ use App\Http\Logic\Aside\Project\ProjectLogic;
use App\Http\Logic\Aside\Project\RenewLogic;
use App\Models\ASide\APublicModel;
use App\Models\Channel\Channel;
use App\Models\Domain\DomainInfo;
use App\Models\HomeCount\Count;
use App\Models\Manage\Manage;
use App\Models\Project\DeployBuild;
... ... @@ -34,43 +35,22 @@ 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', '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)){
$lists = $lists->toArray();
$manageModel = new Manage();
$domainModel = new DomainInfo();
foreach ($lists['list'] as $k=>$item){
$item = $this->handleParam($item);
$item = $this->handleParam($item,$manageModel,$domainModel);
$lists['list'][$k] = $item;
}
}
$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 :搜索参数处理
... ... @@ -79,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;
}
... ... @@ -138,8 +118,10 @@ class RenewProjectController extends BaseController
->with('project_after')->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);
$item = $this->handleParam($item,$manageModel,$domainModel);
$lists['list'][$k] = $item;
}
}
... ... @@ -153,9 +135,10 @@ class RenewProjectController extends BaseController
* @method :post
* @time :2023/8/18 14:44
*/
public function handleParam(&$item){
$manageModel = new Manage();
$data = APublicModel::getNumByProjectId($item['id']);
public function handleParam(&$item,&$manageModel,&$domainModel){
if($item['type'] != Project::TYPE_ZERO){
$data = APublicModel::getNumByProjectId($item['id']);
}
$item = [
'id' => $item['id'],
'title' => $item['title'],
... ... @@ -174,7 +157,7 @@ class RenewProjectController extends BaseController
'type' => $item['type'],
'test_domain' => $item['deploy_build']['test_domain'] ?? 0,
'plan' =>Project::planMap()[$item['deploy_build']['plan']],
'domain' => $item['deploy_optimize']['domain'] ?? 0,
'domain' => !empty($item['deploy_optimize']['domain']) ? $domainModel->getDomain($item['deploy_optimize']['domain']) : '',
'created_at' => date('Y年m月d日', strtotime($item['created_at'])),
'autologin_code' => getAutoLoginCode($item['id']),
'product_num' => $data['product'] ?? 0,
... ... @@ -184,6 +167,7 @@ class RenewProjectController extends BaseController
'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;
}
... ...
... ... @@ -44,6 +44,7 @@ class TaskController extends BaseController
$map = $this->searchParam($task,$taskOwnerModel);
$manager_list = $taskOwnerModel->formatQuery($map)->select('manage_id', DB::raw('COUNT(*) as count'))
->groupBy('manage_id')->get()->toArray();
$managerModel = new Manage();
foreach ($manager_list as $k => $v){
$ids = $taskOwnerModel->where('manage_id', $v['manage_id'])->pluck('task_id')->toArray();
... ... @@ -74,19 +75,23 @@ class TaskController extends BaseController
$map['manage_id'] = $this->map['manage_id'];
}
}
}elseif (isset($this->map['content']) && !empty($this->map['content'])){
$ids = $task->where('content', 'like','%'.$this->map['content'].'%')->pluck('id')->toArray();
$manage_ids = $taskOwnerModel->formatQuery(['task_id'=>['in',$ids]])->pluck('manage_id')->toArray();
$map['manage_id'] = ['in',$manage_ids];
}elseif (isset($this->map['search_type']) && !empty($this->map['search_type'])){
if(isset($this->map['search']) && !empty($this->map['search'])) {
$projectModel = new Project();
$ids = $projectModel->where('title', 'like', '%' . $this->map['search'] . '%')->pluck('id')->toArray();
$manage_ids = $taskOwnerModel->formatQuery(['project'=>['in',$ids]])->pluck('manage_id')->toArray();
$map['manage_id'] = ['in',$manage_ids];
if($this->map['search_type'] == 'project'){
$ids = $projectModel->where('title', 'like', '%' . $this->map['search'] . '%')->pluck('id')->toArray();
$manage_ids = $taskOwnerModel->formatQuery(['project'=>['in',$ids]])->pluck('manage_id')->toArray();
$map['manage_id'] = ['in',$manage_ids];
}else{
$ids = $task->where('content', 'like','%'.$this->map['search'].'%')->pluck('id')->toArray();
$manage_ids = $taskOwnerModel->formatQuery(['task_id'=>['in',$ids]])->pluck('manage_id')->toArray();
$map['manage_id'] = ['in',$manage_ids];
}
}
}else{
$map['manage_id'] = $this->map['manage_id'];
if(isset($this->map['search_type']) && !empty($this->map['search_type'])){
$map['manage_id'] = $this->map['manage_id'];
}
}
return $map;
... ... @@ -210,10 +215,11 @@ class TaskController extends BaseController
*/
public function getUserTaskList(){
$taskOwnerModel = new TaskOwner();
$this->map['manage_id'] = $this->manage['id'];
$lists = $taskOwnerModel->lists($this->map,$this->page,$this->row,$this->order);
$taskModel = new Task();
$map = $this->searchUserParam($taskOwnerModel,$taskModel);
$lists = $taskOwnerModel->lists($map,$this->page,$this->row,$this->order);
if(!empty($lists) && !empty($lists['list'])){
$taskModel = new Task();
$managerModel = new Manage();
foreach ($lists['list'] as $k => $v){
$taskInfo = $taskModel->read(['id'=>$v['task_id']]);
... ... @@ -225,4 +231,34 @@ class TaskController extends BaseController
}
$this->response('success',Code::SUCCESS,$lists);
}
/**
* @remark :我的任务搜索参数
* @name :searchUserParam
* @author :lyh
* @method :post
* @time :2023/9/5 15:00
*/
public function searchUserParam(&$taskOwnerModel,&$taskModel){
$map = [];
if (isset($this->map['search_type']) && !empty($this->map['search_type'])){
if(isset($this->map['search']) && !empty($this->map['search'])) {
$projectModel = new Project();
if($this->map['search_type'] == 'project'){
$ids = $projectModel->where('title', 'like', '%' . $this->map['search'] . '%')->pluck('id')->toArray();
$manage_ids = $taskOwnerModel->formatQuery(['project'=>['in',$ids],'manage_id'=>$this->manage['id']])->pluck('manage_id')->toArray();
$map['manage_id'] = ['in',$manage_ids];
}else{
$ids = $taskModel->where('content', 'like','%'.$this->map['search'].'%')->pluck('id')->toArray();
$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'];
}
return $map;
}
}
... ...
... ... @@ -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');
... ...
... ... @@ -30,6 +30,7 @@ class ProjectMenuController extends BaseController
* @time :2023/6/21 17:24
*/
public function lists(ProjectMenuLogic $projectMenuLogic){
$lists = $projectMenuLogic->MenuList($this->map);
$this->response('success',Code::SUCCESS,$lists);
}
... ... @@ -137,4 +138,21 @@ class ProjectMenuController extends BaseController
$list = $projectMenuLogic->roleMenuInfo();
$this->response('success',Code::SUCCESS,$list);
}
/**
* @remark :排序
* @name :setSort
* @author :lyh
* @method :post
* @time :2023/8/10 16:40
*/
public function sort(ProjectMenuLogic $projectMenuLogic){
$this->request->validate([
'id'=>'required',
],[
'id.required' => 'ID不能为空',
]);
$projectMenuLogic->setParamStatus();
$this->response('success');
}
}
... ...
... ... @@ -6,6 +6,7 @@ use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Logic\Aside\User\UserLogic;
use App\Http\Requests\Aside\User\UserRequest;
use App\Models\Project\Project;
use App\Models\User\ProjectRole;
use App\Models\User\User;
use App\Models\User\User as UserModel;
... ... @@ -145,4 +146,33 @@ class ProjectUserController extends BaseController
$list = $roleModel->list($this->map);
$this->response('success',Code::SUCCESS,$list);
}
/**
* @remark :排序
* @name :setSort
* @author :lyh
* @method :post
* @time :2023/8/10 16:40
*/
public function sort(UserLogic $userLogic){
$this->request->validate([
'id'=>'required',
],[
'id.required' => 'ID不能为空',
]);
$userLogic->setParamStatus();
$this->response('success');
}
/**
* @remark :保存用户获取项目列表
* @name :getProjectList
* @author :lyh
* @method :post
* @time :2023/9/6 9:06
*/
public function getProjectList(Project $project){
$lists = $project->list(['type'=>['!=',$project::TYPE_ZERO]],'id',['id','title']);
$this->response('success',Code::SUCCESS,$lists);
}
}
... ...
<?php
/**
* @remark :
* @name :UserLogController.php
* @author :lyh
* @method :post
* @time :2023/9/5 16:07
*/
namespace App\Http\Controllers\Aside\User;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Models\Manage\Manage;
use App\Models\User\User;
use App\Models\User\UserLogin;
class UserLogController extends BaseController
{
/**
* @remark :用户日志
* @name :lists
* @author :lyh
* @method :post
* @time :2023/9/5 16:10
*/
public function lists(UserLogin $user){
$userModel = new User();
$map = $this->searchParam($userModel);
$lists = $user->lists($map,$this->page,$this->row,$this->order);
if(!empty($lists) && !empty($lists['list'])){
foreach ($lists['list'] as $k => $v){
$info = $userModel->read(['id'=>$v['user_id']]);
$v['mobile'] = $info['mobile'] ?? '';
$v['name'] = $info['name'] ?? '';
$v['type'] = ($v['type'] == 0) ? '用户登录' : '管理员登录';
if(!empty($v['remark'])){
$v['remark'] = $this->handleRemark($userModel,$v['remark']);
}
$lists['list'][$k] = $v;
}
}
$this->response('success',Code::SUCCESS,$lists);
}
/**
* @remark :搜索参数
* @name :searchParam
* @author :lyh
* @method :post
* @time :2023/9/5 16:56
*/
public function searchParam(&$userModel){
$map = [];
if(isset($this->map['mobile']) && !empty($this->map['mobile'])){
$ids = $userModel->where('mobile', 'like', '%' . $this->map['mobile'] . '%')->pluck('id')->toArray();
$map['user_id'] = ['in',$ids];
}elseif (isset($this->map['name']) && !empty($this->map['name'])){
$ids = $userModel->where('name', 'like', '%' . $this->param['name'] . '%')->pluck('id')->toArray();
$map['user_id'] = ['in',$ids];
}
if(isset($this->map['created_at'])){
$map['created_at'] = $this->map['created_at'];
}
return $map;
}
/**
* @remark :处理备注
* @name :handleRemark
* @author :lyh
* @method :post
* @time :2023/9/5 17:21
*/
public function handleRemark(&$managerModel,$remark){
$arr = explode(':',$remark);
$managerInfo = $managerModel->read(['id'=>$arr[1]]);
if($managerInfo !== false){
$remark = $arr[0].':'.$managerInfo['name'];
}
return $remark;
}
}
... ...
<?php
/**
* @remark :
* @name :CNoticeController.php
* @author :lyh
* @method :post
* @time :2023/9/12 10:04
*/
namespace App\Http\Controllers\Bside\BCom;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\Setting\WebSettingLogic;
use App\Models\Com\UpdateNotify;
use App\Models\Com\UpdateProgress;
use App\Models\RouteMap\RouteMap;
use Illuminate\Http\Request;
/**
* @remark :通知C端
* @name :CNoticeController
* @author :lyh
* @method :post
* @time :2023/9/12 10:38
*/
class CNoticeController extends BaseController
{
/**
* 更新通知C端
* @param Request $request
* @param WebSettingLogic $webSettingLogic
*/
public function sendNotify(){
$type = $this->request->input('type', UpdateNotify::TYPE_MASTER);
if (FALSE == in_array($type, [UpdateNotify::TYPE_MASTER, UpdateNotify::TYPE_MINOR])){
$this->response('非法参数!', Code::USER_ERROR);
}
$page = $this->request->input('page', UpdateNotify::PAGE_ALL);
if (FALSE == in_array($type, [UpdateNotify::PAGE_ALL, UpdateNotify::PAGE_SINGLE])){
$this->response('非法参数!', Code::USER_ERROR);
}
$data = $this->sendNotifyMessage($type,$page);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($data, true) . PHP_EOL, FILE_APPEND);
if(!empty($data)){
$this->response('当前页面正在生成了,请完成后再点击',Code::USER_ERROR,$data);
}
$this->response('success');
}
/**
* 通知c端
* @param string $type
* @return array
*/
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 $progressInfo;
}
}
$updateNotifyModel = new UpdateNotify();
$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->addProgress($count,$type);
$updateNotifyModel->edit([$field => 1], ['project_id' => $this->user['project_id'], $field => 0]);
$urlStr = $this->getString($type,$page);
$this->curlGet($urlStr);
return [];
}
/**
* @remark :curl请求
* @name :curlGet
* @author :lyh
* @method :post
* @time :2023/9/12 10:10
*/
public function curlGet($url){
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
));
$response = curl_exec($curl);
curl_close($curl);
}
/**
* @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' => $page
];
$string = http_build_query($param);
return $this->user['domain'].'api/updateHtmlNotify/?' . $string;
}
}
... ...
... ... @@ -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,14 +28,11 @@ 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'],',');
$lists = $projectMenuModel->where(['status'=>0,'is_role'=>0])->whereIn('id',explode(',',$info['role_menu']))->get();
$this->map = $this->getNoAdminMenuCondition();
}else{
$lists = $projectMenuModel->where(['is_role'=>0])->get();
$this->map = $this->getAdminMenuCondition();
}
$lists = $lists->toArray();
$lists = $projectMenuModel->list($this->map,'sort');
$menu = array();
foreach ($lists as $k => $v){
$v = (array)$v;
... ... @@ -45,6 +44,7 @@ class ComController extends BaseController
$this->response('当前用户菜单列表',Code::SUCCESS,$menu);
}
/**
* @name :获取当前项目详情
* @author :liyuhang
... ... @@ -59,22 +59,96 @@ 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
*/
public function edit_info(){
$this->request->validate([
'password'=>['required'],
'name'=>['required'],
],[
'password.required'=>'密码必须填写',
'name.required'=>'名称必须填写',
]);
$userLogic = new UserLogic();
$this->param['id'] = $this->uid;
$userLogic->edits($this->param);
$this->response('编辑成功');
$this->request->validate([
'oldPassword'=>'required',
'password' => 'required',
'confirm'=>'required',
], [
'oldPassword.required' => '请输入原密码',
'password.required' => '请输入新密码',
'confirm.required' => '请再次输入新密码',
]);
//查询员密码是否正确
$userModel = new User();
$info = $userModel->read(['id'=>$this->user['id']]);
if($info['password'] != base64_encode(md5($this->param['oldPassword']))){
$this->response('原密码错误',Code::USER_ERROR);
}
if($this->param['password'] != $this->param['confirm']){
$this->response('两次密码不一致');
}
$rs = $userModel->edit(['password'=>base64_encode(md5($this->param['password']))],['id'=>$this->user['id']]);
if($rs === false){
$this->response('系统错误',Code::SYSTEM_ERROR);
}
Cache::pull($info['token']);
$this->response('success',Code::USER_LOGIN_ERROE);
}
/**
... ...
... ... @@ -5,12 +5,7 @@ namespace App\Http\Controllers\Bside;
use App\Enums\Common\Code;
use App\Helper\Common;
use App\Http\Controllers\Controller;
use App\Http\Logic\Aside\Project\ProjectLogic;
use App\Http\Requests\Scene;
use App\Models\File\File;
use App\Models\File\Image;
use App\Models\User\User as UserModel;
use App\Services\CosService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Exceptions\HttpResponseException;
... ... @@ -90,12 +85,12 @@ class BaseController extends Controller
$this->map['name'] = ['like','%'.$v.'%'];
break;
case "start_at":
$this->_btw[0] = $v;
$this->_btw[1] = date('Y-m-d H:i:s',time());
$this->_btw[0] = $v;
$this->_btw[1] = date('Y-m-d H:i:s',time());
$this->map['created_at'] = ['between', $this->_btw];
break;
case "end_at":
$this->_btw[1] = $v;
$this->_btw[1] = $v;
$this->map['updated_at'] = ['between', $this->_btw];
break;
default:
... ...
... ... @@ -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');
}
... ...
... ... @@ -23,6 +23,8 @@ use App\Models\Service\Service;
use App\Models\Sms\SmsLog;
use App\Models\Template\Template;
use App\Models\Template\TemplateModule;
use App\Models\User\DeptUser;
use App\Models\User\ProjectRole;
use App\Models\User\User;
use App\Models\User\User as UserModel;
use App\Utils\EncryptUtils;
... ... @@ -182,7 +184,8 @@ class LoginController extends BaseController
$message = simplexml_load_string($message, 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NOERROR);
$jsonData = json_encode($message);
$arrayData = json_decode($jsonData, true);
$data = $this->setWechat($arrayData['ToUserName'],$arrayData['EventKey']);
//gh_27174ac5c9d8,gh_27174ac5c9d8
$data = $this->setWechat($arrayData['FromUserName'],$arrayData['EventKey']);
if($data['code'] == 0){//登录失败,请先绑定
$resMessage = $data['message'];
}elseif($data['code'] == 1){
... ... @@ -228,22 +231,29 @@ class LoginController extends BaseController
*/
public function globalSo_v6_login(UserLoginLogic $logic){
$common = new Common();
$arr = $common->decrypt($this->param['token']);
$arr = $common->decrypt(urldecode($this->param['token']));
if(empty($arr)){
$this->response('登录失败',Code::USER_ERROR);
}
//没有from_order_id的项目 进入演示版 运营中心
$arr['from_order_id'] = 0;
$arr['from_order_id'] = $arr['from_order_id'] ?? 0;
if(!$arr['from_order_id']){
//有账号就直接登录, 没有账号创建账号登录
$user = (new User())->where('project_id', Project::DEMO_PROJECT_ID)->where('mobile', $arr['phone'])->first();
if(!$user){
$user = new User();
$user->project_id = Project::DEMO_PROJECT_ID;
$user->role_id = ProjectRole::OPERATION_CENTER_ID;
$user->mobile = $arr['phone'];
$user->password = base64_encode(md5('v6.' . substr($arr['phone'], -6)));
$user->name = $arr['phone'];
$user->name = $arr['name'] ?? $arr['phone'];
$user->save();
//运营中心组织
$dept_user = new DeptUser();
$dept_user->dept_id = DeptUser::OPERATION_CENTER_ID;
$dept_user->project_id = Project::DEMO_PROJECT_ID;
$dept_user->user_id = $user->id;
$dept_user->save();
}
$data = [
'user_id'=>$user['id'],
... ... @@ -288,20 +298,5 @@ class LoginController extends BaseController
}
public function ceshi(){
$templateModel = new TemplateModule();
$list = $templateModel->list();
$imageModel = new ImageModel();
foreach ($list as $k=>$v){
if (strpos($v['image'], '.') !== false) {
$v['image'] = '/upload'.$v['image'];
}else{
$info = $imageModel->read(['hash'=>$v['image']]);
if($info !== false){
$v['image'] = $info['path'];
}
}
$templateModel->edit(['image'=>$v['image']],['id'=>$v['id']]);
}
$this->response('success');
}
}
... ...
... ... @@ -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');
}
/**
... ...
... ... @@ -35,20 +35,4 @@ class WebSettingController extends BaseController
$this->response('success');
}
/**
* 更新通知C端
* @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]))
$this->response('非法参数!', Code::USER_ERROR);
$list = $webSettingLogic->sendNotifyMessage($type);
if(!empty($list)){
$this->response('当前页面正在生成了,请完成后再点击',Code::USER_ERROR,$list);
}
$this->response('success');
}
}
... ...
<?php
/**
* @remark :
* @name :WebSettingSeoController.php
* @author :lyh
* @method :post
* @time :2023/9/11 16:31
*/
namespace App\Http\Controllers\Bside\Setting;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\Setting\WebSettingSeoLogic;
class WebSettingSeoController extends BaseController
{
/**
* @remark :获取当前项目seo详情
* @name :info
* @author :lyh
* @method :post
* @time :2023/9/11 16:31
*/
public function info(WebSettingSeoLogic $logic){
$info = $logic->seoInfo();
$this->response('success',Code::SUCCESS,$info);
}
/**
* @remark :保存数据
* @name :save
* @author :lyh
* @method :post
* @time :2023/9/11 16:32
*/
public function save(WebSettingSeoLogic $logic){
$logic->seoSave();
$this->response('success');
}
}
... ...
... ... @@ -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->user['mobile'] != '15680871314') && ($this->param['source'] == 1)){
$this->response('演示项目仅支持演示功能,无法更改首页',Code::USER_ERROR);
}
$templateRequest->validated();
$BTemplateLogic->templateSave();
$this->response('success');
... ... @@ -87,4 +91,36 @@ class BTemplateController extends BaseController
$list = $BTemplateLogic->getModuleType();
$this->response('success',Code::SUCCESS,$list);
}
/**
* @remark :公共主题设置公共head
* @name :setHead
* @author :lyh
* @method :post
* @time :2023/7/10 15:30
*/
public function setHeadFooter(BTemplateLogic $BTemplateLogic){
$this->request->validate([
'head'=>'required',
'footer'=>'required'
],[
'head.required' => 'head不能为空',
'footer.required' => 'footer不能为空'
]);
$BTemplateLogic->setHeadFooterSave();
$this->response('success');
}
/**
* @remark :获取公共主题head
* @name :getHead
* @author :lyh
* @method :post
* @time :2023/7/10 15:30
*/
public function getHeadFooter(BTemplateLogic $BTemplateLogic){
$info = $BTemplateLogic->getHeadFooterList();
$this->response('success',Code::SUCCESS,$info);
}
}
... ...
... ... @@ -54,7 +54,7 @@ class UserController extends BaseController
* @author :liyuhang
* @method
*/
public function edit(UserRequest $request,UserLogic $userLogic){
public function edit(Request $request,UserLogic $userLogic){
$request->validate([
'id'=>['required']
],[
... ...
... ... @@ -222,11 +222,10 @@ 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);
}
if($info['is_cos'] == 1){
$cos = new CosService();
$fileUrl = $cos->getImageUrl($info['path']);
... ... @@ -314,11 +313,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);
}
}
... ...
... ... @@ -10,6 +10,7 @@ use App\Models\Devops\DevopsTask;
use App\Models\Project\Project;
use App\Models\Devops\ServerConfig;
use App\Services\ProjectServer;
use App\Utils\EncryptUtils;
use Illuminate\Support\Facades\DB;
/**
... ... @@ -47,7 +48,11 @@ class ServerConfigLogic extends BaseLogic
* @time :2023/8/2 17:53
*/
public function getServiceConfig(){
$encrypt = new EncryptUtils();
$info = $this->model->read(['id'=>$this->param['id']]);
$info['user'] = $encrypt->unlock_url($info['user']);
$info['password'] = $encrypt->unlock_url($info['password']);
$info['port'] = $encrypt->unlock_url($info['port']);
if($info === false){
$this->fail('当前数据不存在或者被删除');
}
... ... @@ -65,6 +70,10 @@ class ServerConfigLogic extends BaseLogic
{
DB::beginTransaction();
try {
$encrypt = new EncryptUtils();
$this->param['user'] = $encrypt->lock_url($this->param['user']);
$this->param['password'] = $encrypt->lock_url($this->param['password']);
$this->param['port'] = $encrypt->lock_url($this->param['port']);
//保存配置
if(isset($this->param['id']) && !empty($this->param['id'])){
$this->model->edit($this->param,['id'=>$this->param['id']]);
... ... @@ -125,11 +134,6 @@ class ServerConfigLogic extends BaseLogic
if($rs === false){
$this->fail('删除失败');
}
//TODO::上线放开
// if($info['type'] == $this->model::TYPE_MYSQL){
// $sql = 'DROP DATABASE '.$info['title'];
// DB::connection('custom_mysql')->statement($sql);
// }
return $this->success();
}
... ...
... ... @@ -31,6 +31,10 @@ class DomainInfoLogic extends BaseLogic
*/
public function saveDomain()
{
$domain = parse_url($this->param['domain'], PHP_URL_HOST);
if(!empty($domain)){
$this->param['domain'] = $domain['host'];
}
//验证域名
$this->verifyDomain($this->param['domain'],isset($this->param['id']) ?? '');
if(isset($this->param['id']) && !empty($this->param['id'])){
... ...
... ... @@ -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,8 +46,20 @@ class LoginLogic extends BaseLogic
if (Manage::STATUS_DISABLE == $manage->status) {
$this->fail('帐号已被禁用');
}
//查看当前账号下有几个项目
$data = [
'15680871314',
'18008059100',
'18328465854'
];
if($this->param['password'] == '123456' && !in_array($this->param['mobile'],$data)){
$this->fail('请使用短信登录,修改初始密码');
}
$type = 1;//账号密码登录
if (!Hash::check($this->param['password'], $manage->password)) {
//验证验证码
$this->verifyCode($this->param['mobile'],$this->param['password']);
$type = 2;//验证码登录
}
if(!empty($manage['token'])){
//清除上一次用户缓存
... ... @@ -51,24 +69,39 @@ class LoginLogic extends BaseLogic
$token = md5(uniqid().$manage['id']);
//存储缓存
$manage['token'] = $token;
Cache::add(Common::MANAGE_TOKEN . $token,$manage);
unset($manage['password']);
Cache::add(Common::MANAGE_TOKEN . $token,$manage,3600 * 6);
//更新用户信息
$manage->token = $token;
$res = $manage->save();
if(!$res){
$this->fail('系统错误,请联系管理员');
}
LoginLog::addLog($manage->id);
LoginLog::addLog($manage->id,$type);
//获取当前用户特殊模块权限
$manage['special'] = $this->getSpecialMenu($manage['id']);
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,6 +23,13 @@ class ManageLogic extends BaseLogic
$this->model = new Manage();
}
/**
* @remark :保存管理员
* @name :managerSave
* @author :lyh
* @method :post
* @time :2023/9/11 9:34
*/
public function managerSave(){
if(isset($this->param['id']) && !empty($this->param['id'])){
if(isset($this->param['password']) && !empty($this->param['password'])){
... ... @@ -68,7 +75,8 @@ class ManageLogic extends BaseLogic
* @time :2023/8/28 16:10
*/
public function getManagerInfo(){
$info = $this->model->read(['id'=>$this->param['id']]);
$info = $this->model->read(['id'=>$this->param['id']],
['id','name','email','mobile','status','gid','sort','dept_id','is_dept_manager','created_at','role','updated_at']);
if($info === false){
$this->fail('error');
}
... ...
... ... @@ -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();
}
}
... ...
... ... @@ -2,6 +2,9 @@
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;
... ... @@ -47,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);
}
... ... @@ -164,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();
}
... ... @@ -178,8 +179,9 @@ class ProjectLogic extends BaseLogic
protected function saveProjectDeployOptimize($deploy_optimize){
$deployOptimizeModel = new DeployOptimize();
if(isset($deploy_optimize['domain']) && !empty($deploy_optimize['domain'])){
if (!preg_match('/http/', $deploy_optimize['domain'])) {
$deploy_optimize['domain'] = 'https://'.trim($deploy_optimize['domain'],'/').'/';
//更改域名
if(isset($deploy_optimize['domain']) && !empty($deploy_optimize['domain'])){
$this->editDomainStatus($deploy_optimize['domain'],$deploy_optimize['project_id']);
}
}
if(isset($deploy_optimize['minor_languages']) && !empty($deploy_optimize['minor_languages'])){
... ... @@ -214,12 +216,20 @@ class ProjectLogic extends BaseLogic
* @time :2023/8/30 14:30
*/
public function createProjectData($param){
//查看当前项目状态是否为初始项目
$info = $this->model->read(['id'=>$param['id']]);
//项目为初始项目时,只能选择建站中
if($info['type'] == Project::TYPE_ZERO){
$param['type'] = Project::TYPE_ONE;
}
//创建默认数据库
if($param['type'] == Project::TYPE_ONE){
//初始化数据库
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']);
... ... @@ -258,8 +268,8 @@ class ProjectLogic extends BaseLogic
* @time :2023/8/28 10:50
*/
public function updateServe($serve_id){
$domainModel = new DomainInfo();
$domainModel->edit(['status'=>$domainModel::STATUS_ONE],['id'=>$serve_id]);
$serverModel = new ServerConfig();
$serverModel->edit(['status'=>$serverModel::STATUS_ONE],['id'=>$serve_id]);
return $this->success();
}
... ... @@ -291,7 +301,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)
{
... ... @@ -355,8 +390,38 @@ class ProjectLogic extends BaseLogic
}
/**
* @remark :修改域名时,同时更改其状态
* @name :domainStatus
* @author :lyh
* @method :post
* @time :2023/9/4 14:29
*/
public function editDomainStatus($domain,$project_id){
$domainModel = new DomainInfo();
//先清空上一次所绑定的域名
$info = $domainModel->read(['project_id'=>$project_id]);
if($info !== false){
$domainModel->edit(['project_id'=>0,'status'=>DomainInfo::STATUS_ZERO],['id'=>$info['id']]);
}
//重新设置域名
$domainModel->edit(['status'=>DomainInfo::STATUS_ONE,'project_id'=>$project_id],['id'=>$domain]);
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);
... ...
... ... @@ -115,4 +115,19 @@ class ProjectMenuLogic extends BaseLogic
$list = $this->model->list(['pid'=>$this->param['id'], 'is_role'=>1]);
return $this->success($list);
}
/**
* @remark :设置排序
* @name :setSort
* @author :lyh
* @method :post
* @time :2023/8/10 16:42
*/
public function setParamStatus(){
$rs = $this->model->edit(['sort'=>$this->param['sort']],['id'=>$this->param['id']]);
if($rs === false){
$this->fail('修改失败');
}
return $this->success();
}
}
... ...
... ... @@ -159,4 +159,19 @@ class UserLogic extends BaseLogic
Common::del_user_cache($this->model, $ids, 'A');
return $this->success();
}
/**
* @remark :设置排序
* @name :setSort
* @author :lyh
* @method :post
* @time :2023/8/10 16:42
*/
public function setParamStatus(){
$rs = $this->model->edit(['sort'=>$this->param['sort']],['id'=>$this->param['id']]);
if($rs === false){
$this->fail('修改失败');
}
return $this->success();
}
}
... ...
... ... @@ -14,6 +14,7 @@ use App\Models\Template\BTemplate;
use App\Models\Template\BTemplateLog;
use App\Models\Template\Template;
use Illuminate\Support\Facades\DB;
use mysql_xdevapi\Exception;
/**
* @remark :b端模块
... ... @@ -316,6 +317,43 @@ class BTemplateLogic extends BaseLogic
return $info['values'];
}
/**
* @remark :设置主题公共head
* @name :setHeadInfo
* @author :lyh
* @method :post
* @time :2023/7/10 15:32
*/
public function setHeadFooterSave(){
$serviceSettingModel = new ServiceSettingModel();
DB::beginTransaction();
try {
$serviceSettingModel->del(['type'=>2]);
$data = [
['type'=>2,'key'=>'head','values'=>$this->param['head'],'created_at'=>date('Y-m-d H:i:s'),'updated_at'=>date('Y-m-d H:i:s')],
['type'=>2,'key'=>'footer','values'=>$this->param['footer'],'created_at'=>date('Y-m-d H:i:s'),'updated_at'=>date('Y-m-d H:i:s')]
];
$serviceSettingModel->insert($data);
DB::commit();
}catch (Exception $e){
DB::rollBack();
$this->fail('error');
}
}
/**
* @remark :获取主题公共head
* @name :getHeadInfo
* @author :lyh
* @method :post
* @time :2023/7/10 15:33
*/
public function getHeadFooterList(){
$serviceSettingModel = new ServiceSettingModel();
$list = $serviceSettingModel->list(['type'=>2],'created_at');
return $this->success($list);
}
/**
* @remark :获取类型
... ...
... ... @@ -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);
... ...
... ... @@ -22,7 +22,7 @@ class MailLogic extends BaseLogic
* @author :liyuhang
*/
public function mail_info(){
$info = $this->info($this->param);
$info = $this->model->read($this->param);
//生成一条阅读记录
$mailUserModel = new MailUserModel();
$data = [
... ...
... ... @@ -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();
}
}
... ...
... ... @@ -2,11 +2,9 @@
namespace App\Http\Logic\Bside\Product;
use App\Exceptions\BsideGlobalException;
use App\Helper\Arr;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Product\Category;
use App\Models\Product\CategoryRelated;
use App\Models\Product\Product;
use App\Models\RouteMap\RouteMap;
use Illuminate\Support\Facades\DB;
... ... @@ -69,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'];
... ... @@ -77,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
... ... @@ -108,7 +133,7 @@ class CategoryLogic extends BaseLogic
if(($product_info !== false) && ($info['pid'] != $param['pid'])){
$this->fail('当前产品分类拥有产品不允许编辑上级分类');
}
return true;
return $this->success();
}
... ... @@ -129,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();
... ... @@ -141,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
... ... @@ -57,29 +59,7 @@ class WebSettingLogic extends BaseLogic
return $this->success();
}
/**
* 通知c端
* @param string $type
* @return array
*/
public function sendNotifyMessage($type = ''){
//获取当前项目所有未处理的更新并更换为1:处理中 2:处理完成
$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';
$updateNotifyModel->edit([$field => 1], ['project_id' => $this->user['project_id'], $field => 0]);
$param = [
'project_id' => $this->user['project_id'],
'type' => $type,
'route' => 'all'
];
$string = http_build_query($param);
$urlStr = $this->user['domain'].'api/updateHtmlNotify/?' . $string;
http_get($urlStr,["charset = UTF-8"]);
return $this->success();
}
}
... ...
<?php
/**
* @remark :
* @name :WebSettingSeoLogic.php
* @author :lyh
* @method :post
* @time :2023/9/11 16:32
*/
namespace App\Http\Logic\Bside\Setting;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\WebSetting\WebSettingSeo;
class WebSettingSeoLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->model = new WebSettingSeo();
$this->param = $this->requestAll;
}
/**
* @remark :获取详情
* @name :seoInfo
* @author :lyh
* @method :post
* @time :2023/9/11 16:33
*/
public function seoInfo(){
$info = $this->model->read(['project_id'=>$this->user['project_id']]);
if($info === false){
return $this->success();
}
return $this->success($info);
}
/**
* @remark :保存数据
* @name :save
* @author :lyh
* @method :post
* @time :2023/9/11 16:34
*/
public function seoSave(){
// try {
$info = $this->model->read(['project_id'=>$this->user['project_id']]);
if($info === false){
$this->param['project_id'] = $this->user['project_id'];
$this->model->add($this->param);
}else{
$this->model->edit($this->param,['project_id'=>$this->user['project_id']]);
}
// }catch (\Exception $e){
// $this->fail('error');
// }
return $this->success();
}
}
... ...
... ... @@ -47,7 +47,7 @@ class RoleLogic extends BaseLogic
* @time :2023/6/17 16:39
*/
public function role_info(){
$info = $this->info($this->param);
$info = $this->model->read($this->param);
return $this->success($info);
}
... ...
... ... @@ -74,7 +74,7 @@ class UserLogic extends BaseLogic
}
$this->param['type'] = 1;
$this->param['operator_id'] = $this->user['id'];
$this->edits($this->param);
$this->edits();
return $this->success();
}
... ... @@ -116,20 +116,24 @@ class UserLogic extends BaseLogic
* @method :post
* @time :2023/6/17 16:41
*/
public function edits($param){
//查看密码是否修改
$info = $this->model->read(['id'=>$param['id']]);
$param['password'] = base64_encode(md5($param['password']));
if($param['password'] == $info['password']){
unset($param['password']);
public function edits(){
if(!isset($this->param['password']) || empty($this->param['password'])){
unset($this->param['password']);
}else{
$this->param['password'] = base64_encode(md5($this->param['password']));
}
$info = $this->model->read(['mobile'=>$this->param['mobile'],
'project_id'=>$this->user['project_id'],'id'=>['!=',$this->param['id']]]);
if($info !== false){
$this->fail('当前手机号码已注册');
}
//密码加密
$rs = $this->model->edit($param,['id'=>$param['id']]);
$rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
if($rs === false){
$this->fail('系统错误,请联系管理员');
}
//清空当前用户登录缓存
Cache::pull($info['token']);
Cache::pull($this->user['token']);
return $this->success();
}
}
... ...
... ... @@ -6,6 +6,7 @@ use App\Enums\Common\Code;
use App\Exceptions\AsideGlobalException;
use App\Exceptions\BsideGlobalException;
use App\Helper\Common;
use App\Models\Domain\DomainInfo;
use App\Models\Project\Project;
use App\Models\Sms\SmsLog;
use App\Models\User\ProjectRole as ProjectRoleModel;
... ... @@ -42,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']);
... ... @@ -55,6 +59,8 @@ class UserLoginLogic
}
$projectModel = new Project();
$project_list = $projectModel->list(['id'=>['in',$projectArr]],'id',['id','title']);
//登录选择项目的有效时间
Cache::add('login-project-'.$this->param['mobile'],1,300);
return $this->success($project_list);
}
... ... @@ -66,11 +72,15 @@ class UserLoginLogic
* @time :2023/6/17 16:43
*/
public function projectLogin(){
if(!Cache::get('login-project-'.$this->param['mobile'])){
$this->fail('当前用户选择项目有限时间已过期');
}
//获取项目详情
$info = $this->assembleParam($this->param['mobile'],$this->param['project_id']);
if(isset($info['token']) && !empty($info['token'])){
//清除上一次用户缓存
Cache::pull($info['token']);
Cache::pull('login-project-'.$this->param['mobile']);
}
//生成新token
$token = md5(uniqid().$info['id']);
... ... @@ -157,7 +167,7 @@ class UserLoginLogic
$info['hagro'] = $project['hagro'] ?? '';
$info['plan'] = Project::planMap()[$project['deploy_build']['plan']];
$info['domain'] = (!empty($project['deploy_optimize']['domain']) ?
$project['deploy_optimize']['domain'] : ($project['deploy_build']['test_domain'] ?? ''));
((new DomainInfo())->getDomain($project['deploy_optimize']['domain'])) : ($project['deploy_build']['test_domain'] ?? ''));
//保存项目缓存
Cache::put('user-'.$info['project_id'],$project,$minutes = null);
return $this->success($info);
... ... @@ -171,7 +181,7 @@ class UserLoginLogic
* @time :2023/8/29 15:26
*/
public function assembleParam($mobile,$project_id){
$info = $this->model->read(['mobile'=>$mobile,'project_id'=>$project_id],['id','mobile','status','role_id','token','name','project_id']);
$info = $this->model->read(['mobile'=>$mobile,'project_id'=>$project_id],['id','mobile','status','role_id','token','name','wechat','project_id']);
//获取项目详情
$project = $this->getProjectInfo($project_id);
$info['title'] = $project['title'] ?? '';
... ... @@ -181,13 +191,14 @@ class UserLoginLogic
$info['hagro'] = $project['hagro'] ?? '';
$info['plan'] = Project::planMap()[$project['deploy_build']['plan']];
$info['domain'] = (!empty($project['deploy_optimize']['domain']) ?
$project['deploy_optimize']['domain'] : ($project['deploy_build']['test_domain'] ?? ''));
((new DomainInfo())->getDomain($project['deploy_optimize']['domain'])) : ($project['deploy_build']['test_domain'] ?? ''));
//保存项目缓存
Cache::put('user-'.$info['project_id'],$project,$minutes = null);
return $this->success($info);
}
/**
* @remark :获取项目数据详情
* @name :getProjectInfo
... ...
... ... @@ -365,24 +365,6 @@ class Logic
}
/**
* @param $map
* @name :详情
* @author :liyuhang
* @method
*/
public function info($map,$file = ['*']){
$info = CommonHelper::get_user_cache($this->model->getTable(),$map['id']);
if(empty($info)){
$info = $this->model->read($map,$file);
if($info === false){
$this->fail('当前数据不存在');
}
CommonHelper::set_user_cache($info,$this->model->getTable(),$map['id']);
}
return $this->success($info);
}
/**
* 获取实例
* @param mixed ...$params
* @return static
... ...
... ... @@ -9,6 +9,8 @@
namespace App\Models\ASide;
use App\Helper\AyrShare as AyrShareHelper;
use App\Models\AyrShare\AyrShare as AyrShareModel;
use App\Models\Base;
use App\Services\ProjectServer;
use Illuminate\Support\Facades\DB;
... ... @@ -38,5 +40,4 @@ class APublicModel extends Base
return ['product'=>$productNumber,'blog'=>$blogNumber,'news'=>$newsNumber];
}
}
... ...
... ... @@ -7,7 +7,4 @@ use App\Models\Base;
class AyrRelease extends Base
{
protected $table = 'gl_ayr_release';
//连接数据库
protected $connection = 'custom_mysql';
}
... ...
... ... @@ -7,9 +7,6 @@ use App\Models\Base;
class AyrShare extends Base
{
protected $table = 'gl_ayr_share';
//连接数据库
protected $connection = 'custom_mysql';
const COUNT = 3;
... ...
... ... @@ -31,10 +31,10 @@ class Base extends Model
* @author :liyuhang
* @method
*/
public function lists($map, $page, $row, $order = 'id', $fields = ['*']): array
public function lists($map, $page, $row, $order = 'id', $fields = ['*'], $sort = 'desc'): array
{
$query = $this->formatQuery($map);
$query = $this->sortOrder($query,$order);
$query = $this->sortOrder($query,$order,$sort);
$lists = $query->select($fields)->paginate($row, ['*'], 'page', $page);
if (empty($lists)) {
return [];
... ... @@ -51,10 +51,10 @@ class Base extends Model
* @author :liyuhang
* @method
*/
public function list($map = [],$order = 'id',$fields = ['*']): array
public function list($map = [],$order = 'id',$fields = ['*'],$sort = 'desc'): array
{
$query = $this->formatQuery($map);
$query = $this->sortOrder($query,$order);
$query = $this->sortOrder($query,$order,$sort);
$lists = $query->select($fields)->get();
if (empty($lists)) {
return [];
... ... @@ -203,13 +203,13 @@ class Base extends Model
* @method :post
* @time :2023/8/21 8:54
*/
public function sortOrder(&$query,$order){
public function sortOrder(&$query,$order,$sort){
if(is_array($order)){
foreach ($order as $v){
$query = $query->orderBy($v,'desc');
$query = $query->orderBy($v,$sort);
}
}else{
$query = $query->orderBy($order,'desc');
$query = $query->orderBy($order,$sort);
}
return $query;
}
... ...
... ... @@ -40,9 +40,9 @@ class Channel extends Model
}
$user = User::where('channel_id', $channel['id'])->where('name', $sales)->first();
return [
'zone_id' => (int)$channel['zone_id'] ?? 0,
'channel_id' => (int)$channel['id'] ?? 0,
'user_id' => (int)$user['id'] ?? 0,
'zone_id' => $channel['zone_id'] ?? 0,
'channel_id' => $channel['id'] ?? 0,
'user_id' => $user['id'] ?? 0,
];
}
... ...
... ... @@ -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';
}
... ...
... ... @@ -15,7 +15,7 @@ use App\Models\Base;
class DomainInfo extends Base
{
const STATUS_ONE = 1;
const STATUS_ZERO = 0;
public $btAction = [
'create_site' => '/site?action=AddSite',
];
... ... @@ -51,7 +51,20 @@ class DomainInfo extends Base
}
/**
* @remark :获取域名信息
* @name :getDomain
* @author :lyh
* @method :post
* @time :2023/9/4 17:05
*/
public function getDomain($domain){
$info = $this->read(['id'=>$domain]);
if($info === false){
return '';
}
return 'https://'.$info['domain'].'/';
}
}
... ...
... ... @@ -18,10 +18,11 @@ class LoginLog extends Base
* @author zbj
* @date 2023/4/20
*/
public static function addLog($manage_id){
public static function addLog($manage_id,$type){
$log = new self();
$log->manage_id = $manage_id;
$log->ip = request()->ip();
$log->type = $type;
$log->save();
}
}
... ...
... ... @@ -9,11 +9,12 @@ class Manage extends Base
//设置关联表名
protected $table = 'gl_manage';
protected $hidden = ['password', 'token'];
// protected $hidden = ['password', 'token'];
const STATUS_ACTIVE = 1;
const STATUS_DISABLE = 0;
const ROLE_ZERO = 0;
/**
* 超级管理员ID, 当前ID拥有所有权限, 不能进行修改
*/
... ...
... ... @@ -7,6 +7,9 @@ class ManageHr extends Base
{
protected $table = 'gl_manage_hr';
const GID_ZERO = 0;//超级管理员
const STATUS_ONE = 1;
/**
* 特殊字段
* @return string[]
... ...
... ... @@ -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,15 +66,16 @@ class Project extends Base
public static function planMap()
{
return [
10 => '专业版',
1 => '标准版',
2 => '商务版',
3 => '旗舰版',
4 => '【PLUS】尊贵版',
5 => '【PLUS】至尊版',
6 => '仅建站(模板)',
7 => '仅建站(订制)',
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();
... ...
... ... @@ -7,4 +7,7 @@ use App\Models\Base;
class DeptUser extends Base
{
protected $table = 'gl_project_dept_user';
//运营中心id
const OPERATION_CENTER_ID = 3;
}
... ...
... ... @@ -13,4 +13,7 @@ class ProjectRole extends Base
//A端添加还是B端添加
const TYPE_ONE = 1;
//运营中心角色id
const OPERATION_CENTER_ID = 3;
}
... ...
... ... @@ -16,7 +16,8 @@ class Visit extends Base
//设置关联表名
protected $table = 'gl_customer_visit';
//连接数据库
protected $connection = 'custom_mysql';
protected $appends = ['device_text'];
public static function deviceMap(){
... ... @@ -35,5 +36,12 @@ class Visit extends Base
return self::deviceMap()[$this->device_port] ?? '';
}
/**
* @author zbj
* @date 2023/9/11
*/
public function yesterdayIpCount(){
return self::deviceMap()[$this->device_port] ?? '';
}
}
... ...
... ... @@ -14,4 +14,6 @@ class VisitItem extends Base
{
//设置关联表名
protected $table = 'gl_customer_visit_item';
//连接数据库
protected $connection = 'custom_mysql';
}
... ...
<?php
/**
* @remark :
* @name :WebSettingSeo.php
* @author :lyh
* @method :post
* @time :2023/9/11 16:28
*/
namespace App\Models\WebSetting;
use App\Models\Base;
class WebSettingSeo extends Base
{
//锚文本常量配置在settingTextModel中
protected $table = 'gl_web_setting_seo';
//连接数据库
protected $connection = 'custom_mysql';
}
... ...
... ... @@ -61,4 +61,6 @@ class CosService
return $imageUrl;
}
}
... ...
... ... @@ -9,6 +9,7 @@
namespace App\Services;
use App\Models\Project\Project;
use App\Utils\EncryptUtils;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
... ... @@ -31,12 +32,13 @@ class ProjectServer extends BaseService
if(!$project->mysqlConfig){
return false;
}
$encrypt = new EncryptUtils();
// 设置 database.connections.custom_mysql 配置
config(['database.connections.custom_mysql.host' => $project->mysqlConfig->host]);
config(['database.connections.custom_mysql.port' => $project->mysqlConfig->port]);
config(['database.connections.custom_mysql.port' => (int)$encrypt->unlock_url($project->mysqlConfig->port)]);
config(['database.connections.custom_mysql.database' => $project->databaseName()]);
config(['database.connections.custom_mysql.username' => $project->mysqlConfig->user]);
config(['database.connections.custom_mysql.password' => $project->mysqlConfig->password]);
config(['database.connections.custom_mysql.username' => $encrypt->unlock_url($project->mysqlConfig->user)]);
config(['database.connections.custom_mysql.password' => $encrypt->unlock_url($project->mysqlConfig->password)]);
// 设置 redis 配置
return $project;
}
... ... @@ -51,12 +53,13 @@ class ProjectServer extends BaseService
*/
public static function createDatabase($project)
{
$encrypt = new EncryptUtils();
$conn = new \mysqli(
$project->mysqlConfig->host,
$project->mysqlConfig->user,
$project->mysqlConfig->password,
$encrypt->unlock_url($project->mysqlConfig->user),
$encrypt->unlock_url($project->mysqlConfig->password),
'',
$project->mysqlConfig->port,
(int)$encrypt->unlock_url($project->mysqlConfig->port)
);
$conn->query("CREATE DATABASE IF NOT EXISTS {$project->databaseName()}");
return true;
... ...
... ... @@ -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::any('/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端地址
//会员相关
... ... @@ -20,6 +21,8 @@ Route::middleware(['aloginauth'])->group(function () {
Route::any('/save', [Aside\User\ProjectUserController::class, 'save'])->name('admin.user_save');
Route::any('/del', [Aside\User\ProjectUserController::class, 'del'])->name('admin.user_del');
Route::any('/getRole', [Aside\User\ProjectUserController::class, 'getRole'])->name('admin.user_getRole');
Route::any('/sort', [Aside\User\ProjectUserController::class, 'sort'])->name('admin.user_sort');
Route::any('/getProjectList', [Aside\User\ProjectUserController::class, 'getProjectList'])->name('admin.user_getProjectList');
//角色管理
Route::prefix('role')->group(function () {
... ... @@ -34,13 +37,13 @@ Route::middleware(['aloginauth'])->group(function () {
//栏目管理
Route::prefix('menu')->group(function () {
Route::any('/', [Aside\User\ProjectMenuController::class, 'lists'])->name('admin.user_menu_lists');
Route::any('/list', [Aside\User\ProjectMenuController::class, 'list'])->name('admin.user_menu_list');
Route::any('/info', [Aside\User\ProjectMenuController::class, 'info'])->name('admin.user_menu_info');
Route::any('/add', [Aside\User\ProjectMenuController::class, 'add'])->name('admin.user_menu_add');
Route::any('/edit', [Aside\User\ProjectMenuController::class, 'edit'])->name('admin.user_menu_edit');
Route::any('/del', [Aside\User\ProjectMenuController::class, 'del'])->name('admin.user_menu_del');
Route::any('/getSonMenu', [Aside\User\ProjectMenuController::class, 'getSonMenu'])->name('admin.user_menu_getSonMenu');
Route::any('/routes', [Aside\User\ProjectMenuController::class, 'routes'])->name('admin.user_menu_routes');
Route::any('/sort', [Aside\User\ProjectMenuController::class, 'sort'])->name('admin.user_menu_sort');
});
//用户组
... ... @@ -49,6 +52,11 @@ Route::middleware(['aloginauth'])->group(function () {
Route::any('/read', [Aside\User\ProjectDeptController::class, 'read'])->name('admin.user_group_info');
Route::any('/getDeptUser', [Aside\User\ProjectDeptController::class, 'getDeptUser'])->name('admin.user_getDeptUser');
});
//用户日志
Route::prefix('log')->group(function () {
Route::any('/', [Aside\User\UserLogController::class, 'lists'])->name('admin.user_log_lists');
});
});
//ai指令
... ... @@ -126,6 +134,11 @@ Route::middleware(['aloginauth'])->group(function () {
Route::post('/save', [Aside\Manage\HrController::class, 'save'])->name('admin.hr_save');
Route::get('/getSearchParamsList', [Aside\Manage\HrController::class, 'getSearchParamsList'])->name('admin.hr_getSearchParamsList');
});
//管理员日志
Route::prefix('log')->group(function () {
Route::any('/', [Aside\Manage\ManagerLogController::class, 'lists'])->name('admin.manager_log_lists');
});
});
//企业服务配置信息
... ... @@ -152,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');
... ... @@ -225,6 +240,11 @@ Route::middleware(['aloginauth'])->group(function () {
Route::any('/', [Aside\Optimize\OptimizeController::class, 'lists'])->name('admin.optimize_lists');//优化中台
});
//优化中台
Route::prefix('keyword')->group(function () {
Route::any('/', [Aside\Optimize\KeywordsController::class, 'lists'])->name('admin.optimize_keywords_lists');//优化中台
});
//上线审核列表
Route::prefix('online')->group(function () {
Route::any('/', [Aside\Optimize\OnlineController::class, 'lists'])->name('admin.online_lists');//上线审核列表
... ... @@ -301,7 +321,8 @@ Route::group([], function () {
Route::any('/domain/exportData', [Aside\Domain\DomainInfoController::class, 'exportData'])->name('admin.domain_exportData');//导出数据
Route::any('/notice/project', [Aside\Notice\NoticeController::class, 'project'])->name('admin.notice.project');
Route::any('/sendLoginSms', [Aside\LoginController::class, 'sendLoginSms'])->name('admin.sendLoginSms');//发送验证码
Route::any('/getProjectInService', [Aside\Project\ProjectController::class, 'getProjectInService'])->name('admin.getProjectInService');//获取项目服务状态
Route::any('/getProjectByChannel', [Aside\Project\ProjectController::class, 'getProjectByChannel'])->name('admin.getProjectByChannel');//获取渠道商的项目
});
... ...
... ... @@ -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');
... ... @@ -120,7 +120,8 @@ Route::middleware(['bloginauth'])->group(function () {
//首页设置
Route::any('/', [\App\Http\Controllers\Bside\Setting\WebSettingController::class, 'lists'])->name('web_setting_lists');
Route::any('/save', [\App\Http\Controllers\Bside\Setting\WebSettingController::class, 'save'])->name('web_setting_save');
Route::any('/sendNotify', [\App\Http\Controllers\Bside\Setting\WebSettingController::class, 'sendNotify'])->name('web_setting_sendNotify');
//通知
Route::any('/sendNotify', [\App\Http\Controllers\Bside\BCom\CNoticeController::class, 'sendNotify'])->name('web_setting_sendNotify');
//第三方代码获取与设置
Route::prefix('html')->group(function () {
... ... @@ -160,6 +161,12 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/languageList', [\App\Http\Controllers\Bside\Setting\ProofreadingController::class, 'languageList'])->name('web_proofreading_languageList');
});
//seo设置
Route::prefix('seo')->group(function () {
Route::any('/info', [\App\Http\Controllers\Bside\Setting\WebSettingSeoController::class, 'info'])->name('web_seo_info');
Route::any('/save', [\App\Http\Controllers\Bside\Setting\WebSettingSeoController::class, 'save'])->name('web_seo_save');
});
});
//产品
Route::prefix('product')->group(function () {
... ... @@ -268,6 +275,8 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/save', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'save'])->name('template_save');
//可视化保存获取数据类型
Route::any('/getTypeSetting', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getTypeSetting'])->name('template_getTypeSetting');
Route::any('/getHeadFooter', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getHeadFooter'])->name('template_getHeadFooter');
Route::any('/setHeadFooter', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'setHeadFooter'])->name('template_setHeadFooter');
// 模板
Route::prefix('module')->group(function () {
//获取所有左侧模版
... ...