迁移人力资源、日常办公
This commit is contained in:
parent
80b734a88b
commit
4db10be442
112
app/common/model/article/Article.php
Normal file
112
app/common/model/article/Article.php
Normal file
@ -0,0 +1,112 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model\article;
|
||||
|
||||
use app\common\enum\YesNoEnum;
|
||||
use app\common\model\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
/**
|
||||
* 资讯管理模型
|
||||
* Class Article
|
||||
* @package app\common\model\article;
|
||||
*/
|
||||
class Article extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
/**
|
||||
* @notes 获取分类名称
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return string
|
||||
* @author heshihu
|
||||
* @date 2022/2/22 9:53
|
||||
*/
|
||||
public function getCateNameAttr($value, $data)
|
||||
{
|
||||
return ArticleCate::where('id', $data['cid'])->value('name');
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 浏览量
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return mixed
|
||||
* @author 段誉
|
||||
* @date 2022/9/15 11:33
|
||||
*/
|
||||
public function getClickAttr($value, $data)
|
||||
{
|
||||
return $data['click_actual'] + $data['click_virtual'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置图片域名
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return array|string|string[]|null
|
||||
* @author 段誉
|
||||
* @date 2022/9/28 10:17
|
||||
*/
|
||||
public function getContentAttr($value, $data)
|
||||
{
|
||||
return get_file_domain($value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 清除图片域名
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return array|string|string[]
|
||||
* @author 段誉
|
||||
* @date 2022/9/28 10:17
|
||||
*/
|
||||
public function setContentAttr($value, $data)
|
||||
{
|
||||
return clear_file_domain($value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取文章详情
|
||||
* @param $id
|
||||
* @return array
|
||||
* @author 段誉
|
||||
* @date 2022/10/20 15:23
|
||||
*/
|
||||
public static function getArticleDetailArr(int $id)
|
||||
{
|
||||
$article = Article::where(['id' => $id, 'is_show' => YesNoEnum::YES])
|
||||
->findOrEmpty();
|
||||
|
||||
if ($article->isEmpty()) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// 增加点击量
|
||||
$article->click_actual += 1;
|
||||
$article->save();
|
||||
|
||||
return $article->append(['click'])
|
||||
->hidden(['click_virtual', 'click_actual'])
|
||||
->toArray();
|
||||
}
|
||||
|
||||
}
|
74
app/common/model/article/ArticleCate.php
Normal file
74
app/common/model/article/ArticleCate.php
Normal file
@ -0,0 +1,74 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model\article;
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
/**
|
||||
* 资讯分类管理模型
|
||||
* Class ArticleCate
|
||||
* @package app\common\model\article;
|
||||
*/
|
||||
class ArticleCate extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
|
||||
/**
|
||||
* @notes 关联文章
|
||||
* @return \think\model\relation\HasMany
|
||||
* @author 段誉
|
||||
* @date 2022/10/19 16:59
|
||||
*/
|
||||
public function article()
|
||||
{
|
||||
return $this->hasMany(Article::class, 'cid', 'id');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 状态描述
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return string
|
||||
* @author 段誉
|
||||
* @date 2022/9/15 11:25
|
||||
*/
|
||||
public function getIsShowDescAttr($value, $data)
|
||||
{
|
||||
return $data['is_show'] ? '启用' : '停用';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 文章数量
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return int
|
||||
* @author 段誉
|
||||
* @date 2022/9/15 11:32
|
||||
*/
|
||||
public function getArticleCountAttr($value, $data)
|
||||
{
|
||||
return Article::where(['cid' => $data['id']])->count('id');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -22,7 +22,7 @@ use think\model\concern\SoftDelete;
|
||||
/**
|
||||
* 企业员工模型
|
||||
* Class OaAdmin
|
||||
* @package app\common\model\works\rlzy
|
||||
* @package app\common\model\works\hr
|
||||
*/
|
||||
class OaAdmin extends BaseModel
|
||||
{
|
||||
|
@ -24,7 +24,7 @@ use think\model\concern\SoftDelete;
|
||||
/**
|
||||
* 人事调动模型
|
||||
* Class OaDepartmentChange
|
||||
* @package app\common\model\works\rlzy
|
||||
* @package app\common\model\works\hr
|
||||
*/
|
||||
class OaDepartmentChange extends BaseModel
|
||||
{
|
||||
|
@ -22,7 +22,7 @@ use think\model\concern\SoftDelete;
|
||||
/**
|
||||
* 离职档案模型
|
||||
* Class OaPersonalQuit
|
||||
* @package app\common\model\works\rlzy
|
||||
* @package app\common\model\works\hr
|
||||
*/
|
||||
class OaPersonalQuit extends BaseModel
|
||||
{
|
||||
|
134
app/oa/controller/article/ArticleCateController.php
Normal file
134
app/oa/controller/article/ArticleCateController.php
Normal file
@ -0,0 +1,134 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\oa\controller\article;
|
||||
|
||||
use app\admin\controller\BaseAdminController;
|
||||
use app\oa\lists\article\ArticleCateLists;
|
||||
use app\oa\logic\article\ArticleCateLogic;
|
||||
use app\oa\validate\article\ArticleCateValidate;
|
||||
|
||||
/**
|
||||
* 资讯分类管理控制器
|
||||
* Class ArticleCateController
|
||||
* @package app\adminapi\controller\article
|
||||
*/
|
||||
class ArticleCateController extends BaseAdminController
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 查看资讯分类列表
|
||||
* @return \think\response\Json
|
||||
* @author heshihu
|
||||
* @date 2022/2/21 17:11
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new ArticleCateLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加资讯分类
|
||||
* @return \think\response\Json
|
||||
* @author heshihu
|
||||
* @date 2022/2/21 17:31
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new ArticleCateValidate())->post()->goCheck('add');
|
||||
ArticleCateLogic::add($params);
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑资讯分类
|
||||
* @return \think\response\Json
|
||||
* @author heshihu
|
||||
* @date 2022/2/21 17:49
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new ArticleCateValidate())->post()->goCheck('edit');
|
||||
$result = ArticleCateLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(ArticleCateLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除资讯分类
|
||||
* @return \think\response\Json
|
||||
* @author heshihu
|
||||
* @date 2022/2/21 17:52
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new ArticleCateValidate())->post()->goCheck('delete');
|
||||
ArticleCateLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 资讯分类详情
|
||||
* @return \think\response\Json
|
||||
* @author heshihu
|
||||
* @date 2022/2/21 17:54
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new ArticleCateValidate())->goCheck('detail');
|
||||
$result = ArticleCateLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 更改资讯分类状态
|
||||
* @return \think\response\Json
|
||||
* @author heshihu
|
||||
* @date 2022/2/21 10:15
|
||||
*/
|
||||
public function updateStatus()
|
||||
{
|
||||
$params = (new ArticleCateValidate())->post()->goCheck('status');
|
||||
$result = ArticleCateLogic::updateStatus($params);
|
||||
if (true === $result) {
|
||||
return $this->success('修改成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(ArticleCateLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取文章分类
|
||||
* @return \think\response\Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 段誉
|
||||
* @date 2022/10/13 10:54
|
||||
*/
|
||||
public function all()
|
||||
{
|
||||
$result = ArticleCateLogic::getAllData();
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
114
app/oa/controller/article/ArticleController.php
Normal file
114
app/oa/controller/article/ArticleController.php
Normal file
@ -0,0 +1,114 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\oa\controller\article;
|
||||
|
||||
use app\admin\controller\BaseAdminController;
|
||||
use app\oa\lists\article\ArticleLists;
|
||||
use app\oa\logic\article\ArticleLogic;
|
||||
use app\oa\validate\article\ArticleValidate;
|
||||
|
||||
/**
|
||||
* 资讯管理控制器
|
||||
* Class ArticleController
|
||||
* @package app\adminapi\controller\article
|
||||
*/
|
||||
class ArticleController extends BaseAdminController
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 查看资讯列表
|
||||
* @return \think\response\Json
|
||||
* @author heshihu
|
||||
* @date 2022/2/22 9:47
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new ArticleLists());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 添加资讯
|
||||
* @return \think\response\Json
|
||||
* @author heshihu
|
||||
* @date 2022/2/22 9:57
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new ArticleValidate())->post()->goCheck('add');
|
||||
ArticleLogic::add($params);
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 编辑资讯
|
||||
* @return \think\response\Json
|
||||
* @author heshihu
|
||||
* @date 2022/2/22 10:12
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new ArticleValidate())->post()->goCheck('edit');
|
||||
$result = ArticleLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(ArticleLogic::getError());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 删除资讯
|
||||
* @return \think\response\Json
|
||||
* @author heshihu
|
||||
* @date 2022/2/22 10:17
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new ArticleValidate())->post()->goCheck('delete');
|
||||
ArticleLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 资讯详情
|
||||
* @return \think\response\Json
|
||||
* @author heshihu
|
||||
* @date 2022/2/22 10:15
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new ArticleValidate())->goCheck('detail');
|
||||
$result = ArticleLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 更改资讯状态
|
||||
* @return \think\response\Json
|
||||
* @author heshihu
|
||||
* @date 2022/2/22 10:18
|
||||
*/
|
||||
public function updateStatus()
|
||||
{
|
||||
$params = (new ArticleValidate())->post()->goCheck('status');
|
||||
$result = ArticleLogic::updateStatus($params);
|
||||
if (true === $result) {
|
||||
return $this->success('修改成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(ArticleLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -25,7 +25,7 @@ use app\adminapi\validate\works\rlzy\OaAdminValidate;
|
||||
/**
|
||||
* 企业员工控制器
|
||||
* Class OaAdminController
|
||||
* @package app\adminapi\controller\works\rlzy
|
||||
* @package app\adminapi\controller\works\hr
|
||||
*/
|
||||
class OaAdminController extends BaseAdminController
|
||||
{
|
@ -12,20 +12,18 @@
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\oa\controller\works\hr;
|
||||
|
||||
namespace app\adminapi\controller\works\rlzy;
|
||||
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\works\rlzy\OaDepartmentChangeLists;
|
||||
use app\adminapi\logic\works\rlzy\OaDepartmentChangeLogic;
|
||||
use app\adminapi\validate\works\rlzy\OaDepartmentChangeValidate;
|
||||
use app\admin\controller\BaseAdminController;
|
||||
use app\oa\lists\works\hr\OaDepartmentChangeLists;
|
||||
use app\oa\logic\works\hr\OaDepartmentChangeLogic;
|
||||
use app\oa\validate\works\hr\OaDepartmentChangeValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 人事调动控制器
|
||||
* Class OaDepartmentChangeController
|
||||
* @package app\adminapi\controller\works\rlzy
|
||||
* @package app\adminapi\controller\works\hr
|
||||
*/
|
||||
class OaDepartmentChangeController extends BaseAdminController
|
||||
{
|
@ -13,19 +13,19 @@
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\adminapi\controller\works\rlzy;
|
||||
namespace app\oa\controller\works\hr;
|
||||
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\works\rlzy\OaPersonalQuitLists;
|
||||
use app\adminapi\logic\works\rlzy\OaPersonalQuitLogic;
|
||||
use app\adminapi\validate\works\rlzy\OaPersonalQuitValidate;
|
||||
use app\admin\controller\BaseAdminController;
|
||||
use app\oa\lists\works\hr\OaPersonalQuitLists;
|
||||
use app\oa\logic\works\hr\OaPersonalQuitLogic;
|
||||
use app\oa\validate\works\hr\OaPersonalQuitValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 离职档案控制器
|
||||
* Class OaPersonalQuitController
|
||||
* @package app\adminapi\controller\works\rlzy
|
||||
* @package app\adminapi\controller\works\hr
|
||||
*/
|
||||
class OaPersonalQuitController extends BaseAdminController
|
||||
{
|
@ -13,13 +13,13 @@
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\adminapi\controller\works\rcbg;
|
||||
namespace app\oa\controller\works\rcbg;
|
||||
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\works\rcbg\OaPlanLists;
|
||||
use app\adminapi\logic\works\rcbg\OaPlanLogic;
|
||||
use app\adminapi\validate\works\rcbg\OaPlanValidate;
|
||||
use app\admin\controller\BaseAdminController;
|
||||
use app\oa\lists\works\rcbg\OaPlanLists;
|
||||
use app\oa\logic\works\rcbg\OaPlanLogic;
|
||||
use app\oa\validate\works\rcbg\OaPlanValidate;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -13,13 +13,13 @@
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\adminapi\controller\works\rcbg;
|
||||
namespace app\oa\controller\works\rcbg;
|
||||
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\works\rcbg\OaScheduleLists;
|
||||
use app\adminapi\logic\works\rcbg\OaScheduleLogic;
|
||||
use app\adminapi\validate\works\rcbg\OaScheduleValidate;
|
||||
use app\admin\controller\BaseAdminController;
|
||||
use app\oa\lists\works\rcbg\OaScheduleLists;
|
||||
use app\oa\logic\works\rcbg\OaScheduleLogic;
|
||||
use app\oa\validate\works\rcbg\OaScheduleValidate;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -13,13 +13,13 @@
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\adminapi\controller\works\rcbg;
|
||||
namespace app\oa\controller\works\rcbg;
|
||||
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\works\rcbg\OaWorkCommentLists;
|
||||
use app\adminapi\logic\works\rcbg\OaWorkCommentLogic;
|
||||
use app\adminapi\validate\works\rcbg\OaWorkCommentValidate;
|
||||
use app\admin\controller\BaseAdminController;
|
||||
use app\oa\lists\works\rcbg\OaWorkCommentLists;
|
||||
use app\oa\logic\works\rcbg\OaWorkCommentLogic;
|
||||
use app\oa\validate\works\rcbg\OaWorkCommentValidate;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -13,13 +13,13 @@
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\adminapi\controller\works\rcbg;
|
||||
namespace app\oa\controller\works\rcbg;
|
||||
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\works\rcbg\OaWorkLists;
|
||||
use app\adminapi\logic\works\rcbg\OaWorkLogic;
|
||||
use app\adminapi\validate\works\rcbg\OaWorkValidate;
|
||||
use app\admin\controller\BaseAdminController;
|
||||
use app\oa\lists\works\rcbg\OaWorkLists;
|
||||
use app\oa\logic\works\rcbg\OaWorkLogic;
|
||||
use app\oa\validate\works\rcbg\OaWorkValidate;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -13,13 +13,13 @@
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\adminapi\controller\works\rcbg;
|
||||
namespace app\oa\controller\works\rcbg;
|
||||
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\works\rcbg\OaWorkRecordLists;
|
||||
use app\adminapi\logic\works\rcbg\OaWorkRecordLogic;
|
||||
use app\adminapi\validate\works\rcbg\OaWorkRecordValidate;
|
||||
use app\admin\controller\BaseAdminController;
|
||||
use app\oa\lists\works\rcbg\OaWorkRecordLists;
|
||||
use app\oa\logic\works\rcbg\OaWorkRecordLogic;
|
||||
use app\oa\validate\works\rcbg\OaWorkRecordValidate;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -13,11 +13,10 @@
|
||||
// +----------------------------------------------------------------------
|
||||
declare (strict_types=1);
|
||||
|
||||
namespace app\api\http\middleware;
|
||||
|
||||
namespace app\oa\http\middleware;
|
||||
|
||||
use app\common\exception\ControllerExtendException;
|
||||
use app\api\controller\BaseApiController;
|
||||
use app\oa\controller\BaseAdminController;
|
||||
use think\exception\ClassNotFoundException;
|
||||
use app\common\exception\HttpException;
|
||||
use Webman\Http\Request;
|
||||
@ -33,7 +32,7 @@ class InitMiddleware implements MiddlewareInterface
|
||||
try {
|
||||
$controller = str_replace('.', '\\', $request->controller);
|
||||
$controllerClass = new $controller;
|
||||
if (($controllerClass instanceof BaseApiController) === false) {
|
||||
if (($controllerClass instanceof BaseAdminController) === false) {
|
||||
throw new ControllerExtendException($controller, '404');
|
||||
}
|
||||
} catch (ClassNotFoundException $e) {
|
||||
|
@ -1,10 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\http\middleware;
|
||||
|
||||
use app\common\cache\UserTokenCache;
|
||||
namespace app\oa\http\middleware;
|
||||
|
||||
|
||||
use app\admin\service\AdminTokenService;
|
||||
use app\common\cache\AdminTokenCache;
|
||||
use app\common\service\JsonService;
|
||||
use app\api\service\UserTokenService;
|
||||
use Webman\Config;
|
||||
use Webman\Http\Request;
|
||||
use Webman\Http\Response;
|
||||
@ -12,39 +14,40 @@ use Webman\MiddlewareInterface;
|
||||
|
||||
class LoginMiddleware implements MiddlewareInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 登录验证
|
||||
* @param $request
|
||||
* @param \Closure $next
|
||||
* @return mixed|\think\response\Json
|
||||
* @author 令狐冲
|
||||
* @author 乔峰
|
||||
* @date 2021/7/1 17:33
|
||||
*/
|
||||
public function process(Request $request, callable $handler): Response
|
||||
{
|
||||
$token = $request->header('token');
|
||||
// $controller = str_replace('.', '\\', $request->controller);
|
||||
//判断接口是否免登录
|
||||
$isNotNeedLogin = $request->controllerObject->isNotNeedLogin();
|
||||
|
||||
//不直接判断$isNotNeedLogin结果,使不需要登录的接口通过,为了兼容某些接口可以登录或不登录访问
|
||||
if (empty($token) && !$isNotNeedLogin) {
|
||||
//没有token并且该地址需要登录才能访问, 指定show为0,前端不弹出此报错
|
||||
return JsonService::fail('请求参数缺token', [], 0, 1);
|
||||
//没有token并且该地址需要登录才能访问
|
||||
return JsonService::fail('请求参数缺token', [], 0, 0);
|
||||
}
|
||||
|
||||
$userInfo = (new UserTokenCache())->getUserInfo($token);
|
||||
|
||||
if (empty($userInfo) && !$isNotNeedLogin) {
|
||||
$adminInfo = (new AdminTokenCache())->getAdminInfo($token);
|
||||
if (empty($adminInfo) && !$isNotNeedLogin) {
|
||||
//token过期无效并且该地址需要登录才能访问
|
||||
return JsonService::fail('登录超时,请重新登录', [], -1, 0);
|
||||
return JsonService::fail('登录超时,请重新登录', [], -1);
|
||||
}
|
||||
|
||||
//token临近过期,自动续期
|
||||
if ($userInfo) {
|
||||
if ($adminInfo) {
|
||||
//获取临近过期自动续期时长
|
||||
$beExpireDuration = Config::get('project.user_token.be_expire_duration');
|
||||
$beExpireDuration = Config::get('project.admin_token.be_expire_duration');
|
||||
//token续期
|
||||
if (time() > ($userInfo['expire_time'] - $beExpireDuration)) {
|
||||
$result = UserTokenService::overtimeToken($token);
|
||||
if (time() > ($adminInfo['expire_time'] - $beExpireDuration)) {
|
||||
$result = AdminTokenService::overtimeToken($token);
|
||||
//续期失败(数据表被删除导致)
|
||||
if (empty($result)) {
|
||||
return JsonService::fail('登录过期', [], -1);
|
||||
@ -53,10 +56,10 @@ class LoginMiddleware implements MiddlewareInterface
|
||||
}
|
||||
|
||||
//给request赋值,用于控制器
|
||||
$request->userInfo = $userInfo;
|
||||
$request->userId = $userInfo['user_id'] ?? 0;
|
||||
$request->adminInfo = $adminInfo;
|
||||
$request->adminId = $adminInfo['admin_id'] ?? 0;
|
||||
$request->supplierId = $adminInfo['supplier_id'] ?? 0;
|
||||
|
||||
return $handler($request);
|
||||
}
|
||||
|
||||
}
|
98
app/oa/lists/article/ArticleCateLists.php
Normal file
98
app/oa/lists/article/ArticleCateLists.php
Normal file
@ -0,0 +1,98 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\oa\lists\article;
|
||||
|
||||
use app\admin\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\lists\ListsSortInterface;
|
||||
use app\common\model\article\ArticleCate;
|
||||
|
||||
/**
|
||||
* 资讯分类列表
|
||||
* Class ArticleCateLists
|
||||
* @package app\adminapi\lists\article
|
||||
*/
|
||||
class ArticleCateLists extends BaseAdminDataLists implements ListsSearchInterface, ListsSortInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return array
|
||||
* @author heshihu
|
||||
* @date 2022/2/8 18:39
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 设置支持排序字段
|
||||
* @return array
|
||||
* @author heshihu
|
||||
* @date 2022/2/9 15:11
|
||||
*/
|
||||
public function setSortFields(): array
|
||||
{
|
||||
return ['create_time' => 'create_time', 'id' => 'id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 设置默认排序
|
||||
* @return array
|
||||
* @author heshihu
|
||||
* @date 2022/2/9 15:08
|
||||
*/
|
||||
public function setDefaultOrder(): array
|
||||
{
|
||||
return ['sort' => 'desc','id' => 'desc'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取管理列表
|
||||
* @return array
|
||||
* @author heshihu
|
||||
* @date 2022/2/21 17:11
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$ArticleCateLists = ArticleCate::where($this->searchWhere)
|
||||
->append(['is_show_desc'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order($this->sortOrder)
|
||||
->append(['article_count'])
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return $ArticleCateLists;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author heshihu
|
||||
* @date 2022/2/9 15:12
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return ArticleCate::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
public function extend()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
99
app/oa/lists/article/ArticleLists.php
Normal file
99
app/oa/lists/article/ArticleLists.php
Normal file
@ -0,0 +1,99 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\oa\lists\article;
|
||||
|
||||
use app\admin\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\lists\ListsSortInterface;
|
||||
use app\common\model\article\Article;
|
||||
|
||||
/**
|
||||
* 资讯列表
|
||||
* Class ArticleLists
|
||||
* @package app\adminapi\lists\article
|
||||
*/
|
||||
class ArticleLists extends BaseAdminDataLists implements ListsSearchInterface, ListsSortInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return array
|
||||
* @author heshihu
|
||||
* @date 2022/2/8 18:39
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'%like%' => ['title'],
|
||||
'=' => ['cid', 'is_show']
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 设置支持排序字段
|
||||
* @return array
|
||||
* @author heshihu
|
||||
* @date 2022/2/9 15:11
|
||||
*/
|
||||
public function setSortFields(): array
|
||||
{
|
||||
return ['create_time' => 'create_time', 'id' => 'id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 设置默认排序
|
||||
* @return array
|
||||
* @author heshihu
|
||||
* @date 2022/2/9 15:08
|
||||
*/
|
||||
public function setDefaultOrder(): array
|
||||
{
|
||||
return ['sort' => 'desc', 'id' => 'desc'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取管理列表
|
||||
* @return array
|
||||
* @author heshihu
|
||||
* @date 2022/2/21 17:11
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$ArticleLists = Article::where($this->searchWhere)
|
||||
->append(['cate_name', 'click'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order($this->sortOrder)
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return $ArticleLists;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author heshihu
|
||||
* @date 2022/2/9 15:12
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return Article::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
public function extend()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
@ -12,10 +12,10 @@
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\works\rlzy;
|
||||
namespace app\oa\lists\works\hr;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\oa\lists\BaseAdminDataLists;
|
||||
use app\common\model\dept\Dept;
|
||||
use app\common\model\dept\Jobs;
|
||||
use app\common\model\dept\Orgs;
|
||||
@ -26,7 +26,7 @@ use app\common\lists\ListsSearchInterface;
|
||||
/**
|
||||
* 企业员工列表
|
||||
* Class OaAdminLists
|
||||
* @package app\adminapi\listsworks\rlzy
|
||||
* @package app\adminapi\listsworks\hr
|
||||
*/
|
||||
class OaAdminLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
@ -12,10 +12,10 @@
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\works\rlzy;
|
||||
namespace app\oa\lists\works\hr;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\oa\lists\BaseAdminDataLists;
|
||||
use app\common\model\works\rlzy\OaDepartmentChange;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
@ -23,7 +23,7 @@ use app\common\lists\ListsSearchInterface;
|
||||
/**
|
||||
* 人事调动列表
|
||||
* Class OaDepartmentChangeLists
|
||||
* @package app\adminapi\listsworks\rlzy
|
||||
* @package app\adminapi\listsworks\hr
|
||||
*/
|
||||
class OaDepartmentChangeLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
@ -12,10 +12,10 @@
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\works\rlzy;
|
||||
namespace app\oa\lists\works\hr;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\oa\lists\BaseAdminDataLists;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\works\rlzy\OaPersonalQuit;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
@ -24,7 +24,7 @@ use app\common\lists\ListsSearchInterface;
|
||||
/**
|
||||
* 离职档案列表
|
||||
* Class OaPersonalQuitLists
|
||||
* @package app\adminapi\listsworks\rlzy
|
||||
* @package app\adminapi\listsworks\hr
|
||||
*/
|
||||
class OaPersonalQuitLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
@ -12,10 +12,10 @@
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\works\rcbg;
|
||||
namespace app\oa\lists\works\rcbg;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\admin\lists\BaseAdminDataLists;
|
||||
use app\common\model\works\rcbg\OaPlan;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
@ -12,10 +12,10 @@
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\works\rcbg;
|
||||
namespace app\oa\lists\works\rcbg;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\admin\lists\BaseAdminDataLists;
|
||||
use app\common\model\works\rcbg\OaSchedule;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
@ -12,10 +12,10 @@
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\works\rcbg;
|
||||
namespace app\oa\lists\works\rcbg;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\admin\lists\BaseAdminDataLists;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\works\rcbg\OaWorkComment;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
@ -12,10 +12,10 @@
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\works\rcbg;
|
||||
namespace app\oa\lists\works\rcbg;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\admin\lists\BaseAdminDataLists;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\works\rcbg\OaWork;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
@ -12,10 +12,10 @@
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\works\rcbg;
|
||||
namespace app\oa\lists\works\rcbg;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\admin\lists\BaseAdminDataLists;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\works\rcbg\OaWork;
|
||||
use app\common\model\works\rcbg\OaWorkRecord;
|
||||
|
127
app/oa/logic/article/ArticleCateLogic.php
Normal file
127
app/oa/logic/article/ArticleCateLogic.php
Normal file
@ -0,0 +1,127 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\oa\logic\article;
|
||||
|
||||
use app\common\enum\YesNoEnum;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\article\ArticleCate;
|
||||
|
||||
/**
|
||||
* 资讯分类管理逻辑
|
||||
* Class ArticleCateLogic
|
||||
* @package app\adminapi\logic\article
|
||||
*/
|
||||
class ArticleCateLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加资讯分类
|
||||
* @param array $params
|
||||
* @author heshihu
|
||||
* @date 2022/2/18 10:17
|
||||
*/
|
||||
public static function add(array $params)
|
||||
{
|
||||
ArticleCate::create([
|
||||
'name' => $params['name'],
|
||||
'is_show' => $params['is_show'],
|
||||
'sort' => $params['sort'] ?? 0
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑资讯分类
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author heshihu
|
||||
* @date 2022/2/21 17:50
|
||||
*/
|
||||
public static function edit(array $params) : bool
|
||||
{
|
||||
try {
|
||||
ArticleCate::update([
|
||||
'id' => $params['id'],
|
||||
'name' => $params['name'],
|
||||
'is_show' => $params['is_show'],
|
||||
'sort' => $params['sort'] ?? 0
|
||||
]);
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除资讯分类
|
||||
* @param array $params
|
||||
* @author heshihu
|
||||
* @date 2022/2/21 17:52
|
||||
*/
|
||||
public static function delete(array $params)
|
||||
{
|
||||
ArticleCate::destroy($params['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 查看资讯分类详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author heshihu
|
||||
* @date 2022/2/21 17:54
|
||||
*/
|
||||
public static function detail($params) : array
|
||||
{
|
||||
return ArticleCate::findOrEmpty($params['id'])->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 更改资讯分类状态
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author heshihu
|
||||
* @date 2022/2/21 18:04
|
||||
*/
|
||||
public static function updateStatus(array $params)
|
||||
{
|
||||
ArticleCate::update([
|
||||
'id' => $params['id'],
|
||||
'is_show' => $params['is_show']
|
||||
]);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 文章分类数据
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 段誉
|
||||
* @date 2022/10/13 10:53
|
||||
*/
|
||||
public static function getAllData()
|
||||
{
|
||||
return ArticleCate::where(['is_show' => YesNoEnum::YES])
|
||||
->order(['sort' => 'desc', 'id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
}
|
121
app/oa/logic/article/ArticleLogic.php
Normal file
121
app/oa/logic/article/ArticleLogic.php
Normal file
@ -0,0 +1,121 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\oa\logic\article;
|
||||
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\article\Article;
|
||||
use app\common\service\FileService;
|
||||
|
||||
/**
|
||||
* 资讯管理逻辑
|
||||
* Class ArticleLogic
|
||||
* @package app\adminapi\logic\article
|
||||
*/
|
||||
class ArticleLogic extends BaseLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 添加资讯
|
||||
* @param array $params
|
||||
* @author heshihu
|
||||
* @date 2022/2/22 9:57
|
||||
*/
|
||||
public static function add(array $params)
|
||||
{
|
||||
Article::create([
|
||||
'title' => $params['title'],
|
||||
'desc' => $params['desc'] ?? '',
|
||||
'author' => $params['author'] ?? '', //作者
|
||||
'sort' => $params['sort'] ?? 0, // 排序
|
||||
'abstract' => $params['abstract'], // 文章摘要
|
||||
'click_virtual' => $params['click_virtual'] ?? 0,
|
||||
'image' => $params['image'] ? FileService::setFileUrl($params['image']) : '',
|
||||
'cid' => $params['cid'],
|
||||
'is_show' => $params['is_show'],
|
||||
'content' => $params['content'] ?? '',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑资讯
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author heshihu
|
||||
* @date 2022/2/22 10:12
|
||||
*/
|
||||
public static function edit(array $params) : bool
|
||||
{
|
||||
try {
|
||||
Article::update([
|
||||
'id' => $params['id'],
|
||||
'title' => $params['title'],
|
||||
'desc' => $params['desc'] ?? '', // 简介
|
||||
'author' => $params['author'] ?? '', //作者
|
||||
'sort' => $params['sort'] ?? 0, // 排序
|
||||
'abstract' => $params['abstract'], // 文章摘要
|
||||
'click_virtual' => $params['click_virtual'] ?? 0,
|
||||
'image' => $params['image'] ? FileService::setFileUrl($params['image']) : '',
|
||||
'cid' => $params['cid'],
|
||||
'is_show' => $params['is_show'],
|
||||
'content' => $params['content'] ?? '',
|
||||
]);
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除资讯
|
||||
* @param array $params
|
||||
* @author heshihu
|
||||
* @date 2022/2/22 10:17
|
||||
*/
|
||||
public static function delete(array $params)
|
||||
{
|
||||
Article::destroy($params['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 查看资讯详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author heshihu
|
||||
* @date 2022/2/22 10:15
|
||||
*/
|
||||
public static function detail($params) : array
|
||||
{
|
||||
return Article::findOrEmpty($params['id'])->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 更改资讯状态
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author heshihu
|
||||
* @date 2022/2/22 10:18
|
||||
*/
|
||||
public static function updateStatus(array $params)
|
||||
{
|
||||
Article::update([
|
||||
'id' => $params['id'],
|
||||
'is_show' => $params['is_show']
|
||||
]);
|
||||
return true;
|
||||
}
|
||||
}
|
@ -12,7 +12,7 @@
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\oa\logic\works\rlzy;
|
||||
namespace app\oa\logic\works\hr;
|
||||
|
||||
|
||||
use app\common\cache\AdminAuthCache;
|
||||
@ -32,7 +32,7 @@ use think\facade\Db;
|
||||
/**
|
||||
* 企业员工逻辑
|
||||
* Class OaAdminLogic
|
||||
* @package app\adminapi\logic\works\rlzy
|
||||
* @package app\adminapi\logic\works\hr
|
||||
*/
|
||||
class OaAdminLogic extends BaseLogic
|
||||
{
|
@ -12,7 +12,7 @@
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\oa\logic\works\rlzy;
|
||||
namespace app\oa\logic\works\hr;
|
||||
|
||||
|
||||
use app\common\model\auth\Admin;
|
||||
@ -24,7 +24,7 @@ use think\facade\Db;
|
||||
/**
|
||||
* 人事调动逻辑
|
||||
* Class OaDepartmentChangeLogic
|
||||
* @package app\adminapi\logic\works\rlzy
|
||||
* @package app\adminapi\logic\works\hr
|
||||
*/
|
||||
class OaDepartmentChangeLogic extends BaseLogic
|
||||
{
|
@ -12,7 +12,7 @@
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\oa\logic\works\rlzy;
|
||||
namespace app\oa\logic\works\hr;
|
||||
|
||||
|
||||
use app\common\model\auth\Admin;
|
||||
@ -24,7 +24,7 @@ use think\facade\Db;
|
||||
/**
|
||||
* 离职档案逻辑
|
||||
* Class OaPersonalQuitLogic
|
||||
* @package app\adminapi\logic\works\rlzy
|
||||
* @package app\adminapi\logic\works\hr
|
||||
*/
|
||||
class OaPersonalQuitLogic extends BaseLogic
|
||||
{
|
136
app/oa/validate/article/ArticleCateValidate.php
Normal file
136
app/oa/validate/article/ArticleCateValidate.php
Normal file
@ -0,0 +1,136 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\oa\validate\article;
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
use app\common\model\article\ArticleCate;
|
||||
use app\common\model\article\Article;
|
||||
|
||||
/**
|
||||
* 资讯分类管理验证
|
||||
* Class ArticleCateValidate
|
||||
* @package app\adminapi\validate\article
|
||||
*/
|
||||
class ArticleCateValidate extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'id' => 'require|checkArticleCate',
|
||||
'name' => 'require|length:1,90',
|
||||
'is_show' => 'require|in:0,1',
|
||||
'sort' => 'egt:0',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '资讯分类id不能为空',
|
||||
'name.require' => '资讯分类不能为空',
|
||||
'name.length' => '资讯分类长度须在1-90位字符',
|
||||
'sort.egt' => '排序值不正确',
|
||||
];
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return ArticleCateValidate
|
||||
* @author heshihu
|
||||
* @date 2022/2/10 15:11
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove(['id'])
|
||||
->remove('id', 'require|checkArticleCate');
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return ArticleCateValidate
|
||||
* @author heshihu
|
||||
* @date 2022/2/21 17:55
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 更改状态场景
|
||||
* @return ArticleCateValidate
|
||||
* @author heshihu
|
||||
* @date 2022/2/21 18:02
|
||||
*/
|
||||
public function sceneStatus()
|
||||
{
|
||||
return $this->only(['id', 'is_show']);
|
||||
}
|
||||
|
||||
public function sceneEdit()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取所有资讯分类场景
|
||||
* @return ArticleCateValidate
|
||||
* @author heshihu
|
||||
* @date 2022/2/15 10:05
|
||||
*/
|
||||
public function sceneSelect()
|
||||
{
|
||||
return $this->only(['type']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return ArticleCateValidate
|
||||
* @author heshihu
|
||||
* @date 2022/2/21 17:52
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id'])
|
||||
->append('id', 'checkDeleteArticleCate');
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 检查指定资讯分类是否存在
|
||||
* @param $value
|
||||
* @return bool|string
|
||||
* @author heshihu
|
||||
* @date 2022/2/10 15:10
|
||||
*/
|
||||
public function checkArticleCate($value)
|
||||
{
|
||||
$article_category = ArticleCate::findOrEmpty($value);
|
||||
if ($article_category->isEmpty()) {
|
||||
return '资讯分类不存在';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 删除时验证该资讯分类是否已使用
|
||||
* @param $value
|
||||
* @return bool|string
|
||||
* @author heshihu
|
||||
* @date 2022/2/22 14:45
|
||||
*/
|
||||
public function checkDeleteArticleCate($value)
|
||||
{
|
||||
$article = Article::where('cid', $value)->findOrEmpty();
|
||||
if (!$article->isEmpty()) {
|
||||
return '资讯分类已使用,请先删除绑定该资讯分类的资讯';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
108
app/oa/validate/article/ArticleValidate.php
Normal file
108
app/oa/validate/article/ArticleValidate.php
Normal file
@ -0,0 +1,108 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\oa\validate\article;
|
||||
|
||||
use app\common\model\article\Article;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
/**
|
||||
* 资讯管理验证
|
||||
* Class ArticleValidate
|
||||
* @package app\adminapi\validate\article
|
||||
*/
|
||||
class ArticleValidate extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'id' => 'require|checkArticle',
|
||||
'title' => 'require|length:1,255',
|
||||
// 'image' => 'require',
|
||||
'cid' => 'require',
|
||||
'is_show' => 'require|in:0,1',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'id.require' => '资讯id不能为空',
|
||||
'title.require' => '标题不能为空',
|
||||
'title.length' => '标题长度须在1-255位字符',
|
||||
// 'image.require' => '封面图必须存在',
|
||||
'cid.require' => '所属栏目必须存在',
|
||||
];
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return ArticleValidate
|
||||
* @author heshihu
|
||||
* @date 2022/2/22 9:57
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove(['id'])
|
||||
->remove('id', 'require|checkArticle');
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return ArticleValidate
|
||||
* @author heshihu
|
||||
* @date 2022/2/22 10:15
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 更改状态场景
|
||||
* @return ArticleValidate
|
||||
* @author heshihu
|
||||
* @date 2022/2/22 10:18
|
||||
*/
|
||||
public function sceneStatus()
|
||||
{
|
||||
return $this->only(['id', 'is_show']);
|
||||
}
|
||||
|
||||
public function sceneEdit()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return ArticleValidate
|
||||
* @author heshihu
|
||||
* @date 2022/2/22 10:17
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id'])->remove('id', 'checkData');
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 检查指定资讯是否存在
|
||||
* @param $value
|
||||
* @return bool|string
|
||||
* @author heshihu
|
||||
* @date 2022/2/22 10:11
|
||||
*/
|
||||
public function checkArticle($value)
|
||||
{
|
||||
$article = Article::findOrEmpty($value);
|
||||
if ($article->isEmpty()) {
|
||||
return '资讯不存在';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -12,7 +12,7 @@
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\oa\validate\works\rlzy;
|
||||
namespace app\oa\validate\works\hr;
|
||||
|
||||
|
||||
use app\common\model\auth\SystemRole;
|
||||
@ -26,7 +26,7 @@ use app\common\validate\BaseValidate;
|
||||
/**
|
||||
* 企业员工验证器
|
||||
* Class OaAdminValidate
|
||||
* @package app\adminapi\validate\works\rlzy
|
||||
* @package app\adminapi\validate\works\hr
|
||||
*/
|
||||
class OaAdminValidate extends BaseValidate
|
||||
{
|
@ -12,7 +12,7 @@
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\oa\validate\works\rlzy;
|
||||
namespace app\oa\validate\works\hr;
|
||||
|
||||
|
||||
use app\common\model\works\rlzy\OaDepartmentChange;
|
||||
@ -22,7 +22,7 @@ use app\common\validate\BaseValidate;
|
||||
/**
|
||||
* 人事调动验证器
|
||||
* Class OaDepartmentChangeValidate
|
||||
* @package app\adminapi\validate\works\rlzy
|
||||
* @package app\adminapi\validate\works\hr
|
||||
*/
|
||||
class OaDepartmentChangeValidate extends BaseValidate
|
||||
{
|
@ -12,7 +12,7 @@
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\oa\validate\works\rlzy;
|
||||
namespace app\oa\validate\works\hr;
|
||||
|
||||
|
||||
use app\common\model\works\rlzy\OaPersonalQuit;
|
||||
@ -22,7 +22,7 @@ use app\common\validate\BaseValidate;
|
||||
/**
|
||||
* 离职档案验证器
|
||||
* Class OaPersonalQuitValidate
|
||||
* @package app\adminapi\validate\works\rlzy
|
||||
* @package app\adminapi\validate\works\hr
|
||||
*/
|
||||
class OaPersonalQuitValidate extends BaseValidate
|
||||
{
|
@ -35,4 +35,16 @@ return [
|
||||
app\api\http\middleware\LoginMiddleware::class,
|
||||
|
||||
],
|
||||
'oa' => [
|
||||
// 跨域中间件
|
||||
app\common\http\middleware\AdminAllowMiddleware::class,
|
||||
// 初始化
|
||||
app\admin\middleware\InitMiddleware::class,
|
||||
// 登录验证
|
||||
app\admin\middleware\LoginMiddleware::class,
|
||||
// 权限认证
|
||||
app\admin\middleware\AuthMiddleware::class,
|
||||
// 操作日志记录
|
||||
app\admin\middleware\OperationLogMiddleware::class,
|
||||
],
|
||||
];
|
||||
|
Loading…
x
Reference in New Issue
Block a user