作者 刘锟

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

... ... @@ -13,6 +13,8 @@ use App\Models\RouteMap\RouteMap;
use App\Models\Template\BTemplate;
use App\Models\Template\Setting;
use App\Models\User\User;
use App\Models\WebSetting\SettingNum;
use Illuminate\Support\Facades\Log;
class BlogController extends BaseController
{
... ... @@ -323,4 +325,54 @@ class BlogController extends BaseController
$data = $blog->copyBlogInfo();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :设置排序
* @name :setProductSort
* @author :lyh
* @method :post
* @time :2024/1/31 10:14
*/
public function setBlogSort(){
$setNumModel = new SettingNum();
try {
if(isset($this->param['id']) && !empty($this->param['id'])){
//执行编辑
$param = [
'data'=>json_encode($this->param['data']),
];
$setNumModel->edit($param,['id'=>$this->param['id']]);
}else{
//执行新增
$param = [
'type'=>$setNumModel::TYPE_BLOG_SORT,
'project_id'=>$this->user['project_id'],
'data'=>json_encode($this->param['data']),
];
$setNumModel->add($param);
}
}catch (\Exception $e){
Log::info('error file: ' . __CLASS__ . __FUNCTION__ . $e->getMessage());
$this->response('设置排序失败,请稍后重试',Code::SYSTEM_ERROR);
}
$this->response('success');
}
/**
* @remark :获取排序
* @name :getProductSort
* @author :lyh
* @method :post
* @time :2024/1/31 10:24
*/
public function getBlogSort(){
$setNumModel = new SettingNum();
$info = $setNumModel->read(['type'=>$setNumModel::TYPE_BLOG_SORT]);
if($info === false){
$info = [];
}else{
$info['data'] = json_decode($info['data']);
}
$this->response('success',Code::SUCCESS,$info);
}
}
... ...
... ... @@ -19,6 +19,8 @@ use App\Models\RouteMap\RouteMap;
use App\Models\Template\BTemplate;
use App\Models\Template\Setting;
use App\Models\User\User;
use App\Models\WebSetting\SettingNum;
use Illuminate\Support\Facades\Log;
class CustomModuleContentController extends BaseController
{
... ... @@ -267,4 +269,55 @@ class CustomModuleContentController extends BaseController
$data = $logic->copyModuleContentInfo();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :设置排序
* @name :setProductSort
* @author :lyh
* @method :post
* @time :2024/1/31 10:14
*/
public function setCustomSort(){
$setNumModel = new SettingNum();
try {
if(isset($this->param['id']) && !empty($this->param['id'])){
//执行编辑
$param = [
'data'=>json_encode($this->param['data']),
];
$setNumModel->edit($param,['id'=>$this->param['id']]);
}else{
//执行新增
$param = [
'type'=>$setNumModel::TYPE_CUSTOM_SORT,
'num'=>$this->param['module_id'],
'project_id'=>$this->user['project_id'],
'data'=>json_encode($this->param['data']),
];
$setNumModel->add($param);
}
}catch (\Exception $e){
Log::info('error file: ' . __CLASS__ . __FUNCTION__ . $e->getMessage());
$this->response('设置排序失败,请稍后重试',Code::SYSTEM_ERROR);
}
$this->response('success');
}
/**
* @remark :获取排序
* @name :getProductSort
* @author :lyh
* @method :post
* @time :2024/1/31 10:24
*/
public function getCustomSort(){
$setNumModel = new SettingNum();
$info = $setNumModel->read(['type'=>$setNumModel::TYPE_CUSTOM_SORT,'num'=>$this->param['module_id']]);
if($info === false){
$info = [];
}else{
$info['data'] = json_decode($info['data']);
}
$this->response('success',Code::SUCCESS,$info);
}
}
... ...
... ... @@ -13,6 +13,8 @@ use App\Models\RouteMap\RouteMap;
use App\Models\Template\BTemplate;
use App\Models\Template\Setting;
use App\Models\User\User;
use App\Models\WebSetting\SettingNum;
use Illuminate\Support\Facades\Log;
/**
... ... @@ -346,4 +348,55 @@ class NewsController extends BaseController
$data = $news->copyNewsInfo();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :设置排序
* @name :setProductSort
* @author :lyh
* @method :post
* @time :2024/1/31 10:14
*/
public function setNewsSort(){
$setNumModel = new SettingNum();
try {
if(isset($this->param['id']) && !empty($this->param['id'])){
//执行编辑
$param = [
'data'=>json_encode($this->param['data']),
];
$setNumModel->edit($param,['id'=>$this->param['id']]);
}else{
//执行新增
$param = [
'type'=>$setNumModel::TYPE_NEWS_SORT,
'project_id'=>$this->user['project_id'],
'data'=>json_encode($this->param['data']),
];
$setNumModel->add($param);
}
}catch (\Exception $e){
Log::info('error file: ' . __CLASS__ . __FUNCTION__ . $e->getMessage());
$this->response('设置排序失败,请稍后重试',Code::SYSTEM_ERROR);
}
$this->response('success');
}
/**
* @remark :获取排序
* @name :getProductSort
* @author :lyh
* @method :post
* @time :2024/1/31 10:24
*/
public function getNewsSort(){
$setNumModel = new SettingNum();
$info = $setNumModel->read(['type'=>$setNumModel::TYPE_NEWS_SORT]);
if($info === false){
$info = [];
}else{
$info['data'] = json_decode($info['data']);
}
$this->response('success',Code::SUCCESS,$info);
}
}
... ...
... ... @@ -58,9 +58,15 @@ class UserLogic extends BaseLogic
$projectModel = new Project();
$projectModel->edit(['lead_name'=>$this->param['name'],'mobile'=>$this->param['mobile']],['id'=>$info['project_id']]);
}
if(isset($this->param['role_id']) && ($this->param['role_id'] != 0)){
$roleModel = new ProjectRole();
$roleInfo = $roleModel->read(['project_id'=>$info['project_id'],'id'=>$this->param['role_id']]);
if($roleInfo == false){
$this->fail('当前角色不是当前项目角色');
}
}
$this->param = $this->editPassword($this->param);
$rs = $this->model->edit($this->param, ['id' => $this->param['id']]);
DB::table('gl_user_edit_log')->insert(['message'=>json_encode($this->param),'user_id'=>$this->manager['id'],'project_id'=>$info['project_id'],'created_at'=>date('Y-m-d H:i:s'),'updated_at'=>date('Y-m-d H:i:s')]);
} else {
$this->param['password'] = base64_encode(md5($this->param['password']));
$rs = $this->model->add($this->param);
... ... @@ -197,10 +203,10 @@ class UserLogic extends BaseLogic
*/
public function setRole(){
DB::beginTransaction();
//获取当前用户的觉得
//获取当前用户的角色
$roleModel = new ProjectRole();
$roleInfo = $roleModel->where('project_id',$this->param['project_id'])->orderBy('id','asc')->first();
$info = $this->model->read(['role_id'=>0]);
$info = $this->model->read(['role_id'=>0,'project_id'=>$this->param['project_id']]);
if(empty($info) || empty($roleInfo)){
$this->fail('请先添加角色');
}
... ...
... ... @@ -103,9 +103,9 @@ class RankDataLogic extends BaseLogic
'reach_day' => $lang_data[$lang['lang']]['dabiao_day'] ?? 0,
'home_cnt' => $lang_data[$lang['lang']]['home_cnt'] ?? 0,
'remain_day' => ($lang['type']??0) == 1 ? $data['project']['remain_day'] : $lang['service_day'] - $remain_day,
'type' => $lang['type'] ?? 0, //1 项目关键词 项目天数 2 保证首页关键词 项目达标天数
'type' => $lang['type'] ?? 1,
'dabiao_day'=>$remain_day,
'service_day' => $lang['service_day'] ?? 0, //1 项目关键词 项目天数 2 保证首页关键词 项目达标天数
'service_day' => $lang['service_day'] ?? 0,
];
}
}
... ...
... ... @@ -4,6 +4,7 @@ namespace App\Http\Logic\Bside\User;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\User\DeptUser;
use App\Models\User\ProjectRole;
use App\Models\User\User as UserModel;
use Illuminate\Support\Facades\DB;
... ... @@ -12,7 +13,6 @@ class DeptUserLogic extends BaseLogic
public function __construct()
{
parent::__construct();
$this->model = new DeptUser();
$this->param = $this->requestAll;
}
... ... @@ -76,6 +76,11 @@ class DeptUserLogic extends BaseLogic
* @time :2023/5/19 9:35
*/
public function user_edit_role(){
$roleModel = new ProjectRole();
$roleInfo = $roleModel->read(['project_id'=>$this->user['project_id'],'id'=>$this->param['role_id']]);
if($roleInfo == false){
$this->fail('当前角色id不是当前项目角色');
}
$userModel = new UserModel();
$rs = $userModel->edit(['role_id'=>$this->param['role_id']],['id'=>$this->param['id']]);
if($rs === false){
... ...
... ... @@ -4,6 +4,7 @@ namespace App\Http\Logic\Bside\User;
use App\Enums\Common\Code;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\User\ProjectRole;
use App\Models\User\User;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
... ... @@ -81,12 +82,17 @@ class UserLogic extends BaseLogic
if(isset($this->param['password']) && !empty($this->param['password'])){
$this->param['password'] = base64_encode(md5($this->param['password']));
}
if(isset($this->param['role_id']) && ($this->param['role_id'] != 0)){
$roleModel = new ProjectRole();
$roleInfo = $roleModel->read(['project_id'=>$this->user['project_id'],'id'=>$this->param['role_id']]);
if($roleInfo == false){
$this->fail('当前角色不是当前项目角色');
}
}
$rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
if($rs === false){
$this->fail('系统错误,请联系管理员');
}
//todo::写入日志
DB::table('gl_user_edit_log')->insert(['message'=>json_encode($this->param),'user_id'=>$this->user['id'],'project_id'=>$this->user['project_id'],'created_at'=>date('Y-m-d H:i:s'),'updated_at'=>date('Y-m-d H:i:s')]);
return $this->success();
}
... ... @@ -119,4 +125,5 @@ class UserLogic extends BaseLogic
//对应删除组织架构
return $this->success();
}
}
... ...
... ... @@ -3,6 +3,7 @@
namespace App\Models\User;
use App\Models\Base;
use Illuminate\Support\Facades\DB;
class User extends Base
... ...
... ... @@ -20,8 +20,10 @@ use App\Models\Base;
*/
class SettingNum extends Base
{
const TYPE_PRODUCT_SORT = 10;//c端显示排序
const TYPE_PRODUCT_SORT = 10;//c端产品显示排序
const TYPE_NEWS_SORT = 11;//c端新闻显示排序
const TYPE_BLOG_SORT = 12;//c端博客显示排序
const TYPE_CUSTOM_SORT = 13;//c端扩展模块显示排序
protected $table = 'gl_setting_num';
//连接数据库
protected $connection = 'custom_mysql';
... ...
... ... @@ -71,17 +71,6 @@ Route::middleware(['bloginauth'])->group(function () {
//新闻相关路由
Route::prefix('news')->group(function () {
//分类
Route::any('/category/', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'lists'])->name('news_category_lists');
Route::any('/category/add', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'save'])->name('news_category_add');
Route::any('/category/info', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'info'])->name('news_category_info');
Route::any('/category/edit', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'save'])->name('news_category_edit');
Route::any('/category/del', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'del'])->name('news_category_del');
Route::any('/category/allSort', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'allSort'])->name('news_category_allSort');
Route::any('/category/copyCategory', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'copyCategory'])->name('news_category_copyCategory');
Route::any('/category/status', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'status'])->name('news_category_status');
Route::any('/category/sort', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'sort'])->name('news_category_sort');
Route::any('/category/categoryTopList', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'categoryTopList'])->name('news_category_categoryTopList');
//新闻
Route::any('/', [\App\Http\Controllers\Bside\News\NewsController::class, 'lists'])->name('news_category_lists');
Route::any('/newsNoPage', [\App\Http\Controllers\Bside\News\NewsController::class, 'newsNoPage'])->name('news_newsNoPage');
... ... @@ -98,6 +87,19 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/allSort', [\App\Http\Controllers\Bside\News\NewsController::class, 'allSort'])->name('news_allSort');
Route::any('/batchSetCategory', [\App\Http\Controllers\Bside\News\NewsController::class, 'batchSetCategory'])->name('news_batchSetCategory');
Route::any('/statusNum', [\App\Http\Controllers\Bside\News\NewsController::class, 'getStatusNumber'])->name('news_statusNum');
Route::any('/setNewsSort', [\App\Http\Controllers\Bside\News\NewsController::class, 'setNewsSort'])->name('news_setNewsSort');
Route::any('/getNewsSort', [\App\Http\Controllers\Bside\News\NewsController::class, 'getNewsSort'])->name('news_getNewsSort');
//分类
Route::any('/category/', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'lists'])->name('news_category_lists');
Route::any('/category/add', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'save'])->name('news_category_add');
Route::any('/category/info', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'info'])->name('news_category_info');
Route::any('/category/edit', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'save'])->name('news_category_edit');
Route::any('/category/del', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'del'])->name('news_category_del');
Route::any('/category/allSort', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'allSort'])->name('news_category_allSort');
Route::any('/category/copyCategory', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'copyCategory'])->name('news_category_copyCategory');
Route::any('/category/status', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'status'])->name('news_category_status');
Route::any('/category/sort', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'sort'])->name('news_category_sort');
Route::any('/category/categoryTopList', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'categoryTopList'])->name('news_category_categoryTopList');
});
//博客相关路由
... ... @@ -116,6 +118,8 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/batchSetCategory', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'batchSetCategory'])->name('blog_batchSetCategory');
Route::any('/copyBlog', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'copyBlog'])->name('blog_copyBlog');
Route::any('/statusNum', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'getStatusNumber'])->name('blog_statusNum');
Route::any('/setBlogSort', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'setBlogSort'])->name('blog_setBlogSort');
Route::any('/getBlogSort', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'getBlogSort'])->name('blog_getBlogSort');
//分类
Route::any('/category/', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'lists'])->name('blog_category_lists');
Route::any('/category/add', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'save'])->name('blog_category_add');
... ... @@ -512,6 +516,8 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/del', [\App\Http\Controllers\Bside\CustomModule\CustomModuleContentController::class, 'del'])->name('custom_content_del');
Route::any('/allSort', [\App\Http\Controllers\Bside\CustomModule\CustomModuleContentController::class, 'allSort'])->name('custom_content_allSort');
Route::any('/copyModuleContent', [\App\Http\Controllers\Bside\CustomModule\CustomModuleContentController::class, 'copyModuleContent'])->name('custom_content_copyModuleContent');
Route::any('/setCustomSort', [\App\Http\Controllers\Bside\CustomModule\CustomModuleContentController::class, 'setCustomSort'])->name('custom_content_setCustomSort');
Route::any('/getCustomSort', [\App\Http\Controllers\Bside\CustomModule\CustomModuleContentController::class, 'getCustomSort'])->name('custom_content_getCustomSort');
});
Route::prefix('extend')->group(function () {
... ...