作者 zhl

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

正在显示 79 个修改的文件 包含 1425 行增加585 行删除
... ... @@ -40,7 +40,8 @@ class Count extends Command
*/
public function handle()
{
$list = DB::table('gl_project')->where('gl_project.extend_type','!=',5)
$list = DB::table('gl_project')->where('gl_project.extend_type','=',0)
->where('gl_project.type','!=',0)
->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();
... ...
... ... @@ -2,21 +2,9 @@
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;
/**
* 最近一次询盘
... ...
... ... @@ -36,7 +36,8 @@ class InquiryMonthlyCount extends Command
* @time :2023/6/30 9:32
*/
public function handle(){
$list = DB::table('gl_project')->where('gl_project.extend_type','!=',5)
$list = DB::table('gl_project')->where('gl_project.extend_type','=',0)
->where('gl_project.type','!=',0)
->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();
... ...
... ... @@ -2,9 +2,8 @@
namespace App\Console\Commands\RankData;
use App\Helper\Arr;
use App\Helper\QuanqiusouApi;
use App\Models\Project\DeployBuild;
use App\Http\Logic\Bside\RankData\RankDataLogic;
use App\Models\Project\DeployOptimize;
use App\Models\Project\Project;
use App\Models\RankData\RankData as GoogleRankModel;
... ... @@ -39,6 +38,9 @@ class RankData extends BaseCommands
*/
public function do()
{
//所有项目 今日是否达标 重置
Project::where('is_remain_today', 1)->update(['is_remain_today' => 0]);
$error = 0;
$api = new QuanqiusouApi();
//有排名api编号的项目
... ... @@ -50,122 +52,14 @@ class RankData extends BaseCommands
return false;
}
foreach ($list as $item){
$model = GoogleRankModel::where('project_id', $item['project_id'])->where('lang', '')->first();
if (!$model || $model->updated_date != date('Y-m-d')) {
$res = $api->getGoogleRank($item['api_no']);
if(!$res){
$error++;
continue;
}
//收录数
$indexed_pages_num = $site_res[$item['api_no']] ?? 0;
$this->save_rank($item['project_id'], $res, $indexed_pages_num);
}
//有小语种的
$lang_list = $api->getLangList();
if(!empty($lang_list[$item['api_no']])){
$model = GoogleRankModel::where('project_id', $item['project_id'])->where('lang', '<>', '')->first();
if (!$model || $model->updated_date != date('Y-m-d')) {
$res = $api->getGoogleRank($item['api_no'], 1);
if(!$res){
$error++;
continue;
}
$data = [];
//不同的小语种取出来
foreach ($res as $keyword => $v){
$data[Arr::last($v)['lang']][$keyword] = $v;
}
foreach ($data as $lang => $rank){
$this->save_rank($item['project_id'], $rank, 0, $lang);
}
}
try {
(new RankDataLogic())->syncRankData($item['api_no'], $site_res);
}catch (\Exception $e){
LogUtils::info('rank_data error:' . $e->getMessage());
$error++;
continue;
}
}
return !$error;
}
/**
* @param $project_id
* @param int $indexed_pages_num
* @param $data
* @param string $lang
* @author zbj
* @date 2023/5/8
*/
public function save_rank($project_id, $data, int $indexed_pages_num = 0, string $lang = ''){
$without_project_ids = []; //不用处理排名的项目
$first_num = $first_page_num = $first_three_pages_num = $first_five_pages_num = $first_ten_pages_num = 0;
if(!$lang){
foreach ($data as &$ranks){
ksort($ranks);
foreach ($ranks as &$rank){
//处理排名
if(!in_array($project_id, $without_project_ids)){
if($rank['position'] >= 10){
$rank['position'] -= 5;
}
//todo 需要特殊处理排名的项目
}
}
$last = Arr::last($ranks);
//第一名
if($last['position'] == 1){
$first_num ++;
}
//排名第一页
if($last['position'] > 0 && $last['position'] <= 10){
$first_page_num ++;
}
//排名前三页
if($last['position'] > 0 && $last['position'] <= 30){
$first_three_pages_num ++;
}
//排名前五页
if($last['position'] > 0 && $last['position'] <= 50){
$first_five_pages_num ++;
}
//排名前十页
if($last['position'] > 0 && $last['position'] <= 100){
$first_ten_pages_num ++;
}
}
}
$where = [
'project_id' => $project_id,
'lang' => $lang
];
$model = GoogleRankModel::where($where)->first();
if(!$model){
$model = new GoogleRankModel();
}
//关键词达标天数
$model->is_compliance = 0;
if($model->updated_date != date('Y-m-d')){
//保证关键词数
$keyword_num = DeployBuild::where('project_id', $project_id)->value('keyword_num');
$type = Project::where('id', $project_id)->value('type');
if($keyword_num && $type == 2 && $first_page_num >= $keyword_num){
$model->compliance_day = $model->compliance_day + 1;
$model->is_compliance = 1;
}
}
$model->project_id = $project_id;
$model->first_num = $first_num;
$model->first_page_num = $first_page_num;
$model->first_three_pages_num = $first_three_pages_num;
$model->first_five_pages_num = $first_five_pages_num;
$model->first_ten_pages_num = $first_ten_pages_num;
$model->indexed_pages_num = $indexed_pages_num;
$model->lang = $lang;
$model->data = $data;
$model->updated_date = date('Y-m-d');
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($model, true) . PHP_EOL, FILE_APPEND);
$model->save();
}
}
... ...
<?php
namespace App\Console\Commands\RankData;
use App\Helper\QuanqiusouApi;
use App\Http\Logic\Bside\RankData\RankDataLogic;
use App\Models\Com\NoticeLog;
use App\Models\Project\DeployOptimize;
use App\Models\Project\Project;
use App\Models\RankData\RankData as GoogleRankModel;
use App\Utils\LogUtils;
use Illuminate\Console\Command;
/**
* Class GoogleRank
* @package App\Console\Commands
* @author zbj
* @date 2023/5/6
*/
class RankDataTask extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'rank_data_task';
/**
* The console command description.
* The console command description.
*
* @var string
*/
protected $description = '谷歌排名数据';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* @author zbj
* @date 2023/5/6
*/
public function handle()
{
$list = NoticeLog::where('type', NoticeLog::TYPE_RANK_DATA)->where('status', NoticeLog::STATUS_PENDING)->get();
foreach ($list as $item){
try {
(new RankDataLogic())->syncRankData($item['data']['api_no']);
$item->status = NoticeLog::STATUS_SUCCESS;
$item->save();
}catch (\Exception $e){
errorLog('排名数据更新失败', $item, $e);
$this->retry($item);
}
}
}
/**
* @param NoticeLog $log
*/
public function retry($log){
if($log->retry >= 3){
$log->status = NoticeLog::STATUS_FAIL;
}else{
$log->retry = $log->retry + 1;
}
$log->save();
}
}
... ...
... ... @@ -70,6 +70,9 @@ class RemainDay extends Command
}
}
$item->remain_day = $remain_day > 0 ? $remain_day : 0;
if($item->remain_day == 0){
$item->extend_type = Project::TYPE_FIVE;
}
$item->save();
}
}
... ...
... ... @@ -7,12 +7,15 @@ use App\Helper\Common;
use App\Helper\OaGlobalsoApi;
use App\Models\Channel\Channel;
use App\Models\Com\NoticeLog;
use App\Models\Com\UpdateLog;
use App\Models\Project\After;
use App\Models\Project\DeployBuild;
use App\Models\Project\DeployOptimize;
use App\Models\Project\Payment;
use App\Models\Project\Project;
use App\Models\Project\ProjectRenew;
use App\Models\User\User as UserModel;
use App\Services\ProjectServer;
use App\Utils\LogUtils;
use Hashids\Hashids;
use Illuminate\Console\Command;
... ... @@ -62,14 +65,20 @@ class SyncProject extends Command
$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']);
$is_update = $item['data']['is_update']??0;//是否是4.0或5.0更新到6.0
$order_id = $item['data']['order_id'];
if($is_update == 1){
$data = http_get('https://quanqiusou.cn/extend_api/v6/update.php?postid='.$order_id, ['charset' => 'UTF-8']);
}else{
$api = new OaGlobalsoApi();
$data = $api->order_info($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']);
$this->sync($data['data'],$is_update);
//同步aicc
if($data['data']['exclusive_aicc']){
... ... @@ -164,7 +173,7 @@ class SyncProject extends Command
* @method :post
* @time :2023/8/9 15:04
*/
public function sync($param){
public function sync($param,$is_update = 0){
$title = date('Ymd') . '-' . $param['company_name'];
$data = [
'project'=>[
... ... @@ -183,6 +192,7 @@ class SyncProject extends Command
'hagro' => $param['exclusive_hagro'],
"exclusive_hagro_day" => $param['exclusive_hagro_day'],
'notice_order_id' => $param['id'],
'type' => $is_update
],
'deploy_build' => [
'service_duration' => $param['years'],
... ... @@ -207,6 +217,22 @@ class SyncProject extends Command
$this->saveDeployBuild($data['deploy_build'],$id);
$this->saveDeployOptimize($data['deploy_optimize'],$id);
$this->saveAfter($data['project_after'],$id);
if($is_update == 1){
//4.0或5.0更新到6.0
//初始化数据库
$this->initializationMysql($id);
//初始账号
$this->createUser($data['project']['mobile'],$id,$data['project']['lead_name']);
//新增数据抓取任务
foreach ($param['api_type'] as $v_type){
UpdateLog::createLog($id,$v_type,$param['get_data_url']);
}
}
DB::commit();
}catch (\Exception $e){
DB::rollBack();
... ... @@ -379,6 +405,7 @@ class SyncProject extends Command
'phone' => $data['principal_mobile'],
'planday' => $data['exclusive_aicc_day'] ?: 1,
'from_order_id' => $data['from_order_id'],
'agent_phone' => Channel::where('source_id', $data['company_id'])->value('contact_mobile') ?: '',
];
$common = new Common();
$token = $common->encrypt($param);
... ... @@ -387,4 +414,43 @@ class SyncProject extends Command
LogUtils::error('ProjectToHagro error', $res);
}
}
/**
* 初始化数据库
* @param $project_id
* @author Akun
* @date 2023/09/19 15:12
*/
public function initializationMysql($project_id){
//切换数据库配置
$project = ProjectServer::useProject($project_id);
//创建数据库
ProjectServer::createDatabase($project);
//创建表
ProjectServer::initTable();
}
/**
* 创建用户
* @param $mobile
* @param $project_id
* @param $lead_name
* @author Akun
* @date 2023/09/19 15:12
*/
public function createUser($mobile,$project_id,$lead_name){
$userModel = new UserModel();
//查看当前用户是否存在
$info = $userModel->read(['mobile'=>$mobile,'project_id'=>$project_id]);
if($info === false){
$data = [
'mobile'=>$mobile,
'password'=>base64_encode(md5('123456')),
'project_id'=>$project_id,
'name'=>$lead_name,
'type'=>UserModel::TYPE_ONE
];
$userModel->add($data);
}
}
}
... ...
... ... @@ -17,6 +17,7 @@ class Kernel extends ConsoleKernel
{
// $schedule->command('inspire')->hourly();
$schedule->command('remain_day')->dailyAt('03:00')->withoutOverlapping(1); // 项目剩余服务时长
$schedule->command('rank_data_task')->everyMinute()->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); // 排名数据-外链,每周一凌晨执行一次
... ...
... ... @@ -252,6 +252,7 @@ zFePUMXy1bFghAfzNKlrc5XgH4ixeeMh3cDtU97K
return $this->http_click('post',$url,$param);
}
/**
* 发送http post,get,put,delete请求
* @param type $url
... ...
... ... @@ -69,7 +69,7 @@ class Common
}
} else {
//带原语种翻译
$result = Translate::translateSl($param['keywords'])->json();
$result = Translate::translateSl($param['keywords']);
if (isset($result['texts']['sl']) && isset(Translate::$tls_list[$result['texts']['sl']])) {
$lang = Translate::$tls_list[$result['texts']['sl']]['text'];
} else {
... ... @@ -135,8 +135,8 @@ class Common
}
}else{
$key = 'cache_'.$table.'_'.$id.'_type';
Cache::store('file')->pull($key);
}
Cache::store('file')->pull($key);
}
return true;
}
... ...
... ... @@ -17,7 +17,14 @@ class Translate
{
//接口地址
// public static $url = 'https://translate.hbb618.cn/translates';
public static $url = 'https://translate.hbbapi.com/';
public static $url = 'https://api.cmer.com/';
public static $header = array(
'accept: application/json',
'Content-Type: application/json',
'apikey: UkzZljFv83Z2qBi5YR1o3f2otAVWtug6',
'X-CmerApi-Host:ai_translate.p.cmer.com'
);
public static $tls_list = [
'en' => [
... ... @@ -734,7 +741,7 @@ class Translate
'sl' => 'auto',
'tls' => $tls,
];
return Http::post(self::$url.$action, $data);
return http_post(self::$url.$action, json_encode($data),self::$header);
}
/**
... ... @@ -749,11 +756,8 @@ class Translate
if (!$texts) {
return '';
}
$retsult = self::translate($texts, $tls)->json();
return $retsult[0]['texts'] ?? '';
$result = self::translate($texts, $tls);
return $result[0]['texts'] ?? '';
}
/**
* 翻译带源语种
... ... @@ -772,7 +776,7 @@ class Translate
'sl' => 'auto',
'tl' => $tl,
];
return Http::post(self::$url . $action, $data);
return http_post(self::$url.$action, json_encode($data),self::$header);
}
}
... ...
... ... @@ -419,28 +419,21 @@ if (!function_exists('getImageUrl')) {
* @method :post
* @time :2023/7/20 16:46
*/
function getImageUrl($hash){
if(is_array($hash)){
foreach ($hash as $v){
function getImageUrl($path,$location = 1){
if(empty($path)){
return '';
}
if(is_array($path)){
foreach ($path as $v){
$url[] = getImageUrl($v);
}
}else{
$imageModel = new Image();
if (strpos($hash, '.') !== false) {
$info = $imageModel->read(['path'=>['like','%'.$hash.'%']]);
}else{
$info = $imageModel->read(['hash'=>$hash]);
}
if(!empty($info)){
if($info['is_cos'] == 1){
$cos = config('filesystems.disks.cos');
$cosCdn = $cos['cdn'];
$url = $cosCdn.$info['path'];
}else{
$url = url($info['path']);
}
if($location == 1){
$cos = config('filesystems.disks.cos');
$cosCdn = $cos['cdn'];
$url = $cosCdn.$path;
}else{
$url = $hash;
$url = url($path);
}
}
return $url;
... ... @@ -454,33 +447,27 @@ if (!function_exists('getFileUrl')) {
* @method :post
* @time :2023/7/20 16:46
*/
function getFileUrl($hash){
if(is_array($hash)){
foreach ($hash as $v){
function getFileUrl($path,$location = 1){
if(empty($path)){
return '';
}
if(is_array($path)){
foreach ($path as $v){
$url[] = getFileUrl($v);
}
}else{
$fileModel = new File();
if (strpos($hash, '.') !== false) {
$info = $fileModel->read(['path'=>['like','%'.$hash.'%']]);
}else{
$info = $fileModel->read(['hash'=>$hash]);
}
if(!empty($info)){
if($info['is_cos'] == 1){
$cos = config('filesystems.disks.cos');
$cosCdn = $cos['cdn'];
$url = $cosCdn.'/upload'.$info['path'];
}else{
$url = url('upload'.$info['path']);
}
if($location == 1){
$cos = config('filesystems.disks.cos');
$cosCdn = $cos['cdn'];
$url = $cosCdn.$path;
}else{
$url = $hash;
$url = url($path);
}
}
return $url;
}
}
/**
* @remark :字符串截取
* @name :characterTruncation
... ... @@ -533,3 +520,31 @@ if (!function_exists('str_replace_url')) {
}
}
}
if(!function_exists('curlGet')){
/**
* @remark :忽略证书curl请求
* @name :curlGet
* @author :lyh
* @method :post
* @time :2023/9/12 10:10
*/
function curlGet($url){
$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, array());
curl_setopt($ch1, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch1, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch1, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch1, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch1, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch1, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
$access_txt = curl_exec($ch1);
curl_close($ch1);
return json_decode($access_txt, true);
}
}
... ...
... ... @@ -66,7 +66,6 @@ class DomainInfoController extends BaseController
'remark.required' => '备注不能为空',
'belong_to.required' => '域名不能为空',
]);
return true;
}
/**
... ...
... ... @@ -39,12 +39,7 @@ class HrController extends BaseController
* @time :2023/9/6 10:04
*/
public function info(HrLogic $logic){
$this->request->validate([
'id'=>'required'
],[
'id.required' => 'ID不能为空'
]);
$info = $logic->getHrInfo($this->param['id']);
$info = $logic->getHrInfo();
$info['photo_gallery_link'] = $info['photo_gallery'];
$info['id_card_gallery_link'] = $info['id_card_gallery'];
$info['certificate_gallery_link'] = $info['certificate_gallery'];
... ...
... ... @@ -78,12 +78,12 @@ class ManageController extends BaseController
*/
public function delete(ManageLogic $logic){
$this->request->validate([
'ids'=>['required', new Ids()]
'ids'=>'required'
],[
'ids.required' => 'ID不能为空'
]);
$logic->delete($this->param['ids']);
$this->response('success');
$logic->managerDelete();
$this->response('删除成功');
}
/**
... ...
... ... @@ -17,13 +17,10 @@ class NoticeController extends BaseController
{
/**
* 项目通知
* @return \Illuminate\Http\JsonResponse
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @author zbj
* @date 2023/6/26
*/
public function project(ProjectLogic $logic)
public function project()
{
//首次 续费
LogUtils::info('notice project', $this->param);
... ... @@ -31,4 +28,18 @@ class NoticeController extends BaseController
$this->response('success');
}
/**
*
* 更新排名数据通知
* @author zbj
* @date 2023/9/20
*/
public function rank_data()
{
LogUtils::info('notice rank_data', $this->param);
NoticeLog::createLog(NoticeLog::TYPE_RANK_DATA, $this->param);
$this->response('success');
}
}
... ...
... ... @@ -70,13 +70,6 @@ class ProjectGscController extends BaseController
* @time :2023/6/19 16:28
*/
public function save(GscRequest $gscRequest,GscLogic $gscLogic){
if(isset($this->param['id'])){
$gscRequest->validate([
'id'=>'required'
],[
'id.required' => 'GSC账号ID不能为空'
]);
}
$gscRequest->validated();
$gscLogic->GscSave();
$this->response('success');
... ...
... ... @@ -38,13 +38,6 @@ class ProjectsController extends BaseController
* @time :2023/7/11 9:53
*/
public function save(ProjectsLogic $projectsLogic){
if(isset($this->param['id']) && !empty($this->param['id'])){
$this->request->validate([
'id'=>'required'
],[
'id.required' => 'ID不能为空'
]);
}
//参数验证
$this->verifyParam();
$projectsLogic->projectsSave();
... ...
... ... @@ -95,6 +95,7 @@ class ProjectController extends BaseController
*/
public function searchType(&$query){
$query->where('gl_project.delete_status',Project::TYPE_ZERO);
$query->where('gl_project.extend_type',Project::TYPE_ZERO);
if(!isset($this->map['type'])){
$this->map['type'] = Project::TYPE_ZERO;
}
... ... @@ -512,7 +513,7 @@ class ProjectController extends BaseController
*/
public function getServiceConfig(){
$serviceConfigModel = new ServerConfig();
$list = $serviceConfigModel->list($this->param,'id',['id','type','title']);
$list = $serviceConfigModel->list($this->param,'id',['id','type','title','init_domain','service_type']);
$this->response('success',Code::SUCCESS,$list);
}
... ...
... ... @@ -22,6 +22,7 @@ use App\Models\Manage\Manage;
use App\Models\Project\DeployBuild;
use App\Models\Project\DeployOptimize;
use App\Models\Project\Project;
use App\Models\Project\ProjectRenew;
use App\Models\Task\Task;
use Carbon\Carbon;
... ... @@ -171,4 +172,57 @@ class RenewProjectController extends BaseController
];
return $item;
}
/**
* @remark :关联续费单
* @name :editRenew
* @author :lyh
* @method :post
* @time :2023/9/19 9:59
*/
public function editRenew(RenewLogic $logic){
$this->request->validate([
'id'=>'required',
'renew_id'=>'required',
],[
'id.required' => 'id不能为空',
'renew_id'=>'续费单id不能为空',
]);
$logic->editProjectRenew();
$this->response('同步成功');
}
/**
* @remark :获取所有续费单
* @name :getRenewList
* @author :lyh
* @method :post
* @time :2023/9/19 11:21
*/
public function getRenewList(ProjectRenew $projectRenew){
$this->map['project_id'] = 0;
$this->map['status'] = 0;
$list = $projectRenew->list($this->map);
$this->response('success',Code::SUCCESS,$list);
}
/**
* @remark :逻辑删除续费单
* @name :delRenew
* @author :lyh
* @method :post
* @time :2023/9/19 15:47
*/
public function editStatusRenew(RenewLogic $logic){
$this->request->validate([
'id'=>'required',
'status'=>'required',
],[
'id.required' => 'id不能为空',
'status.required' => 'status不能为空',
]);
$logic->editStatus();
$this->response('success');
}
}
... ...
... ... @@ -94,7 +94,7 @@ class AyrShareController extends BaseController
$ayrShareHelper = new AyrShareHelper();
$res = $ayrShareHelper->post_create_profiles($param);
if($res['status'] == 'fail'){
$this->response('同步绑定失败');
$this->response('同步绑定失败,当前账号已存在',Code::USER_ERROR);
}
//执行数据库操作
$ayrShareLogic->ayr_share_save($res);
... ...
... ... @@ -39,7 +39,7 @@ class CNoticeController extends BaseController
if((!empty($progressInfo))){
$progressInfo = $progressInfo->toArray();
if(($progressInfo['total_num'] > $progressInfo['current_num'])){
$this->response('当前页面正在生成了,请完成后再点击',Code::USER_ERROR,$progressInfo);
$this->response('当前页面正在生成了,请完成后再点击',Code::SUCCESS,$progressInfo);
}
}
//通知更新
... ... @@ -50,12 +50,12 @@ class CNoticeController extends BaseController
}
$urlStr = $this->getString($this->param['type'],$this->param['page']);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($urlStr, true) . PHP_EOL, FILE_APPEND);
$this->curlGet($urlStr);
$this->response('success');
curlGet($urlStr);
$this->response('更新成功');
}
/**
* @remark :主通知
* @remark :主通知
* @name :updateMaster
* @author :lyh
* @method :post
... ... @@ -98,11 +98,6 @@ class CNoticeController extends BaseController
$updateNotifyModel = new UpdateNotify();
try {
if($this->param['page'] == UpdateNotify::PAGE_ALL){
$this->request->validate([
'language' => 'required',
], [
'language.required' => '请选择语种',
]);
//如果是更新所有
$routeMapModel = new RouteMap();
$count = $routeMapModel->formatQuery(['project_id'=>$this->user['project_id']])->count();
... ... @@ -110,13 +105,6 @@ class CNoticeController extends BaseController
$extent = json_encode(['language'=>$this->param['language']]);
$this->addProgress($count,$this->param['type'],$this->param['page'],$extent);
}else{
$this->request->validate([
'url'=>'required',
'language' => 'required',
], [
'url.required' => '请输入更新链接',
'language.required' => '请选择语种',
]);
//根据传递的参数更新
$count = count($this->param['url']);
$extent = json_encode(['url'=>$this->param['url'],'language'=>$this->param['language']]);
... ... @@ -129,32 +117,6 @@ class CNoticeController extends BaseController
}
/**
* @remark :curl请求
* @name :curlGet
* @author :lyh
* @method :post
* @time :2023/9/12 10:10
*/
public function curlGet($url){
$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, array());
curl_setopt($ch1, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch1, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch1, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch1, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch1, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch1, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
$access_txt = curl_exec($ch1);
curl_close($ch1);
return json_decode($access_txt, true);
}
/**
* @remark :生成一条更新记录
* @name :addProgress
* @author :lyh
... ... @@ -215,4 +177,5 @@ class CNoticeController extends BaseController
}
$this->response('success',Code::SUCCESS,$lists);
}
}
... ...
... ... @@ -148,7 +148,7 @@ class ComController extends BaseController
$this->response('系统错误',Code::SYSTEM_ERROR);
}
Cache::pull($info['token']);
$this->response('success',Code::USER_LOGIN_ERROE);
$this->response('success');
}
/**
... ...
<?php
namespace App\Http\Controllers\Bside\Import;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\Import\ImportLogic;
use App\Http\Requests\Bside\Import\ImportTaskRequest;
/**
* 新闻、博客、商品导入
* Class ImportController
* @package App\Http\Controllers\Bside\Import
*/
class ImportController extends BaseController
{
/**
* 新增导入任务
* @param ImportTaskRequest $request
* @param ImportLogic $logic
* @throws \App\Exceptions\AsideGlobalException
* @throws \App\Exceptions\BsideGlobalException
* @author Akun
* @date 2023/09/20 11:36
*/
public function save(ImportTaskRequest $request,ImportLogic $logic)
{
$request->validated();
$logic->addImportTask();
$this->response('success', Code::SUCCESS);
}
}
... ...
... ... @@ -4,7 +4,7 @@ namespace App\Http\Controllers\Bside\Inquiry;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\InquiryLogic;
use App\Http\Logic\Bside\Inquiry\InquiryLogic;
use App\Rules\Ids;
use App\Services\BatchExportService;
use Illuminate\Http\Request;
... ...
... ... @@ -15,21 +15,15 @@ use App\Events\WebSocketMessageSent;
use App\Helper\Common;
use App\Helper\Translate;
use App\Helper\Wechat;
use App\Http\Logic\Bside\User\UserLogic;
use App\Http\Logic\Bside\User\UserLoginLogic;
use App\Models\File\Image as ImageModel;
use App\Models\Project\Project;
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;
use Illuminate\Database\Eloquent\Model;
use \Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Cache;
use Mrgoon\AliSms\AliSms;
class LoginController extends BaseController
... ... @@ -116,7 +110,7 @@ class LoginController extends BaseController
'mobile.regex' => '请输入正确的手机号码',
]);
$mobile = $this->param['mobile'];
$user = UserModel::where(['mobile' => $mobile])->first();
$user = User::where(['mobile' => $mobile])->first();
if (empty($user)) {
$this->response('请输入正确的手机号码!', Code::USER_LOGIN_ERROE);
}
... ...
... ... @@ -110,10 +110,4 @@ class NavController extends BaseController
$navLogic->navSort();
$this->response('success');
}
}
... ...
... ... @@ -97,7 +97,7 @@ class NewsController extends BaseController
}
return $category_name;
}
/**
* @remark :根据状态数量
* @name :getStatusNumber
... ...
... ... @@ -31,16 +31,15 @@ class CategoryController extends BaseController
*/
public function index(Category $category)
{
if(!empty($this->map['title'])){
$this->map['title'] = ['like','%'.$this->map['title'].'%'];
}
$this->map['project_id'] = $this->user['project_id'];
$this->map = $this->searchParam();
$filed = ['id', 'project_id', 'pid', 'title', 'image', 'route','keywords', 'describe', 'status','created_at'];
$list = $category->list($this->map,'id',$filed);
$data = [];
if(!empty($list)){
foreach ($list as $k =>$v){
$v = $this->handleParam($v);
$v['url'] = $this->user['domain'] . $v['route'];
$v['product_num'] = Product::where('category_id','like' ,'%,'.$v['id'].',%')->count();;
$v['image_link'] = getImageUrl($v['image']);
$list[$k] = $v;
}
$data = $this->getListSon($list);
... ... @@ -49,17 +48,18 @@ class CategoryController extends BaseController
}
/**
* @remark :分类处理参数
* @name :handleParam
* @remark :搜索参数处理
* @name :searchParam
* @author :lyh
* @method :post
* @time :2023/8/17 11:10
* @time :2023/9/14 14:57
*/
public function handleParam($v){
$v['url'] = $this->user['domain'] . RouteMap::getRoute(RouteMap::SOURCE_PRODUCT_CATE, $v['id'], $v['project_id']);
$v['product_num'] = Product::where('category_id','like' ,'%,'.$v['id'].',%')->count();;
$v['image_link'] = getImageUrl($v['image']);
return $v;
public function searchParam(){
if(!empty($this->map['title'])){
$this->map['title'] = ['like','%'.$this->map['title'].'%'];
}
$this->map['project_id'] = $this->user['project_id'];
return $this->map;
}
/**
... ...
... ... @@ -36,13 +36,13 @@ class KeywordController extends BaseController
$this->map['title'] = ['like','%'.$this->map['title'].'%'];
}
$this->map['project_id'] = $this->user['project_id'];
$filed = ['id', 'project_id', 'title', 'seo_title', 'seo_keywords', 'seo_description', 'status', 'created_at'];
$filed = ['id', 'project_id', 'title', 'seo_title', 'seo_keywords', 'seo_description', 'status', 'created_at','route'];
$data = $keyword->lists($this->map,$this->page,$this->row,$this->order,$filed);
if(!empty($data)){
foreach ($data['list'] as &$v){
$v['product_num'] = Product::where('keyword_id','like' ,'%,'.$v['id'].',%')->count();
$v['tdk'] = boolval($v['seo_title']) * boolval($v['seo_keywords']) * boolval($v['seo_description']);
$v['url'] = $this->user['domain'] . RouteMap::getRoute(RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']);
$v['url'] = $this->user['domain'] . $v['route'];
}
}
return $this->response('success',Code::SUCCESS,$data);
... ...
... ... @@ -5,6 +5,7 @@ namespace App\Http\Controllers\Bside\Product;
use App\Enums\Common\Code;
use App\Exceptions\BsideGlobalException;
use App\Helper\Arr;
use App\Helper\Common;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\Product\ProductLogic;
use App\Http\Requests\Bside\Product\ProductRequest;
... ... @@ -18,6 +19,7 @@ use App\Models\Template\BTemplate;
use App\Models\User\User;
use App\Rules\Ids;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
/**
... ... @@ -38,21 +40,23 @@ class ProductController extends BaseController
*/
public function index(Product $product)
{
$this->order = 'sort';
if(isset($this->map['title']) && !empty($this->map['title'])){
$this->map['title'] = ['like','%'.$this->map['title'].'%'];
}
if(isset($this->map['category_id']) && !empty($this->map['category_id'])){
$this->map['category_id'] = ['like','%'.$this->map['category_id'].'%'];
}
$this->map['project_id'] = $this->user['project_id'];
$this->map = $this->searchParam();
$filed = ['id', 'project_id', 'title', 'sort' ,'thumb', 'gallery' ,'product_type' , 'route' ,
'category_id', 'keyword_id', 'status', 'created_uid', 'created_at', 'updated_at'];
$lists = $product->lists($this->map,$this->page,$this->row,$this->order,$filed);
if(!empty($lists['list'])){
$lists = $product->lists($this->map,$this->page,$this->row,$this->order = ['sort','id'],$filed);
if(!empty($lists) && !empty($lists['list'])){
$cate_data = $this->getCategoryList();//分类
$key_data = $this->getKeywordsList();//关键字
//获取当前用户选择的模版
$templateSettingModel = new BSetting();
$info = $templateSettingModel->read(['project_id'=>$this->user['project_id']]);
$userModel = new User();
foreach ($lists['list'] as $k=>$v){
//处理参数
$v = $this->handleParam($v);
$v['category_id_text'] = $this->categoryName($v['category_id'],$cate_data);
$v['keyword_id_text'] = $this->keywordName($v['keyword_id'],$key_data);
$v['created_uid_text'] = $userModel->getName($v['created_uid']);
$v['is_renovation'] = $this->getProductIsRenovation($info,$v['id']);
$v['url'] = $this->user['domain'].$v['route'];
$lists['list'][$k] = $v;
}
}
... ... @@ -60,15 +64,31 @@ class ProductController extends BaseController
}
/**
* @remark :搜索参数处理
* @name :searchParam
* @author :lyh
* @method :post
* @time :2023/9/14 14:32
*/
public function searchParam(){
if(isset($this->map['title']) && !empty($this->map['title'])){
$this->map['title'] = ['like','%'.$this->map['title'].'%'];
}
if(isset($this->map['category_id']) && !empty($this->map['category_id'])){
$this->map['category_id'] = ['like','%'.$this->map['category_id'].'%'];
}
$this->map['project_id'] = $this->user['project_id'];
return $this->map;
}
/**
* @remark :查看产品是否已装修
* @name :getProductIsRenovation
* @author :lyh
* @method :post
* @time :2023/9/13 14:02
*/
public function getProductIsRenovation($id){
$templateSettingModel = new BSetting();
$info = $templateSettingModel->read(['project_id'=>$this->user['project_id']]);
public function getProductIsRenovation($info,$id){
if($info !== false){
$webTemplateModel = new BTemplate();
$param = [
... ... @@ -86,6 +106,110 @@ class ProductController extends BaseController
}
/**
* @remark :获取所有分类
* @name :getCategoryList
* @author :lyh
* @method :post
* @time :2023/9/14 13:56
*/
public function getCategoryList(){
$data = Common::get_user_cache('product_category',$this->user['project_id']);
if(empty($data)){
$categoryModel = new Category();
$data = [];
$cateList = $categoryModel->list(['project_id'=>$this->user['project_id']],['id','title']);
if(!empty($cateList)){
foreach ($cateList as $value){
$data[$value['id']] = $value['title'];
}
}
Common::set_user_cache($data,'product_category',$this->user['project_id']);
}
return $data;
}
/**
* @remark :获取所有关键词
* @name :getCategoryList
* @author :lyh
* @method :post
* @time :2023/9/14 13:56
*/
public function getKeywordsList(){
$data = Common::get_user_cache('product_keyword',$this->user['project_id']);
if(empty($data)) {
$keywordModel = new Keyword();
$data = [];
$cateList = $keywordModel->list(['project_id' => $this->user['project_id']], ['id', 'title']);
if (!empty($cateList)) {
foreach ($cateList as $value) {
$data[$value['id']] = $value['title'];
}
}
Common::set_user_cache($data,'product_keyword',$this->user['project_id']);
}
return $data;
}
/**
* @remark :获取分类名称
* @name :categoryName
* @author :lyh
* @method :post
* @time :2023/9/14 13:58
*/
public function categoryName($category_id,$data){
$category_name = '';
if(!empty($category_id) && !empty($data)){
foreach ($category_id as $v){
if(isset($data[$v])){
$category_name .= $data[$v].',';
}
}
$category_name = trim($category_name,',');
}
return $category_name;
}
/**
* @remark :获取关键词名称
* @name :categoryName
* @author :lyh
* @method :post
* @time :2023/9/14 13:58
*/
public function keywordName($keyword_id,$data){
$keyword_name = '';
if(!empty($keyword_id) && !empty($data)){
foreach ($keyword_id as $v){
if(isset($data[$v])){
$keyword_name .= $data[$v].',';
}
}
$keyword_name = trim($keyword_name,',');
}
return $keyword_name;
}
/**
* @remark :详情
* @name :info
* @author :lyh
* @method :post
* @time :2023/8/21 18:12
*/
public function info(Product $product){
$this->request->validate([
'id'=>'required'
],[
'id.required' => 'ID不能为空'
]);
$info = $product->read(['id'=>$this->param['id']]);
$info = $this->handleParam($info);
return $this->response('success',Code::SUCCESS,$info);
}
/**
* @remark :处理列表参数
* @name :handleParam
* @author :lyh
... ... @@ -112,29 +236,13 @@ class ProductController extends BaseController
$v['keyword_id_text'] = trim($v['keyword_id_text'],',');
}
$v['status_text'] = Product::statusMap()[$v['status']] ?? '';
$v['created_uid_text'] = (new User())->read(['id'=>$v['created_uid']])['name'] ?? '';
//获取当前用户选择的模版
$templateSettingModel = new BSetting();
$templateInfo = $templateSettingModel->read(['project_id'=>$this->user['project_id']]);
$v['is_renovation'] = $this->getProductIsRenovation($templateInfo,$v['id']);
$v['url'] = $this->user['domain'].$v['route'];
$v['is_renovation'] = $this->getProductIsRenovation($v['id']);
return $v;
}
/**
* @remark :详情
* @name :info
* @author :lyh
* @method :post
* @time :2023/8/21 18:12
*/
public function info(Product $product){
$this->request->validate([
'id'=>'required'
],[
'id.required' => 'ID不能为空'
]);
$info = $product->read(['id'=>$this->param['id']]);
$info = $this->handleParam($info);
return $this->response('success',Code::SUCCESS,$info);
}
/**
... ...
... ... @@ -8,7 +8,7 @@ use App\Helper\GoogleSpeedApi;
use App\Helper\QuanqiusouApi;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Aside\Project\ProjectLogic;
use App\Http\Logic\Bside\RankDataLogic;
use App\Http\Logic\Bside\RankData\RankDataLogic;
use App\Models\RankData\RankData;
use App\Models\RankData\Speed as GoogleSpeedModel;
use App\Services\BatchExportService;
... ...
... ... @@ -6,6 +6,8 @@ use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\BTemplate\BTemplateLogic;
use App\Http\Requests\Bside\Template\TemplateRequest;
use App\Models\Template\BTemplate;
use App\Models\Template\Template;
class BTemplateController extends BaseController
{
... ... @@ -71,10 +73,6 @@ class BTemplateController extends BaseController
* @time :2023/6/29 10:02
*/
public function save(TemplateRequest $templateRequest,BTemplateLogic $BTemplateLogic){
//演示项目,不允许其他号码编辑$this->user['mobile'] != '15928018676' ||
if(($this->user['project_id'] == 1) && ($this->user['mobile'] != '15680871314') && ($this->param['source'] == 1)){
$this->response('演示项目仅支持演示功能,无法更改首页',Code::USER_ERROR);
}
$templateRequest->validated();
$BTemplateLogic->templateSave();
$this->response('success');
... ... @@ -123,4 +121,24 @@ class BTemplateController extends BaseController
$this->response('success',Code::SUCCESS,$info);
}
/**
* @remark :根据项目保存公共模板
* @name :savePublicTemplate
* @author :lyh
* @method :post
* @time :2023/9/18 10:58
*/
public function savePublicTemplate(BTemplateLogic $BTemplateLogic){
$this->request->validate([
'name'=>'required',
'html'=>'required',
'image'=>'required',
],[
'name.required' => '模板名称不能为空',
'html.required' => 'html不能为空',
'image.required' => '模板图片不能为空'
]);
$BTemplateLogic->savePublicTemplateHtml();
$this->response('模板保存成功');
}
}
... ...
... ... @@ -48,6 +48,23 @@ class BTemplateLogController extends BaseController
}
/**
* @remark :获取数据详情
* @name :info
* @author :lyh
* @method :post
* @time :2023/9/19 14:41
*/
public function info(BTemplateLogLogic $logic){
$this->request->validate([
'id'=>['required'],
],[
'id.required' => '模版ID不能为空',
]);
$info = $logic->templateLogInfo();
$this->response('success',Code::SUCCESS,$info);
}
/**
* @remark :回滚版本
* @name :rollbackVersion
* @author :lyh
... ...
... ... @@ -69,13 +69,6 @@ class CustomTemplateController extends BaseController
* @time :2023/6/29 9:30
*/
public function save(CustomTemplateRequest $customTemplateRequest,CustomTemplateLogic $customTemplateLogic){
if(isset($this->param['id']) && !empty($this->param['id'])){
$this->request->validate([
'id'=>['required'],
],[
'id.required' => 'ID不能为空',
]);
}
$customTemplateRequest->validated();
$customTemplateLogic->customTemplateSave();
$this->response('success');
... ... @@ -111,7 +104,7 @@ class CustomTemplateController extends BaseController
],[
'id.required' => 'ID不能为空',
]);
$customTemplateLogic->customTemplateSave();
$customTemplateLogic->saveHtml();
$this->response('success');
}
}
... ...
... ... @@ -5,7 +5,7 @@ namespace App\Http\Controllers\Bside\Visit;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\VisitLogic;
use App\Http\Logic\Bside\Visit\VisitLogic;
/**
... ...
... ... @@ -97,7 +97,7 @@ class FileController
$size = $files->getSize();
$file_type = $files->getClientOriginalExtension();
$mime = $files->getMimeType();
return $this->single($files,$size,$file_type,$mime);
return $this->single($files);
}
}
... ... @@ -108,7 +108,7 @@ class FileController
* @method :post
* @time :2023/6/17 16:32
*/
public function single(&$files,$size,$file_type,$mime = ''){
public function single(&$files){
$hash = hash_file('md5', $files->getPathname());
//查看文件是否存在
$fileModel = new File();
... ... @@ -117,7 +117,7 @@ class FileController
return $this->response('资源',Code::SUCCESS,$this->responseData($file_hash['path']));
}
$url = $this->config['root'].$this->path;
$fileName = uniqid().rand(10000,99999).'.'.$file_type;
$fileName = uniqid().rand(10000,99999).'.'.$files->getClientOriginalExtension();
//同步数据到cos
if($this->upload_location == 1){
$cosService = new CosService();
... ... @@ -128,7 +128,7 @@ class FileController
return $this->response($files->getError(), Code::USER_ERROR);
}
}
$this->saveMysql($fileModel,$size,$file_type,$fileName,$hash,$this->upload_location,$mime);
$this->saveMysql($fileModel,$files->getSize(),$files->getClientOriginalExtension(),$fileName,$hash,$this->upload_location,$files->getMimeType());
return $this->response('资源',Code::SUCCESS,$this->responseData($this->path.'/'.$fileName));
}
... ... @@ -287,7 +287,7 @@ class FileController
$fileModel = new File();
$lists = $fileModel->list($this->map,'id',['id','hash','type','path','created_at']);
foreach ($lists as $k => $v){
$v['file_link'] = getFileUrl($v['hash']);
$v['file_link'] = getFileUrl($v['path']);
$lists[$k] = $v;
}
$this->response('success',Code::SUCCESS,$lists);
... ... @@ -303,7 +303,7 @@ class FileController
public function responseData($path){
$data = [
'file'=>$path,
'file_link'=>getFileUrl($path),
'file_link'=>getFileUrl($path,$this->upload_location),
];
return $data;
}
... ...
... ... @@ -354,7 +354,7 @@ class ImageController extends Controller
$lists = $imageModel->lists($this->map,$this->page,$this->row);
if(!empty($lists) && !empty($lists['list'])){
foreach ($lists['list'] as $k => $v){
$v['image_link'] = getImageUrl($v['hash']);
$v['image_link'] = getImageUrl($v['path']);
$lists['list'][$k] = $v;
}
}
... ...
... ... @@ -39,6 +39,15 @@ class ServerConfigLogic extends BaseLogic
*/
public function serviceConfigList($map,$page,$row,$order = 'id',$filed = ['*']){
$lists = $this->model->lists($map,$page,$row,$order,$filed);
if(!empty($lists) && !empty($lists)){
$projectModel = new Project();
foreach ($lists['list'] as $k => $v){
if($v['type'] == $this->model::TYPE_SERVER){
$v['count'] = $projectModel->where(['serve_id'=>$v['id']])->count();
}
$lists['list'][$k] = $v;
}
}
return $this->success($lists);
}
... ...
... ... @@ -11,6 +11,7 @@ use App\Models\Manage\JobLevel;
use App\Models\Manage\Manage;
use App\Models\Manage\ManageHr;
use App\Models\Manage\Menu;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
/**
... ... @@ -41,14 +42,77 @@ class HrLogic extends BaseLogic
$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']]);
$this->editHrManager();
}else{
//添加管理员账号
$this->param['manage_id'] = $this->addManager($this->param['mobile'],$this->param['name']);
$rs = $this->model->add($this->param);
$this->addHrManager();
}
if($rs === false){
$this->fail('系统错误');
return $this->success();
}
/**
* @remark :添加人事信息时 同步添加管理员账号
* @name :addManager
* @author :lyh
* @method :post
* @time :2023/9/6 10:18
*/
public function addHrManager(){
$managerModel = new Manage();
$info = $managerModel->read(['mobile'=>$this->param['mobile']]);
if($info !== false){
$this->fail('当前号码已存在');
}
$data = [
'name'=>$this->param['name'],
'mobile'=>$this->param['mobile'],
'password'=>Hash::make('globalsov6'),
'gid'=>4,
];
DB::beginTransaction();
try {
$managerModel = new Manage();
$this->param['manage_id'] = $managerModel->addReturnId($data);
$this->model->add($this->param);
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('系统错误请联系管理员');
}
return $this->success();
}
/**
* @remark :编辑人事信息
* @name :editHrManager
* @author :lyh
* @method :post
* @time :2023/9/20 15:06
*/
public function editHrManager(){
$hrInfo = $this->model->read(['id'=>$this->param['id']],['id','mobile','manage_id']);
if($hrInfo === false){
$this->fail('当前数据不存在或已被删除');
}
$managerModel = new Manage();
if($hrInfo['mobile'] != $this->param['mobile']){
$mobileInfo = $this->model->read(['mobile'=>$this->param['mobile']],['id']);
if($mobileInfo !== false){
$this->fail('当前人事信息中手机号已存在');
}
$managerMobileInfo = $managerModel->read(['mobile'=>$this->param['mobile']],['id']);
if($managerMobileInfo !== false){
$this->fail('当前管理员信息中手机号已存在');
}
}
DB::beginTransaction();
try {
//同步更新管理员手机号码
$managerModel->edit(['mobile'=>$this->param['mobile']],['id'=>$hrInfo['manage_id']]);
$this->model->edit($this->param,['id'=>$this->param['id']]);
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('系统错误,请联系管理员');
}
return $this->success();
}
... ... @@ -60,22 +124,29 @@ class HrLogic extends BaseLogic
* @method :post
* @time :2023/7/25 9:27
*/
public function getHrInfo($id){
public function getHrInfo(){
//查看当前用户是否有人事权限
if($this->manager['gid'] != ManageHr::GID_ZERO){
if(($this->manager['gid'] != ManageHr::GID_ZERO) && isset($this->param['id'])){
$groupModel = new Group();
$groupInfo = $groupModel->read(['id'=>$this->manager['gid']]);
if (!in_array(20,$groupInfo['rights']) && ($id != $this->manager['id'])) {
if (!in_array(20,$groupInfo['rights']) && ($this->param['id'] != $this->manager['id'])) {
$this->fail('无权限查看其他用户信息');
}
}
$data = $this->model->read(['id'=>$id]);
$data = $this->model->read($this->param);
foreach ($this->model::specieField() as $v){
$data[$v] = json_decode($data[$v],true);
}
return $this->success($data);
}
/**
* @remark :转换
* @name :setJson
* @author :lyh
* @method :post
* @time :2023/9/20 15:23
*/
//数组转json存储
public function setJson($str,$param){
if(isset($param[$str]) && is_array($param[$str])){
... ... @@ -189,27 +260,6 @@ 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);
}
/**
* @param $page_size
... ...
... ... @@ -3,9 +3,12 @@
namespace App\Http\Logic\Aside\Manage;
use App\Helper\Common;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Manage\Manage;
use App\Models\Manage\ManageHr;
use App\Models\Manage\Menu;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Hash;
/**
... ... @@ -31,21 +34,67 @@ class ManageLogic extends BaseLogic
* @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'])){
$this->param['password'] = Hash::make($this->param['password']);
try {
if(isset($this->param['id']) && !empty($this->param['id'])){
$this->editManager();
Common::del_user_cache('manager',$this->param['id'],'A');
}else{
$this->addManager();
}
$rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
}else{
$this->param['password'] = Hash::make($this->param['password']);
$rs = $this->model->add($this->param);
}
if($rs === false){
$this->fail('error');
}catch (\Exception $e){
$this->fail('系统错误,请联系管理员');
}
return $this->success();
}
/**
* @remark :添加管理员
* @name :addManager
* @author :lyh
* @method :post
* @time :2023/9/20 15:49
*/
public function addManager(){
$managerInfo = $this->model->read(['mobile'=>$this->param['mobile']]);
if($managerInfo !== false){
$this->fail('当前手机号码已存在');
}
$this->param['password'] = Hash::make(isset($this->param['password']) ?? 'globalsov6');
$this->model->add($this->param);
$this->success();
}
/**
* @remark :编辑管理员
* @name :editManager
* @author :lyh
* @method :post
* @time :2023/9/20 15:51
*/
public function editManager(){
$info = $this->model->read(['id'=>$this->param['id']]);
if($info['mobile'] != $this->param['mobile']){
$mobileInfo = $this->model->read(['mobile'=>$this->param['mobile']]);
if($mobileInfo !== false){
$this->fail('当前手机号码在管理员信息中已存在');
}
//查看人事信息中是否关联当前管理员账号
$hrManagerModel = new ManageHr();
$hrInfo = $hrManagerModel->read(['manage_id'=>$this->param['id']]);
if($hrInfo !== false){
//查看是否号码在存在人事表中
$hrMobileInfo = $hrManagerModel->read(['mobile'=>$this->param['mobile']]);
if($hrMobileInfo !== false){
$this->fail('当前号码已存在人事信息中');
}
$hrManagerModel->edit(['mobile'=>$this->param['mobile']],['manage_id'=>$this->param['id']]);
}
}
if(isset($this->param['password']) && !empty($this->param['password'])){
$this->param['password'] = Hash::make($this->param['password']);
}
$this->model->edit($this->param,['id'=>$this->param['id']]);
}
/**
* @remark :设置排序
... ... @@ -78,5 +127,19 @@ class ManageLogic extends BaseLogic
return $this->success($info);
}
/**
* @remark :删除
* @name :managerDelete
* @author :lyh
* @method :post
* @time :2023/9/15 10:45
*/
public function managerDelete(){
$rs = $this->model->del(['id'=>['in',$this->param['ids']]]);
if($rs === false){
$this->fail('系统错误,请联系管理员');
}
Common::del_user_cache('manager',$this->param['ids'],'A');
return $this->success();
}
}
... ...
... ... @@ -2,6 +2,7 @@
namespace App\Http\Logic\Aside\Project;
use App\Models\Com\NoticeLog;
use App\Models\Devops\ServerConfig;
use App\Models\Project\ProjectRenew;
use App\Models\User\ProjectMenu;
... ... @@ -54,14 +55,9 @@ class ProjectLogic extends BaseLogic
public function getProjectInfo($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'] = [];
}
$info['online_check']['name'] = (new Manage())->getName(!empty($info['online_check']['created_manage_id']) ?? '');
$info['deploy_optimize']['minor_keywords'] = json_decode(!empty($info['deploy_optimize']['minor_keywords']) ?? []);
$info['init_domain'] = $this->getInitDomain($info['serve_id'])['domain'];
if($info['extend_type'] != 0){
$info['type'] = $info['extend_type'];
}
... ... @@ -69,6 +65,25 @@ class ProjectLogic extends BaseLogic
}
/**
* @remark :获取初始域名
* @name :getInitDomain
* @author :lyh
* @method :post
* @time :2023/9/16 9:40
*/
public function getInitDomain($serve_id = ''){
$domain = '';
if(!empty($serve_id)){
$serveModel = new ServerConfig();
$info = $serveModel->read(['id'=>$serve_id]);
if($info !== false){
$domain = $info['init_domain'];
}
}
return $this->success(['domain'=>$domain]);
}
/**
* @remark :保存项目数据
* @name :projectSave
* @author :lyh
... ... @@ -76,7 +91,6 @@ class ProjectLogic extends BaseLogic
* @time :2023/8/30 11:57
*/
public function projectSave(){
DB::beginTransaction();
try {
if($this->param['type'] == Project::TYPE_SEVEN){
... ... @@ -199,6 +213,13 @@ class ProjectLogic extends BaseLogic
if(isset($deploy_optimize['minor_keywords']) && !empty($deploy_optimize['minor_keywords'])){
$deploy_optimize['minor_keywords'] = Arr::a2s($deploy_optimize['minor_keywords']);
}
//是否更新了api_no
$api_no = DeployOptimize::where('id', $deploy_optimize['id'])->value('api_no');
if($api_no != $deploy_optimize['api_no']){
NoticeLog::createLog(NoticeLog::TYPE_RANK_DATA, ['api_no' => $deploy_optimize['api_no']]);
}
$deployOptimizeModel->edit($deploy_optimize,['id'=>$deploy_optimize['id']]);
return $this->success();
}
... ... @@ -228,7 +249,7 @@ class ProjectLogic extends BaseLogic
//查看当前项目状态是否为初始项目
$info = $this->model->read(['id'=>$param['id']]);
//项目为初始项目时,只能选择建站中
if($info['type'] == Project::TYPE_ZERO){
if(($info['type'] == Project::TYPE_ZERO) && ($info['type'] != Project::TYPE_FIVE)){
$param['type'] = Project::TYPE_ONE;
}
//创建默认数据库
... ... @@ -237,8 +258,6 @@ class ProjectLogic extends BaseLogic
if(isset($param['mysql_id']) && !empty($param['mysql_id'])){
$this->initializationMysql($param['id']);
}
//创建初始角色
// $this->createdRole($param['id']);
//初始账号
if(isset($param['mobile']) && !empty($param['mobile'])){
$this->createUser($param['mobile'],$param['id'],$param['lead_name']);
... ... @@ -299,9 +318,12 @@ class ProjectLogic extends BaseLogic
ProjectServer::createDatabase($project);
//创建表
ProjectServer::initTable();
//初始数据
ProjectServer::saveInitParam($project_id);
return $this->success();
}
/**
* @remark :更新服务器为已使用
* @name :updateServe
... ...
... ... @@ -10,8 +10,10 @@
namespace App\Http\Logic\Aside\Project;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Project\DeployBuild;
use App\Models\Project\Project;
use App\Models\Project\ProjectRenew;
use Illuminate\Support\Facades\DB;
class RenewLogic extends BaseLogic
{
... ... @@ -32,8 +34,10 @@ class RenewLogic extends BaseLogic
public function renewListsLog($map,$page,$row,$order,$field = ['*']){
$lists = $this->model->lists($map,$page,$row,$order,$field);
if(!empty($lists['list'])){
$projectModel = new Project();
foreach ($lists['list'] as $k => $v){
$v['plan'] = Project::planMap()[$v['plan']];
$v['project_name'] = $projectModel->getProjectName($v['project_id']);
$lists['list'][$k] = $v;
}
}
... ... @@ -54,4 +58,52 @@ class RenewLogic extends BaseLogic
}
return $this->success($info);
}
/**
* @remark :关联续费单
* @name :editProjectRenew
* @author :lyh
* @method :post
* @time :2023/9/19 10:21
*/
public function editProjectRenew(){
//获取续费单详情
$info = $this->model->read(['id'=>$this->param['renew_id']]);
if($info === false){
$this->fail('当前续费单不存在');
}
if($info['project_id'] != 0){
$this->fail('当前续费单已关联项目,请重新选择');
}
DB::beginTransaction();
try {
$this->model->edit(['project_id'=>$this->param['id'],'operator_id'=>$this->manager['id']],['id'=>$this->param['renew_id']]);
$project = new Project();
$project->edit(['extend_type'=>0],['id'=>$this->param['id']]);
$deployBuild = new DeployBuild();
$deployBuild->edit(
['service_duration'=>DB::raw('service_duration + ' . $info['service_duration']),
'plan'=>$info['plan']], ['project_id'=>$this->param['id']]);
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('系统错误,请联系管理员');
}
return $this->success();
}
/**
* @remark :编辑续费单状态
* @name :editStatus
* @author :lyh
* @method :post
* @time :2023/9/19 15:50
*/
public function editStatus(){
$rs = $this->model->edit(['status'=>$this->param['status']],['id'=>$this->param['id']]);
if($rs === false){
$this->fail('系统错误,请联系管理员');
}
return $this->success();
}
}
... ...
... ... @@ -145,6 +145,7 @@ class ATemplateLogic extends BaseLogic
DB::rollBack();
$this->fail('error');
}
return $this->success();
}
/**
... ...
... ... @@ -10,6 +10,7 @@
namespace App\Http\Logic\Bside\BTemplate;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Service\Service as ServiceSettingModel;
use App\Models\Template\BTemplate;
use App\Models\Template\BTemplateLog;
... ... @@ -35,6 +36,11 @@ class BTemplateLogLogic extends BaseLogic
if($info === false){
$this->fail('error');
}
$bTemplateModel = new BTemplate();
//演示项目,不允许其他号码编辑
if(($this->user['project_id'] == 1) && (!in_array($this->user['mobile'],$bTemplateModel->mobile)) && ($info['source'] == 1)){
$this->fail('演示项目仅支持演示功能,无法更改首页');
}
$data = $this->setParam($info);
$BTemplateModel = new BTemplate();
$rs = $BTemplateModel->edit($data,['template_id'=>$info['template_id'],'source'=>$info['source'],'source_id'=>$info['source_id']]);
... ... @@ -63,4 +69,25 @@ class BTemplateLogLogic extends BaseLogic
];
return $this->success($data);
}
/**
* @remark :获取数据详情
* @name :templateLogInfo
* @author :lyh
* @method :post
* @time :2023/9/19 14:42
*/
public function templateLogInfo(){
$info = $this->model->read($this->param);
if($info === false){
$this->fail('当前数据不存在,或已被删除');
}
$serviceSettingModel = new ServiceSettingModel();
$list = $serviceSettingModel->list(['type'=>2],'created_at');
$data = [
'info' => $info,
'header_footer'=>$list,
];
return $this->success($data);
}
}
... ...
... ... @@ -174,6 +174,10 @@ class BTemplateLogic extends BaseLogic
* @time :2023/6/29 11:05
*/
public function templateSave(){
//演示项目,不允许其他号码编辑
if(($this->user['project_id'] == 1) && (!in_array($this->user['mobile'],$this->model->mobile)) && ($this->param['source'] == 1)){
$this->fail('演示项目仅支持演示功能,无法更改首页');
}
//查询当前模版是否已保存
DB::beginTransaction();
try {
... ... @@ -187,8 +191,6 @@ class BTemplateLogic extends BaseLogic
$this->model->edit($this->param,['id'=>$info['id']]);
}
$this->setTemplateLog($this->param);
//路由映射
RouteMap::setRoute('index', RouteMap::SOURCE_PAGE, 0, $this->user['project_id']);
DB::commit();
}catch (\Exception $e){
DB::rollBack();
... ... @@ -236,6 +238,8 @@ class BTemplateLogic extends BaseLogic
if($source == BTemplate::SOURCE_HOME){
$type = 'index';
$route = '';
//路由映射
RouteMap::setRoute('index', RouteMap::SOURCE_PAGE, 0, $this->user['project_id']);
}elseif($source == BTemplate::SOURCE_PRODUCT){
$type = RouteMap::SOURCE_PRODUCT;
$productModel = new Product();
... ... @@ -364,67 +368,10 @@ class BTemplateLogic extends BaseLogic
*/
public function getModuleType(): array
{
//前端会回传:products:1,news:2,blogs:3,productCategory:4
//定义数据结构
$data = [
"products"=>[
"category"=>[
[
"id"=>"all",
"title"=>"全部",
],
[
"id"=>"hot",
"title"=>"热销产品",
],
[
"id"=>"recommend",
"title"=>"推荐产品",
],
],
"imageType"=>[
[
"id"=>1,
"title"=>"产品图片",
],[
"id"=>2,
"title"=>"产品分类图片",
],[
"id"=>3,
"title"=>"产品图标",
]
],
],
"news"=>[
"category"=>[
[
"id"=>"all",
"name"=>"全部",
],
[
"id"=>"new",
"name"=>"最新",
],
],
],
"blogs"=>[
"category"=>[
[
"id"=>"all",
"name"=>"全部",
],
[
"id"=>"new",
"name"=>"最新",
],
],
]
];
$data = $this->model->product_type;
//产品,新闻,博客,一级分类数据
$map = [
'pid'=>0,
'project_id'=>$this->user['project_id']
];
$map = ['pid'=>0, 'project_id'=>$this->user['project_id']];
$productCategory = Category::where($map)->get();
$newCategory = NewsCategory::where($map)->get();
$blogCategory = BlogCategory::where($map)->get();
... ... @@ -447,4 +394,22 @@ class BTemplateLogic extends BaseLogic
return $this->success($data);
}
/**
* @remark :保存html
* @name :savePublicTemplateHtml
* @author :lyh
* @method :post
* @time :2023/9/18 11:19
*/
public function savePublicTemplateHtml(){
$this->param['project_id'] = $this->user['project_id'];
$this->param['operator_id'] = $this->user['manager_id'] ?? 0;
$this->param = $this->stringProcessing($this->param);
$publicTemplateModel = new Template();
$rs = $publicTemplateModel->add($this->param);
if($rs === false){
$this->fail('系统错误,请联系管理员');
}
return $this->success();
}
}
... ...
... ... @@ -57,36 +57,63 @@ class CustomTemplateLogic extends BaseLogic
* @time :2023/6/29 16:21
*/
public function customTemplateSave(){
if(isset($this->param['id']) && !empty($this->param['id'])){
if(isset($this->param['html']) && !empty($this->param['html'])){
$html = $this->param['html'];
$this->param['html'] = characterTruncation($html,'/<main>(.*?)<\/main>/s');
$this->param['html_style'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s');
}
$id = $this->param['id'];
$rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
if($rs === false){
$this->fail('error');
}
}else{
$this->param['project_id'] = $this->user['project_id'];
$id = $this->model->addReturnId($this->param);
if($id === false){
$this->fail('error');
try {
$this->param['url'] = str_replace_url($this->param['url']);
if(isset($this->param['id']) && !empty($this->param['id'])){
$id = $this->editCustomRoute($this->param['id'],$this->param['url']);
$this->model->edit($this->param,['id'=>$this->param['id']]);
}else{
$this->param['project_id'] = $this->user['project_id'];
$id = $this->model->addReturnId($this->param);
}
}
//路由映射
if(isset($this->param['url']) && !empty($this->param['url'])){
$route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $id, $this->user['project_id']);
//TODO::通知网站更新
$this->model->edit(['url'=>$route],['id'=>$id]);
}catch (\Exception $e){
$this->fail('error');
}
return $this->success();
}
/**
* @remark :可视化保存html
* @name :saveHtml
* @author :lyh
* @method :post
* @time :2023/9/16 17:13
*/
public function saveHtml(){
$html = $this->param['html'];
$this->param['html'] = characterTruncation($html,'/<main>(.*?)<\/main>/s');
$this->param['html_style'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s');
$rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
if($rs === false){
$this->fail('系统错误,请联系管理');
}
//TODO::通知网站更新
$info = $this->model->read(['id'=>$this->param['id']],['id','url']);
$data = ['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PAGE, 'route'=>$info['url']];
$this->updateNotify($data);
return $this->success();
}
/**
* @remark :查看路由是否更新
* @name :editProduct
* @author :lyh
* @method :post
* @time :2023/9/7 10:02
*/
public function editCustomRoute($id,$route){
$info = $this->model->read(['id'=>$this->param['id']]);
if($info['url'] != $route){
//生成一条删除路由记录
$data = [
'project_id'=>$this->user['project_id'],
'type'=>RouteMap::SOURCE_PAGE,
'source'=>RouteMap::SOURCE_PAGE,
'route'=>$route,
];
$this->updateNotify($data);
$this->setRouteDeleteSave($data);
}
return $this->success();
return $id;
}
/**
... ...
... ... @@ -149,7 +149,7 @@ class BaseLogic extends Logic
function updateNotify($data)
{
$updateNotifyModel = new UpdateNotify();
$info = $updateNotifyModel->read(['project_id'=>$data['project_id'],'route'=>$data['route'],'status'=>0]);
$info = $updateNotifyModel->read(['project_id'=>$data['project_id'],'route'=>$data['route'],'status'=>1]);
if($info === false){
$param = [
'project_id'=>$data['project_id'],
... ... @@ -158,6 +158,9 @@ class BaseLogic extends Logic
];
$updateNotifyModel->add($param);
}
//单页面直接通知更新
$url = $this->user['domain'].'api/delHtml/?project_id='.$this->user['project_id'].'&route='.$data['route'];
curlGet($url);
return $this->success();
}
... ...
<?php
namespace App\Http\Logic\Bside\Import;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Import\ImportTask;
class ImportLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->param = $this->requestAll;
$this->model = new ImportTask();
}
/**
* 新增导入任务
* @return array
* @throws \App\Exceptions\AsideGlobalException
* @throws \App\Exceptions\BsideGlobalException
* @author Akun
* @date 2023/09/20 11:17
*/
public function addImportTask()
{
$this->param['project_id'] = $this->user['project_id'];
$this->param['user_id'] = $this->user['id'];
$rs = $this->model->add($this->param);
if($rs === false){
$this->fail('error');
}
return $this->success();
}
}
... ...
<?php
namespace App\Http\Logic\Bside;
namespace App\Http\Logic\Bside\Inquiry;
use App\Helper\Arr;
use App\Helper\FormGlobalsoApi;
use App\Helper\Translate;
use App\Http\Logic\Aside\Project\ProjectLogic;
use App\Http\Logic\Bside\BaseLogic;
/**
* Class InquiryLogic
... ...
... ... @@ -36,6 +36,9 @@ class NavLogic extends BaseLogic
{
DB::beginTransaction();
try {
if(isset($this->param['image']) && !empty($this->param['image'])){
$this->param['image'] = str_replace_url($this->param['image']);
}
if(isset($this->param['id']) && !empty($this->param['id'])){
$this->handleEditParam();//验证是否可编辑分类
$this->model->edit($this->param,['id'=>$this->param['id']]);
... ...
... ... @@ -60,8 +60,8 @@ class NewsCategoryLogic extends BaseLogic
public function newsCategorySave(){
//验证名称是否存在
$this->verifyParamName($this->param['name']);
// DB::beginTransaction();
// try {
DB::beginTransaction();
try {
if(isset($this->param['id']) && !empty($this->param['id'])){
//验证是否可编辑
$this->verifyEditParam($this->param['id'],$this->param['pid']);
... ... @@ -77,11 +77,11 @@ class NewsCategoryLogic extends BaseLogic
}
$route = RouteMap::setRoute(isset($this->param['alias']) ? $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');
// }
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('error');
}
//更新通知记录表
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NEWS_CATE, 'route'=>$route]);
return $this->success();
... ...
... ... @@ -3,6 +3,7 @@
namespace App\Http\Logic\Bside\Product;
use App\Helper\Arr;
use App\Helper\Common;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Product\Category;
use App\Models\Product\Product;
... ... @@ -77,17 +78,15 @@ 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]);
//清除缓存
Common::del_user_cache('product_category',$this->user['project_id']);
DB::commit();
} catch (\Exception $e){
DB::rollBack();
$this->fail('保存失败');
$this->fail('系统错误,请联系管理员');
}
//通知更新
$notifyData = [
'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();
}
... ... @@ -158,6 +157,8 @@ class CategoryLogic extends BaseLogic
$this->delRoute($id);
$this->model->del(['id'=>$id]);
}
//清除缓存
Common::del_user_cache('product_category',$this->user['project_id']);
DB::commit();
}catch (\Exception $e){
DB::rollBack();
... ...
... ... @@ -4,6 +4,7 @@ namespace App\Http\Logic\Bside\Product;
use App\Exceptions\BsideGlobalException;
use App\Helper\Arr;
use App\Helper\Common;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Product\Keyword;
use App\Models\Product\KeywordRelated;
... ... @@ -51,9 +52,9 @@ class KeywordLogic extends BaseLogic
DB::beginTransaction();
try {
if(isset($this->param['id']) && !empty($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']]);
$info = $this->model->read(['id'=>$this->param['id']],['id','route']);
$route = $info['route'];
$this->model->edit($this->param,['id'=>$info['id']]);
}else{
$this->param['project_id'] = $this->user['project_id'];
$this->param['created_at'] = date('Y-m-d H:i:s');
... ... @@ -61,8 +62,10 @@ class KeywordLogic extends BaseLogic
$id = $this->model->insertGetId($this->param);
//路由映射
$route = RouteMap::setRoute($this->param['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']);
$this->model->edit(['route'=>$route],['id'=>$id]);
}
$this->model->edit(['route'=>$route],['id'=>$id]);
//清除缓存
Common::del_user_cache('product_keyword',$this->user['project_id']);
DB::commit();
}catch (\Exception $e){
DB::rollBack();
... ... @@ -74,26 +77,6 @@ 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
... ... @@ -132,6 +115,8 @@ class KeywordLogic extends BaseLogic
$this->delRoute($id);
$this->model->del(['id'=>$id]);
}
//清除缓存
Common::del_user_cache('product_keyword',$this->user['project_id']);
return $this->success();
}
... ...
... ... @@ -49,7 +49,6 @@ class ProductLogic extends BaseLogic
}
//路由映射
$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){
... ... @@ -287,14 +286,20 @@ class ProductLogic extends BaseLogic
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
];
if(!empty($info['thumb'])){
$param['thumb']= Arr::a2s($info['thumb']);
}
if(!empty($info['gallery'])){
$param['gallery']= Arr::a2s($info['gallery']);
if(isset($info['icon']) && !empty($info['icon'])){
foreach ($info['icon'] as $k1 => $v1){
$info['icon'][$k1] = str_replace_url($v1);
}
$param['icon'] = Arr::a2s($info['icon'] ?? '');
}
if(!empty($info['icon'])){
$param['icon']= Arr::a2s($info['icon']);
//产品图
if(isset($info['gallery']) && !empty($info['gallery'])){
foreach ($info['gallery'] as $k => $v){
$v['url'] = str_replace_url($v['url']);
$info['gallery'][$k] = $v;
}
$param['thumb'] = Arr::a2s($info['gallery'][0] ?? '');
$param['gallery'] = Arr::a2s($info['gallery'] ?? '');
}
return $param;
}
... ...
<?php
namespace App\Http\Logic\Bside;
namespace App\Http\Logic\Bside\RankData;
use App\Helper\Arr;
... ... @@ -8,6 +8,9 @@ use App\Helper\QuanqiusouApi;
use App\Helper\Translate;
use App\Http\Logic\Aside\Project\DomainInfoLogic;
use App\Http\Logic\Aside\Project\ProjectLogic;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Project\DeployBuild;
use App\Models\Project\DeployOptimize;
use App\Models\Project\Project;
use App\Models\RankData\ExternalLinks;
use App\Models\RankData\IndexedPages;
... ... @@ -346,4 +349,137 @@ class RankDataLogic extends BaseLogic
}
return $flg_ai;
}
/**
* 同步排名信息
* @throws \Exception
* @author zbj
* @date 2023/9/20
*/
public function syncRankData($api_no, $site_res){
$project_id = DeployOptimize::where('api_no', $api_no)->value('project_id');
$project = Project::find($project_id);
if(!$project){
throw new \Exception($api_no . '关联的项目不存在');
}
$api = new QuanqiusouApi();
$model = RankData::where('project_id', $project_id)->where('lang', '')->first();
if (!$model || $model->updated_date != date('Y-m-d')) {
$res = $api->getGoogleRank($api_no);
if(!$res){
throw new \Exception('接口数据获取失败');
}
//收录数
$indexed_pages_num = $site_res[$api_no] ?? 0;
$this->save_rank($project_id, $res, $indexed_pages_num);
}
//有小语种的
$lang_list = $api->getLangList();
if(!empty($lang_list[$api_no])){
$model = RankData::where('project_id', $project_id)->where('lang', '<>', '')->first();
if (!$model || $model->updated_date != date('Y-m-d')) {
$res = $api->getGoogleRank($api_no, 1);
if(!$res){
throw new \Exception('接口数据获取失败');
}
$data = [];
//不同的小语种取出来
foreach ($res as $keyword => $v){
$data[Arr::last($v)['lang']][$keyword] = $v;
}
foreach ($data as $lang => $rank){
$this->save_rank($project_id, $rank, 0, $lang);
}
}
}
}
/**
* @param $project_id
* @param int $indexed_pages_num
* @param $data
* @param string $lang
* @author zbj
* @date 2023/5/8
*/
public function save_rank($project_id, $data, int $indexed_pages_num = 0, string $lang = ''){
$without_project_ids = []; //不用处理排名的项目
$first_num = $first_page_num = $first_three_pages_num = $first_five_pages_num = $first_ten_pages_num = 0;
if(!$lang){
foreach ($data as &$ranks){
ksort($ranks);
foreach ($ranks as &$rank){
//处理排名
if(!in_array($project_id, $without_project_ids)){
if($rank['position'] >= 10){
$rank['position'] -= 5;
}
//todo 需要特殊处理排名的项目
}
}
$last = Arr::last($ranks);
//第一名
if($last['position'] == 1){
$first_num ++;
}
//排名第一页
if($last['position'] > 0 && $last['position'] <= 10){
$first_page_num ++;
}
//排名前三页
if($last['position'] > 0 && $last['position'] <= 30){
$first_three_pages_num ++;
}
//排名前五页
if($last['position'] > 0 && $last['position'] <= 50){
$first_five_pages_num ++;
}
//排名前十页
if($last['position'] > 0 && $last['position'] <= 100){
$first_ten_pages_num ++;
}
}
}
$where = [
'project_id' => $project_id,
'lang' => $lang
];
$model = RankData::where($where)->first();
if(!$model){
$model = new RankData();
}
//关键词达标天数
$model->is_compliance = 0;
if($model->updated_date != date('Y-m-d')){
//保证关键词数
$keyword_num = DeployBuild::where('project_id', $project_id)->value('keyword_num');
$type = Project::where('id', $project_id)->value('type');
if($keyword_num && $type == 2 && $first_page_num >= $keyword_num){
$model->compliance_day = $model->compliance_day + 1;
$model->is_compliance = 1;
//项目表更新
Project::where('id', $project_id)->update(['is_remain_today' => 1, 'finish_remain_day' => $model->compliance_day]);
}
}
$model->project_id = $project_id;
$model->first_num = $first_num;
$model->first_page_num = $first_page_num;
$model->first_three_pages_num = $first_three_pages_num;
$model->first_five_pages_num = $first_five_pages_num;
$model->first_ten_pages_num = $first_ten_pages_num;
$model->indexed_pages_num = $indexed_pages_num;
$model->lang = $lang;
$model->data = $data;
$model->updated_date = date('Y-m-d');
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($model, true) . PHP_EOL, FILE_APPEND);
$model->save();
}
}
... ...
... ... @@ -42,10 +42,6 @@ class UserLoginLogic
if($info === false){
$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']);
... ... @@ -86,7 +82,7 @@ class UserLoginLogic
$token = md5(uniqid().$info['id']);
//存储缓存
$info['token'] = $token;
Cache::add($token,$info,3600);
Cache::add($token,$info,3600 * 6);
//更新用户信息
$rs = $this->model->edit(['token'=>$token],['id'=>$info['id']]);
if($rs === false){
... ... @@ -99,9 +95,11 @@ class UserLoginLogic
/**
* 自动登录
* @author zbj
* @date 2023/7/25
* @remark :自动登录
* @name :autologin
* @author :lyh
* @method :post
* @time :2023/9/18 11:00
*/
public function autologin($data)
{
... ... @@ -123,7 +121,7 @@ class UserLoginLogic
//存储缓存
$info['token'] = $token;
$info['manager_id'] = $data['manager_id'];//代表自动登录写入日志
Cache::add($token,$info,3600);
Cache::add($token,$info,3600 * 6);
}
Common::set_user_login(['user_id'=>$info['id'],'ip'=>request()->ip(),
'project_id'=>$info['project_id'], 'type'=>1 ,'remark' => '自动登录,操作管理员为:'.$data['manager_id']]);
... ...
<?php
namespace App\Http\Logic\Bside;
namespace App\Http\Logic\Bside\Visit;
use App\Http\Logic\Logic;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Visit\Visit;
use App\Models\Visit\VisitItem;
... ...
... ... @@ -25,18 +25,18 @@ class LoginAuthMiddleware
{
$manage = LoginLogic::manage();
if (!$manage) {
return response(['code'=> Code::USER_LOGIN_ERROE,'msg'=>'当前用户未登录']);
return response(['code'=> Code::USER_LOGIN_ERROE,'message'=>'当前用户未登录']);
}
//权限
if($manage['id'] != Manage::ADMINISTRATOR_ID){ //排除超级管理员
if($manage['status'] != 1){
return response(['code'=> Code::USER_LOGIN_ERROE,'msg'=>'当前用户被禁用']);
return response(['code'=> Code::USER_LOGIN_ERROE,'message'=>'当前用户被禁用']);
}
}
if($manage['gid'] != 0){
$groupInfo = $this->getGroup($manage);
if($groupInfo['status'] != 1){
return response(['code'=> Code::USER_LOGIN_ERROE,'msg'=>'当前用户角色被禁用']);
return response(['code'=> Code::USER_LOGIN_ERROE,'message'=>'当前用户角色被禁用']);
}
//获取当前操作的路由name
$action = Route::currentRouteName();
... ... @@ -45,7 +45,7 @@ class LoginAuthMiddleware
$menu_id = $menuModel->read(['route_name'=>$action],['id']);
if($menu_id !== false){
if(in_array($menu_id['id'],$groupInfo['rights']) === false){
return response(['code'=>Code::USER_PERMISSION_ERROE,'msg'=>'当前用户没有权限']);
return response(['code'=>Code::USER_PERMISSION_ERROE,'message'=>'当前用户没有权限']);
}
}
}
... ...
... ... @@ -25,7 +25,7 @@ class LoginAuthMiddleware
$token = $request->header('token');
$info = Cache::get($token);
if(empty($info) || empty($token)){
return response(['code'=>Code::USER_LOGIN_ERROE,'msg'=>'当前用户未登录']);
return response(['code'=>Code::USER_LOGIN_ERROE,'message'=>'当前用户未登录']);
}
//0代表超级管理员
if($info['role_id'] != 0){
... ... @@ -38,7 +38,7 @@ class LoginAuthMiddleware
// 设置数据库
$project = ProjectServer::useProject($info['project_id']);
if(empty($project)){
return response(['code'=>Code::USER_LOGIN_ERROE,'msg'=>'数据库未配置']);
return response(['code'=>Code::USER_LOGIN_ERROE,'message'=>'数据库未配置']);
}
return $next($request);
}
... ... @@ -56,7 +56,7 @@ class LoginAuthMiddleware
$projectRoleModel = new ProjectRoleModel();
$role_info = $projectRoleModel->read(['id'=>$info['role_id']]);
if($role_info['status'] != 0){
return response(['code'=>Code::USER_LOGIN_ERROE,'当前用户角色被禁用']);
return response(['code'=>Code::USER_LOGIN_ERROE,'message'=>'当前用户角色被禁用']);
}
return $role_info;
}
... ... @@ -73,7 +73,7 @@ class LoginAuthMiddleware
$menu_id = $projectMenuModel->read(['action'=>$action],['id']);
if($menu_id !== false){
if(strpos($role_info['role_menu'], $menu_id['id']) === false){
return response(['code'=>Code::USER_PERMISSION_ERROE,'msg'=>'当前用户没有权限']);
return response(['code'=>Code::USER_PERMISSION_ERROE,'message'=>'当前用户没有权限']);
}
}
}
... ...
... ... @@ -25,6 +25,7 @@ class BlogRequest extends FormRequest
{
return [
'name'=>'required|max:100',
'url'=>'required',
];
}
... ... @@ -32,6 +33,7 @@ class BlogRequest extends FormRequest
{
return [
'name.required'=>'请填写名称',
'url.required'=>'链接不能为空'
];
}
}
... ...
<?php
namespace App\Http\Requests\Bside\Import;
use App\Models\Import\ImportTask;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
/**
* 产品新闻博客导入任务
* @author:akun
* @time 2023/9/20 11:32
* Class NavRequest
* @package App\Http\Requests\Bside\Nav
*/
class ImportTaskRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'type' => ['required', Rule::in([ImportTask::TYPE_PROJECT, ImportTask::TYPE_NEWS, ImportTask::TYPE_BLOG])],
'file_url' => ['required'],
];
}
public function messages()
{
return [
'type.required' => '导入类型必须',
'type.in' => '导入类型错误',
'file_url.required' => '文件地址必须',
];
}
}
... ...
... ... @@ -34,11 +34,6 @@ class NavRequest extends FormRequest
$rule = [
'pid' => ['required','integer'],
'name' => ['required','max:100'],
'location' => ['required','in:header,footer'],
'url' => ['max:200'],
'status' => ['required','in:0,1'],
'target' => ['required','in:0,1'],
'sort' => ['required','integer','gte:0']
];
return $rule;
}
... ... @@ -46,24 +41,11 @@ class NavRequest extends FormRequest
public function messages()
{
return [
'id.required' => '数据不存在',
'id.integer' => '数据不存在',
'pid.required' => '上级选择错误',
'pid.gte' => '上级选择错误',
'pid.integer' => '上级选择错误',
'name.required' => '名称必须',
'name.max' => '名称不能超过100个字符',
'location.required' => '位置选择错误',
'location.in' => '位置选择错误',
'url.required' => '链接必须',
'url.max' => '链接不能超过200个字符',
'status.required' => '状态选择错误',
'status.in' => '状态必须是显示/隐藏',
'target.required' => '打开方式必须',
'target.in' => '打开方式选择错误',
'sort.required' => '排序必须',
'sort.integer' => '排序必须是一个数字',
'sort.gte' => '排序必须大于等于0',
];
}
}
... ...
... ... @@ -25,6 +25,7 @@ class NewsRequest extends FormRequest
{
return [
'name'=>'required|max:100',
'url'=>'required',
];
}
... ... @@ -33,6 +34,7 @@ class NewsRequest extends FormRequest
return [
'name.required'=>'请填写名称',
'name.max'=>'名称最大100字',
'url.required'=>'新闻链接不能为空'
];
}
}
... ...
... ... @@ -31,9 +31,10 @@ class CategoryRequest extends FormRequest
{
return [
'title'=>'required|max:50',
'route'=>'required',
// 'image'=>'required',
'keywords'=>'max:50',
'describe'=>'max:200',
// 'keywords'=>'max:50',
// 'describe'=>'max:200',
];
}
... ... @@ -42,9 +43,10 @@ class CategoryRequest extends FormRequest
return [
'title.required' => '请输入分类名称',
'title.max' => '分类名称不能超过50个字符',
'route.required' => '路由不能为空',
// 'image.required' => '请上传分类图片',
'keywords.max' => '分类关键词不能超过50个字符',
'describe.max' => '分类描述不能超过200个字符',
// 'keywords.max' => '分类关键词不能超过50个字符',
// 'describe.max' => '分类描述不能超过200个字符',
];
}
... ...
... ... @@ -36,7 +36,7 @@ class CustomTemplateRequest extends FormRequest
{
return [
'name.required'=>'模版名称不能为空',
'url.required'=>'自定义访问地址',
'url.required'=>'自定义访问地址不能为空',
// 'keywords.required'=>'页面关键字不能为空',
// 'description.required'=>'页面描述不能为空',
// 'title.required'=>'标题不能为空',
... ...
... ... @@ -10,6 +10,7 @@ class NoticeLog extends Model
protected $table = 'gl_notice_log';
const TYPE_PROJECT = 'project';
const TYPE_RANK_DATA = 'rank_data';
const STATUS_PENDING = 0;
const STATUS_SUCCESS = 1;
... ...
<?php
namespace App\Models\Com;
use Illuminate\Database\Eloquent\Model;
class UpdateLog extends Model
{
//设置关联表名
protected $table = 'gl_update_log';
const STATUS_PENDING = 0;
const STATUS_SUCCESS = 1;
const STATUS_FAIL = 2;
/**
* 创建更新日志
* @param $type
* @param $project_id
* @param $type
* @param $url
* @return mixed
*/
public static function createLog($project_id, $type, $url)
{
$log = self::where('project_id', $project_id)->where('api_type', $type)->first();
if (!$log) {
$log = new self();
$log->project_id = $project_id;
$log->api_type = $type;
$log->api_url = $url;
return $log->save();
}
return true;
}
}
... ...
<?php
namespace App\Models\Import;
use App\Models\Base;
class ImportTask extends Base
{
protected $table = 'gl_import_task';
const STATUS_UN = 0;//未开始
const STATUS_ING = 1;//导入中
const STATUS_COM = 2;//导入完成
const TYPE_PROJECT = 1;//产品
const TYPE_NEWS = 2;//新闻
const TYPE_BLOG = 3;//博客
}
... ...
... ... @@ -2,7 +2,9 @@
namespace App\Models\Manage;
use App\Helper\Common;
use App\Models\Base;
use Illuminate\Support\Facades\Cache;
class Manage extends Base
{
... ... @@ -36,9 +38,17 @@ class Manage extends Base
*/
public function getName($id){
$name = '';
$info = $this->read(['id'=>$id]);
if($info !== false){
$name = $info['name'];
if(!empty($id)){
$info = Common::get_user_cache('manager',$id,'A');
if(empty($info)){
$info = $this->read(['id'=>$id],['id','name']);
if($info !== false){
$name = $info['name'];
Common::set_user_cache($info,'manager',$id,'A');
}
}else{
$name = $info['name'];
}
}
return $name;
}
... ...
... ... @@ -36,8 +36,6 @@ class BNav extends Base
/**
* 是否有下级
* @param int $id
... ... @@ -50,4 +48,18 @@ class BNav extends Base
{
return static::where(['pid'=>$id,'project_id'=>$project_id])->limit(1)->count();
}
/**
* @remark :获取图片
* @name :getImageAttribute
* @author :lyh
* @method :post
* @time :2023/9/18 16:20
*/
public function getImageAttribute($value)
{
$value = getImageUrl($value);
return $value;
}
}
... ...
... ... @@ -29,7 +29,6 @@ class ProcessRecords extends Base
public function getRecordAttribute($value){
$value = Arr::s2a($value);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($value, true) . PHP_EOL, FILE_APPEND);
foreach ($value as &$v){
if(isset($v['image']) && !empty($v['image'])) {
foreach ($v['image'] as $kImage => $vImage) {
... ...
... ... @@ -38,7 +38,7 @@ class Project extends Base
public static function levelMap()
{
return [
1 => '★★★Ads-Customer',
// 1 => '★★★Ads-Customer',
2 => '暂停优化',
3 => '告知书一',
4 => '告知书二',
... ... @@ -226,10 +226,12 @@ class Project extends Base
public function getNoticeFileAttribute($value)
{
$value = Arr::s2a($value);
if(!empty($value)) {
$value = Arr::s2a($value);
foreach ($value as &$v) {
$v['url'] = getFileUrl($v['url']);
if(!empty($v['url'])){
$v['url'] = getFileUrl($v['url']);
}
}
}
return $value;
... ... @@ -245,10 +247,12 @@ class Project extends Base
public function getConfirmFileAttribute($value)
{
$value = Arr::s2a($value);
if(!empty($value)) {
$value = Arr::s2a($value);
foreach ($value as &$v) {
$v['url'] = getFileUrl($v['url']);
if(!empty($v['url'])){
$v['url'] = getFileUrl($v['url']);
}
}
}
return $value;
... ... @@ -281,4 +285,21 @@ class Project extends Base
return $data;
}
/**
* @remark :获取项目名称
* @name :getProjectName
* @author :lyh
* @method :post
* @time :2023/9/19 10:35
*/
public function getProjectName($id){
$title = '';
if(!empty($id)){
$info = $this->read(['id'=>$id]);
if($info !== false){
$title = $info['title'];
}
}
return $title;
}
}
... ...
... ... @@ -18,5 +18,70 @@ class BTemplate extends Base
protected $table = 'gl_web_template';
//连接数据库
protected $connection = 'custom_mysql';
//网站装修可操作手机号
public $mobile = [
'15928018676',
'15680871314',
'18328465854',
'18008059100',
'18583337995'
];
//类型数据
public $product_type = [
"products"=>[
"category"=>[
[
"id"=>"all",
"title"=>"全部",
],
[
"id"=>"hot",
"title"=>"热销产品",
],
[
"id"=>"recommend",
"title"=>"推荐产品",
],
],
"imageType"=>[
[
"id"=>1,
"title"=>"产品图片",
],[
"id"=>2,
"title"=>"产品分类图片",
],[
"id"=>3,
"title"=>"产品图标",
]
],
],
"news"=>[
"category"=>[
[
"id"=>"all",
"name"=>"全部",
],
[
"id"=>"new",
"name"=>"最新",
],
],
],
"blogs"=>[
"category"=>[
[
"id"=>"all",
"name"=>"全部",
],
[
"id"=>"new",
"name"=>"最新",
],
],
]
];
}
... ...
... ... @@ -9,7 +9,6 @@
namespace App\Services;
use App\Models\Project\Project;
use App\Utils\EncryptUtils;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
... ... @@ -85,4 +84,29 @@ class ProjectServer extends BaseService
}
return true;
}
/**
* @remark :执行初始数据
* @name :saveInitParam
* @author :lyh
* @method :post
* @time :2023/9/19 14:45
*/
public static function saveInitParam($project_id){
$info = DB::connection('custom_mysql')->table('gl_web_nav')->first();
if(empty($info)){
$created_at = date('Y-m-d H:i:s');
$data = [
['project_id'=>$project_id,'name'=>'Home','url'=>'nav-home-'.$project_id,'location'=>'header','created_at'=>$created_at,'updated_at'=>$created_at],
['project_id'=>$project_id,'name'=>'Products','url'=>'nav-product'.$project_id,'location'=>'header','created_at'=>$created_at,'updated_at'=>$created_at],
['project_id'=>$project_id,'name'=>'News','url'=>'nav-news'.$project_id,'location'=>'header','created_at'=>$created_at,'updated_at'=>$created_at],
['project_id'=>$project_id,'name'=>'ABOUT US','url'=>'nav-about-us'.$project_id,'location'=>'footer','created_at'=>$created_at,'updated_at'=>$created_at],
['project_id'=>$project_id,'name'=>'Contact Us','url'=>'nav-contact-us'.$project_id,'location'=>'footer','created_at'=>$created_at,'updated_at'=>$created_at],
['project_id'=>$project_id,'name'=>'FAQ','url'=>'nav-faq'.$project_id,'location'=>'footer','created_at'=>$created_at,'updated_at'=>$created_at],
];
DB::connection('custom_mysql')->table('gl_web_nav')->insert($data);
}
DB::disconnect('custom_mysql');
return true;
}
}
... ...
... ... @@ -11,7 +11,7 @@ return [
'access_secret' => env('ALIYUN_SMS_AS'), // accessSecret
'sign_name' => env('ALIYUN_SMS_SIGN_NAME'), // 签名
// login
'login_sms_temp' => 'SMS_272545773',
'login_sms_temp' => 'SMS_162198406',
// 注册
'register_sms_temp' => 'SMS_272430790',
];
\ No newline at end of file
'register_sms_temp' => 'SMS_162198406',
];
... ...
... ... @@ -181,7 +181,9 @@ Route::middleware(['aloginauth'])->group(function () {
Route::any('/log', [Aside\Project\RenewProjectController::class, 'renewLists'])->name('admin.renew_renewLists');
Route::any('/info', [Aside\Project\RenewProjectController::class, 'info'])->name('admin.renew_info');
Route::any('/notHaveRenewItems', [Aside\Project\RenewProjectController::class, 'notHaveRenewItems'])->name('admin.renew_notHaveRenewItems');
Route::any('/editRenew', [Aside\Project\RenewProjectController::class, 'editRenew'])->name('admin.renew_editRenew');
Route::any('/getRenewList', [Aside\Project\RenewProjectController::class, 'getRenewList'])->name('admin.renew_getRenewList');
Route::any('/editStatusRenew', [Aside\Project\RenewProjectController::class, 'editStatusRenew'])->name('admin.renew_editStatusRenew');
});
//工单管理
Route::prefix('task')->group(function () {
... ... @@ -320,6 +322,7 @@ Route::group([], function () {
Route::any('/download_images', [\App\Http\Controllers\File\ImageController::class, 'downLoad'])->name('admin.images_downLoad');//导出图片
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('/notice/rank_data', [Aside\Notice\NoticeController::class, 'rank_data'])->name('admin.notice.rank_data');
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');//获取渠道商的项目
... ...
... ... @@ -278,6 +278,7 @@ Route::middleware(['bloginauth'])->group(function () {
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::any('/savePublicTemplate', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'savePublicTemplate'])->name('template_savePublicTemplate');
// 模板
Route::prefix('module')->group(function () {
//获取所有左侧模版
... ... @@ -289,6 +290,7 @@ Route::middleware(['bloginauth'])->group(function () {
Route::prefix('log')->group(function () {
//获取所有左侧模版
Route::any('/', [\App\Http\Controllers\Bside\Template\BTemplateLogController::class, 'lists'])->name('template_log_lists');
Route::any('/info', [\App\Http\Controllers\Bside\Template\BTemplateLogController::class, 'info'])->name('template_log_info');
Route::any('/rollbackVersion', [\App\Http\Controllers\Bside\Template\BTemplateLogController::class, 'rollbackVersion'])->name('template_log_rollbackVersion');
});
});
... ... @@ -344,6 +346,11 @@ Route::middleware(['bloginauth'])->group(function () {
Route::prefix('tdk')->group(function () {
Route::any('/', [\App\Http\Controllers\Bside\BCom\UpdateController::class, 'updateSeoTdk'])->name('tdk_updateSeoTdk');
});
//导入任务
Route::prefix('import')->group(function () {
Route::any('/add_task', [\App\Http\Controllers\Bside\Import\ImportController::class, 'save'])->name('import_add_task');
});
});
//无需登录验证的路由组
Route::group([], function () {
... ...
<?php
use Illuminate\Support\Facades\Route;
/**
* @remark :
* @name :wechat.php
... ...