作者 刘锟

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

<?php
/**
* @remark :
* @name :SyncMobile.php
* @author :lyh
* @method :post
* @time :2023/12/25 15:00
*/
namespace App\Console\Commands;
use App\Models\User\User;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
class SyncMobile extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'sync_manager';
/**
* The console command description.
*
* @var string
*/
protected $description = '同步手机号码库';
/**
* @remark :统一更新路由
* @name :handle
* @author :lyh
* @method :post
* @time :2023/11/20 15:13
*/
public function handle(){
$url = 'https://www.quanqiusou.cn/extend_api/saas/get_phone.php';
$data = curlGet($url);//TODO::获取号码库
DB::table('gl_mobile')->delete();
$create_time = date('Y-m-d H:i:s');
foreach ($data as $v){
$param = [
'mobile'=>$v,
'created_at'=>$create_time
];
DB::table('gl_mobile')->insert($param);
}
if(!empty($data)){
$userModel = new User();
try {
$userModel->edit(['status'=>1],['project_id'=>1,'mobile'=>['not in',$data]]);
$userModel->edit(['status'=>0],['project_id'=>1,'mobile'=>['in',$data]]);
}catch (\Exception $e){
echo date('Y-m-d H:i:s') . 'error' . PHP_EOL;
}
}
}
}
... ...
... ... @@ -9,6 +9,7 @@ use App\Models\Channel\Channel;
use App\Models\Com\NoticeLog;
use App\Models\Com\UpdateLog;
use App\Models\Com\UpdateVisit;
use App\Models\Manage\Mobile;
use App\Models\Project\After;
use App\Models\Project\DeployBuild;
use App\Models\Project\DeployOptimize;
... ... @@ -201,7 +202,7 @@ class SyncProject extends Command
'is_upgrade'=>$is_update,
],
'deploy_build' => [
'service_duration' => $param['years'],
'service_duration' => $param['years'] ?? 0,
'plan' => $this->versionData($param['plan_marketing']),
'login_mobile'=>$param['principal_mobile']
],
... ... @@ -456,6 +457,10 @@ class SyncProject extends Command
*/
public function createUser($mobile,$project_id,$lead_name){
$userModel = new UserModel();
//查看当前项目是否存在号码库中
$mobileModel = new Mobile();
$mobileInfo = $mobileModel->read(['mobile'=>$mobile]);
if($mobileInfo === false){
//查看当前用户是否存在
$info = $userModel->read(['mobile'=>$mobile,'project_id'=>$project_id]);
if($info === false){
... ... @@ -469,4 +474,6 @@ class SyncProject extends Command
$userModel->add($data);
}
}
return true;
}
}
... ...
... ... @@ -40,6 +40,7 @@ class Kernel extends ConsoleKernel
$schedule->command('update_seo_tdk_crontab')->dailyAt('00:00')->withoutOverlapping(1); //更新上线项目TDK
$schedule->command('website_data')->dailyAt('01:00')->withoutOverlapping(1); // 向AICC推送数据
$schedule->command('project_file_pdf')->dailyAt('00:00')->withoutOverlapping(1); // 网站项目数据,生成PDF文件
$schedule->command('sync_manager')->dailyAt('01:00')->withoutOverlapping(1); //TODO::手机号码同步 每天执行一次
}
/**
... ...
... ... @@ -8,9 +8,8 @@ use App\Utils\LogUtils;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Support\Carbon;
use App\Models\File\File;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Redis;
use App\Models\User\User;
define('HTTP_OPENAI_URL', 'http://openai.waimaoq.com/');
/**
... ... @@ -24,7 +23,8 @@ define('HTTP_OPENAI_URL', 'http://openai.waimaoq.com/');
if (!function_exists('generateRoute')) {
function generateRoute($string)
{
return trim(strtolower(preg_replace('/[\W]+/', '-', trim($string))), '-');
//TODO::html结尾,htm结尾,只处理.htm前面的内容
return trim(strtolower(preg_replace('/[^\w.]+/', '-', trim($string))), '-');
}
}
... ...
... ... @@ -31,7 +31,7 @@ class CreateKeywordController extends BaseController
* @time :2023/12/19 9:31
*/
public function lists(CreateKeyword $createKeyword){
$list = $createKeyword->list($this->map);
$list = $createKeyword->list($this->map,'id',['*'],'asc');
$this->response('success',Code::SUCCESS,$list);
}
... ...
... ... @@ -37,7 +37,8 @@ class OptimizeController extends BaseController
->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)->orderByRaw('CASE WHEN gl_project_deploy_optimize.start_date IS NULL THEN 0 ELSE 1 END')
$query = $this->searchParam($query)->orderByRaw("FIELD(gl_project.level, '2') DESC")
->orderByRaw('CASE WHEN gl_project_deploy_optimize.start_date IS NULL THEN 0 ELSE 1 END')
->orderBy('gl_project_deploy_optimize.start_date','desc');
$lists = $query->paginate($this->row, $this->selectParam(), 'page', $this->page)->toArray();
if(!empty($lists) && !empty($lists['list'])){
... ... @@ -187,6 +188,7 @@ class OptimizeController extends BaseController
$query = $query->where('gl_project_deploy_build.test_domain','like','%'.$this->map['test_domain'].'%');
}
$query = $query->whereIn('gl_project.type',[2,4]);//TODO::2,4代表优化项目
$query = $query->where('gl_project_online_check.qa_status',1);
return $query;
}
... ...
<?php
/**
* @remark :
* @name :ProjectKeywordController.php
* @author :lyh
* @method :post
* @time :2023/12/26 9:22
*/
namespace App\Http\Controllers\Bside\Keyword;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Models\Project\DeployOptimize;
class ProjectKeywordController extends BaseController
{
/**
* @remark :获取搜索关键词
* @name :searchKeywords
* @author :lyh
* @method :post
* @time :2023/12/26 10:07
*/
public function searchKeywords(DeployOptimize $deployOptimize){
$data = [];
$info = $deployOptimize->read(['project_id'=>$this->user['project_id']]);
if($info === false){
$this->response('success');
}
$data['search_keywords'] = $info['search_keywords'];
$data['main_keywords'] = $info['main_keywords'];
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
... ... @@ -134,6 +134,12 @@ class LoginLogic extends BaseLogic
}
//获取超级管理员登录
if(isset($this->param['project_id']) && !empty($this->param['project_id'])){
//查看当前项目是否有超级管理员
$userModel = new User();
$userinfo = $userModel->read(['project_id'=>$this->param['project_id'],'role_id'=>0]);
if($userinfo === false){
$this->fail('未添加超级管理员账号,请添加后在进入账号.');
}
$data['autologin_code'] = $encrypt->lock_url(json_encode(['project_id'=>$this->param['project_id'],'manager_id'=>$this->manager['id']]),$info['values']);
}
//使用用户登录
... ...
... ... @@ -73,6 +73,7 @@ class ProjectLogic extends BaseLogic
if($info['extend_type'] != 0){
$info['type'] = $info['extend_type'];
}
$info['domain_url'] = (new DomainInfo())->getDomain($info['deploy_optimize']['domain'] ?? 0);
//升级项目初始上传配置
if(empty($info['upload_config'])){
$info['upload_config'] =["upload_max_num"=>100, "allow_file_type"=>"doc,docx,xls,xlsx,pdf,txt,csv,png,jpg,jpeg", "upload_max_size"=>5];
... ... @@ -143,7 +144,7 @@ class ProjectLogic extends BaseLogic
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('请填写完整后再提交');
$this->fail('保存失败,请联系管理员');
}
(new SyncService())->projectAcceptAddress($this->param['id']);
return $this->success();
... ...
... ... @@ -6,6 +6,7 @@ use App\Helper\Common;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Manage\Manage;
use App\Models\Manage\MenuSpecial;
use App\Models\Manage\Mobile;
use App\Models\Project\Project;
use App\Models\User\ProjectRole;
use App\Models\User\User;
... ... @@ -54,6 +55,9 @@ class UserLogic extends BaseLogic
$this->param = $this->editPassword($this->param);
$rs = $this->model->edit($this->param, ['id' => $this->param['id']]);
} else {
$mobileModel = new Mobile();
//查看当前手机号码是否存在于手机号码库
$mobileInfo = $mobileModel->read(['mobile'=>$this->param['mobile']]);
$this->param['password'] = base64_encode(md5($this->param['password']));
$rs = $this->model->add($this->param);
}
... ... @@ -148,20 +152,19 @@ class UserLogic extends BaseLogic
public function user_del()
{
foreach ($this->param['id'] as $id){
$info = $this->model->read(['id'=>$id],['id','role_id']);
if($info['role_id'] != 0){
$rs = $this->model->del(['id'=>$id]);
if($rs === false){
$this->fail('系统错误,请联系管理员');
}
Common::del_user_cache($this->model, $id, 'A');
}else{
$info = $this->model->read(['id'=>$id],['id','role_id','project_id']);
if($info['role_id'] == 0) {
//查看当前项目是否有其他的超级管理员
$roleInfo = $this->model->read(['id'=>['!=',$info['id']],'role_id'=>0]);
if($roleInfo === false){
$this->fail('超级管理员不允许删除');
$roleInfo = $this->model->read(['id' => ['!=', $id], 'role_id' => 0,'project_id'=>$info['project_id']]);
if ($roleInfo === false) {
$this->fail('唯一超级管理员,禁止删除');
}
}
$rs = $this->model->del(['id' => $id]);
if ($rs === false) {
$this->fail('系统错误,请联系管理员');
}
Common::del_user_cache($this->model, $id, 'A');
}
return $this->success();
}
... ... @@ -195,7 +198,7 @@ class UserLogic extends BaseLogic
$roleInfo = $roleModel->where('project_id',$this->param['project_id'])->orderBy('id','asc')->first();
$info = $this->model->read(['role_id'=>0]);
if(empty($info) || empty($roleInfo)){
$this->fail('系统错误,请联系管理员');
$this->fail('请先添加角色');
}
try {
$this->model->edit(['role_id'=>$roleInfo['id']],['id'=>$info['id']]);
... ...
... ... @@ -89,7 +89,7 @@ class BTemplateLogic extends BaseLogic
$type = $this->getCustomizedType($source, $source_id);//定制获取头部底部类型
$commonInfo = $this->getCommonPage($type,$this->user['project_id'],0);//获取定制头部
$html = $this->handleAllHtml($commonInfo,$templateInfo['html']);
return $this->success(['html'=>$html,'template_id'=>$template_id,'id'=>$templateInfo['id']]);
return $this->success(['html'=>$html,'template_id'=>$template_id,'id'=>$templateInfo['id'],'updated_at'=>$templateInfo['updated_at']]);
}
$mainInfo = ['main_html'=>$templateInfo['main_html'], 'main_css'=>$templateInfo['main_css']];
}
... ... @@ -98,7 +98,10 @@ class BTemplateLogic extends BaseLogic
$commonInfo['head_html'].$mainInfo['main_html'].$commonInfo['footer_html'];
$html = $this->getHeadFooter($html);
$result = ['html'=>$html,'template_id'=>$template_id];
if($templateInfo !== false){$result['id'] = $templateInfo['id'];}
if($templateInfo !== false){
$result['id'] = $templateInfo['id'];
$result['updated_at'] = $templateInfo['updated_at'];
}
return $this->success($result);
}
... ... @@ -618,7 +621,10 @@ class BTemplateLogic extends BaseLogic
* @method :post
* @time :2023/7/27 15:08
*/
public function getModule($type){
public function getModule($type,$is_custom){
if($is_custom == BTemplate::SOURCE_CUSTOM){
$type == BTemplate::TYPE_CUSTOM_DETAIL;
}
$mainModel = new TemplateTypeMain();
$info = $mainModel->read(['type'=>$type]);
return $info['main_html'];
... ... @@ -709,7 +715,7 @@ class BTemplateLogic extends BaseLogic
$moduleModel = new CustomModule();
$moduleList = $moduleModel->list(['status'=>0]);
foreach ($moduleList as $v){
$moduleCategory = $this->getCategoryList((new CustomModuleCategory()),0,['id','name','pid']);
$moduleCategory = $this->getCategoryModuleList((new CustomModuleCategory()),$v['id'],0,['id','name','pid']);
$categoryList = [["id"=>"all", "name"=>"全部"], ["id"=>"new", "name"=>"最新"]];
foreach ($moduleCategory as $values){
$categoryList[] = $values;
... ... @@ -782,6 +788,26 @@ class BTemplateLogic extends BaseLogic
}
/**
* @remark :获取1级+2级
* @name :getCategoryList
* @author :lyh
* @method :post
* @time :2023/12/20 10:26
*/
public function getCategoryModuleList($categoryModel,$module_id,$status = 0,$filed = ['*']){
$data = array();
$list = $categoryModel->list(['pid'=>0, 'module_id'=>$module_id , 'status'=>$status],['sort','id'],$filed);
foreach ($list as $v){
$data[] = $v;
$son_list = $categoryModel->list(['pid'=>$v['id'],'module_id'=>$module_id,'status'=>$status],['sort','id'],$filed);
foreach ($son_list as $v1){
$data[] = $v1;
}
}
return $this->success($data);
}
/**
* @remark :保存html
* @name :savePublicTemplateHtml
* @author :lyh
... ... @@ -819,9 +845,9 @@ class BTemplateLogic extends BaseLogic
$commonInfo = $this->getTypeCommonHtml($bSettingInfo['template_id'],$this->param['type'],$is_custom);
//获取设置的默认中间部分
$bTemplateMainModel = new BTemplateMain();
$mainInfo = $bTemplateMainModel->read(['project_id'=>$this->user['project_id'],'type'=>$this->param['type']]);
$mainInfo = $bTemplateMainModel->read(['project_id'=>$this->user['project_id'],'type'=>$this->param['type'],'is_custom'=>$is_custom]);
if($mainInfo === false){
$main_html = $this->getModule($this->param['type']);
$main_html = $this->getModule($this->param['type'],$is_custom);
$main_style = "<style id='globalsojs-styles'></style>";
}else{
$main_html = $mainInfo['main_html'];
... ...
... ... @@ -38,6 +38,7 @@ class BlogLogic extends BaseLogic
$route = $this->param['url'];
$this->edit($this->param,['id'=>$this->param['id']]);
}else{
$this->param['sort'] = $this->setNewsSort();
$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]);
... ... @@ -53,6 +54,22 @@ class BlogLogic extends BaseLogic
}
/**
* @remark :设置最新产品的sort排序
* @name :setNewsSort
* @author :lyh
* @method :post
* @time :2023/12/25 9:27
*/
public function setNewsSort(){
$info = $this->model->orderBy('sort','desc')->first();
if(empty($info)){
return 1;
}
$sort = $info['sort']+1;
return $sort;
}
/**
* @name :编辑seo
* @return void
* @author :liyuhang
... ...
... ... @@ -149,6 +149,7 @@ class CustomModuleContentLogic extends BaseLogic
*/
public function contentAdd(){
try {
$this->param['sort'] = $this->setNewsSort();
$id = $this->model->addReturnId($this->param);
$route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE,
$id, $this->user['project_id']);
... ... @@ -162,6 +163,22 @@ class CustomModuleContentLogic extends BaseLogic
}
/**
* @remark :设置最新产品的sort排序
* @name :setNewsSort
* @author :lyh
* @method :post
* @time :2023/12/25 9:27
*/
public function setNewsSort(){
$info = $this->model->orderBy('sort','desc')->first();
if(empty($info)){
return 1;
}
$sort = $info['sort']+1;
return $sort;
}
/**
* @remark :编辑数据
* @name :contentEdit
* @author :lyh
... ...
... ... @@ -122,6 +122,7 @@ class NavLogic extends BaseLogic
'target'=>$param['target'] ?? 1,
'remark'=>$param['remark'] ?? '',
'group_id'=>$param['group_id'],
'show'=>$param['show'],
];
return $this->success($data);
}
... ...
... ... @@ -68,6 +68,7 @@ class NewsLogic extends BaseLogic
$route = $this->param['url'];
$this->edit($this->param, ['id' => $this->param['id']]);
} else {
$this->param['sort'] = $this->setNewsSort();
$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]);
... ... @@ -84,6 +85,22 @@ class NewsLogic extends BaseLogic
}
/**
* @remark :设置最新产品的sort排序
* @name :setNewsSort
* @author :lyh
* @method :post
* @time :2023/12/25 9:27
*/
public function setNewsSort(){
$info = $this->model->orderBy('sort','desc')->first();
if(empty($info)){
return 1;
}
$sort = $info['sort']+1;
return $sort;
}
/**
* @name :编辑seo
* @return void
* @author :liyuhang
... ...
... ... @@ -41,7 +41,6 @@ class KeywordLogic extends BaseLogic
$info = $this->model->read($this->param);
$info['url'] = $this->user['domain'] . $info['route'];
$info['related_news_info'] = News::whereIn('id', $info['related_news_ids'])->select(['id', 'name'])->get();
return $this->success($info);
}
... ... @@ -53,27 +52,27 @@ class KeywordLogic extends BaseLogic
* @time :2023/8/23 16:50
*/
public function keywordSave(){
DB::beginTransaction();
try {
$this->param = $this->handleSaveParam($this->param);
if(isset($this->param['id']) && !empty($this->param['id'])){
$info = $this->model->read(['title'=>$this->param['title'],'id'=>['!=',$this->param['id']]]);
if($info !== false){
$this->fail('当前title已存在');
}
//TODO::不能修改路由
$this->model->edit($this->param,['id'=>$this->param['id']]);
$route = RouteMap::getRoute(RouteMap::SOURCE_PRODUCT_KEYWORD,$this->param['id'], $this->user['project_id']);
}else{
$info = $this->model->read(['title'=>$this->param['title']]);
if($info !== false){
$this->fail('当前title已存在');
}
$this->param = $this->addHandleParam($this->param);
$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]);
}
// //清除缓存
Common::del_user_cache('product_keyword',$this->user['project_id']);
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('保存失败');
}
$this->addUpdateNotify(RouteMap::SOURCE_PRODUCT_KEYWORD,$route);
$this->curlDelRoute(['new_route'=>$route]);
return $this->success();
... ...
... ... @@ -52,6 +52,7 @@ class ProductLogic extends BaseLogic
$id = $this->param['id'];
}else{
$this->param = $this->addHandleParam($this->param);
$this->param['sort'] = $this->setNewsSort();
$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]);
... ... @@ -77,10 +78,11 @@ class ProductLogic extends BaseLogic
*/
public function setNewsSort(){
$info = $this->model->orderBy('sort','desc')->first();
if($info === false){
if(empty($info)){
return 1;
}
return $info['sort']++;
$sort = $info['sort']+1;
return $sort;
}
/**
... ...
... ... @@ -171,6 +171,7 @@ class UserLoginLogic
$info['image_max'] = $project['image_max'];
$info['is_update_language'] = $project['is_update_language'];
$info['configuration'] = $project['deploy_build']['configuration'];
$info['project_type'] = $project['type'];
if($info['is_customized'] == 1){
$info['is_visualization'] = json_decode($project['is_visualization']);
}
... ... @@ -207,7 +208,7 @@ class UserLoginLogic
$info['image_max'] = $project['image_max'];
$info['is_update_language'] = $project['is_update_language'];
$info['configuration'] = $project['deploy_build']['configuration'];
$info['type'] = $project['type'];
$info['project_type'] = $project['type'];
if($info['is_customized'] == 1){
$info['is_visualization'] = json_decode($project['is_visualization']);
}
... ...
... ... @@ -25,7 +25,7 @@ class BlogRequest extends FormRequest
{
return [
'name'=>'required|max:100',
'remark'=>'max:255',
// 'remark'=>'max:500',
'url'=>'required',
];
}
... ... @@ -34,9 +34,9 @@ class BlogRequest extends FormRequest
{
return [
'name.required'=>'请填写名称',
'name.max'=>'名称超过最长长度',
'name.max'=>'名称超过最长长度100',
'url.required'=>'链接不能为空',
'remark.max'=>'描述超过最长长度'
// 'remark.max'=>'描述超过最长长度500'
];
}
}
... ...
... ... @@ -25,7 +25,7 @@ class NewsRequest extends FormRequest
{
return [
'name'=>'required|max:100',
'remark'=>'max:255',
// 'remark'=>'max:500',
'url'=>'required',
];
}
... ... @@ -34,9 +34,9 @@ class NewsRequest extends FormRequest
{
return [
'name.required'=>'请填写名称',
'name.max'=>'名称超过最长长度',
'name.max'=>'名称超过最长长度100',
'url.required'=>'链接不能为空',
'remark.max'=>'描述超过最长长度'
// 'remark.max'=>'描述超过最长长度500'
];
}
}
... ...
<?php
/**
* @remark :
* @name :Mobile.php
* @author :lyh
* @method :post
* @time :2023/12/25 15:41
*/
namespace App\Models\Manage;
use App\Models\Base;
class Mobile extends Base
{
protected $table = 'gl_mobile';
}
... ...
... ... @@ -427,7 +427,10 @@ Route::middleware(['bloginauth'])->group(function () {
Route::prefix('language')->group(function () {
Route::any('/', [\App\Http\Controllers\Bside\Setting\LanguageController::class, 'lists'])->name('language_lists');
});
//优化关键词,检索关键词
Route::prefix('project_keyword')->group(function () {
Route::any('/', [\App\Http\Controllers\Bside\Keyword\ProjectKeywordController::class, 'searchKeywords'])->name('searchKeywords');
});
//自定义模板
Route::prefix('custom_module')->group(function () {
Route::any('/', [\App\Http\Controllers\Bside\CustomModule\CustomModuleController::class, 'lists'])->name('custom_lists');
... ...