add 任务创建模板管理

This commit is contained in:
chenbo 2023-12-18 14:52:57 +08:00
parent 55512fc40f
commit 15eeb531d4
5 changed files with 38 additions and 36 deletions

View File

@ -13,19 +13,19 @@
// +----------------------------------------------------------------------
namespace app\adminapi\controller;
namespace app\adminapi\controller\create_task_template;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\CreateTaskTemplateLists;
use app\adminapi\logic\CreateTaskTemplateLogic;
use app\adminapi\validate\CreateTaskTemplateValidate;
use app\adminapi\lists\create_task_template\CreateTaskTemplateLists;
use app\adminapi\logic\create_task_template\CreateTaskTemplateLogic;
use app\adminapi\validate\create_task_template\CreateTaskTemplateValidate;
/**
* CreateTaskTemplate控制器
* Class CreateTaskTemplateController
* @package app\adminapi\controller
* @package app\adminapi\controller\create_task_template
*/
class CreateTaskTemplateController extends BaseAdminController
{
@ -35,7 +35,7 @@ class CreateTaskTemplateController extends BaseAdminController
* @notes 获取列表
* @return \think\response\Json
* @author likeadmin
* @date 2023/12/18 14:06
* @date 2023/12/18 14:50
*/
public function lists()
{
@ -47,7 +47,7 @@ class CreateTaskTemplateController extends BaseAdminController
* @notes 添加
* @return \think\response\Json
* @author likeadmin
* @date 2023/12/18 14:06
* @date 2023/12/18 14:50
*/
public function add()
{
@ -64,7 +64,7 @@ class CreateTaskTemplateController extends BaseAdminController
* @notes 编辑
* @return \think\response\Json
* @author likeadmin
* @date 2023/12/18 14:06
* @date 2023/12/18 14:50
*/
public function edit()
{
@ -81,7 +81,7 @@ class CreateTaskTemplateController extends BaseAdminController
* @notes 删除
* @return \think\response\Json
* @author likeadmin
* @date 2023/12/18 14:06
* @date 2023/12/18 14:50
*/
public function delete()
{
@ -95,7 +95,7 @@ class CreateTaskTemplateController extends BaseAdminController
* @notes 获取详情
* @return \think\response\Json
* @author likeadmin
* @date 2023/12/18 14:06
* @date 2023/12/18 14:50
*/
public function detail()
{

View File

@ -12,18 +12,18 @@
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\lists;
namespace app\adminapi\lists\create_task_template;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\CreateTaskTemplate;
use app\common\model\create_task_template\CreateTaskTemplate;
use app\common\lists\ListsSearchInterface;
/**
* CreateTaskTemplate列表
* Class CreateTaskTemplateLists
* @package app\adminapi\lists
* @package app\adminapi\listscreate_task_template
*/
class CreateTaskTemplateLists extends BaseAdminDataLists implements ListsSearchInterface
{
@ -33,12 +33,12 @@ class CreateTaskTemplateLists extends BaseAdminDataLists implements ListsSearchI
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2023/12/18 14:06
* @date 2023/12/18 14:50
*/
public function setSearch(): array
{
return [
'=' => ['title', 'admin_id', 'task_role_id', 'type', 'stage_day_one', 'money', 'proportion_one', 'stage_day_two', 'proportion_two', 'money_two', 'stage_day_three', 'new_money_three', 'money_longtime', 'types', 'extend', 'recharge', 'content'],
'=' => ['title', 'task_role_id', 'type'],
];
}
@ -50,12 +50,12 @@ class CreateTaskTemplateLists extends BaseAdminDataLists implements ListsSearchI
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2023/12/18 14:06
* @date 2023/12/18 14:50
*/
public function lists(): array
{
return CreateTaskTemplate::where($this->searchWhere)
->field(['id', 'title', 'admin_id', 'task_role_id', 'type', 'stage_day_one', 'money', 'proportion_one', 'stage_day_two', 'proportion_two', 'money_two', 'stage_day_three', 'new_money_three', 'money_longtime', 'types', 'extend', 'recharge', 'content', 'delete_time'])
->field(['id', 'title', 'admin_id', 'task_role_id', 'type', 'stage_day_one', 'money', 'proportion_one', 'stage_day_two', 'proportion_two', 'money_two', 'stage_day_three', 'new_money_three', 'money_longtime', 'types', 'extend', 'recharge', 'content'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
@ -67,7 +67,7 @@ class CreateTaskTemplateLists extends BaseAdminDataLists implements ListsSearchI
* @notes 获取数量
* @return int
* @author likeadmin
* @date 2023/12/18 14:06
* @date 2023/12/18 14:50
*/
public function count(): int
{

View File

@ -12,10 +12,10 @@
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\logic;
namespace app\adminapi\logic\create_task_template;
use app\common\model\CreateTaskTemplate;
use app\common\model\create_task_template\CreateTaskTemplate;
use app\common\logic\BaseLogic;
use think\facade\Db;
@ -23,7 +23,7 @@ use think\facade\Db;
/**
* CreateTaskTemplate逻辑
* Class CreateTaskTemplateLogic
* @package app\adminapi\logic
* @package app\adminapi\logic\create_task_template
*/
class CreateTaskTemplateLogic extends BaseLogic
{
@ -34,7 +34,7 @@ class CreateTaskTemplateLogic extends BaseLogic
* @param array $params
* @return bool
* @author likeadmin
* @date 2023/12/18 14:06
* @date 2023/12/18 14:50
*/
public static function add(array $params): bool
{
@ -42,6 +42,7 @@ class CreateTaskTemplateLogic extends BaseLogic
try {
CreateTaskTemplate::create([
'title' => $params['title'],
'admin_id' => $params['admin_id'],
'task_role_id' => $params['task_role_id'],
'type' => $params['type'],
'stage_day_one' => $params['stage_day_one'],
@ -74,7 +75,7 @@ class CreateTaskTemplateLogic extends BaseLogic
* @param array $params
* @return bool
* @author likeadmin
* @date 2023/12/18 14:06
* @date 2023/12/18 14:50
*/
public static function edit(array $params): bool
{
@ -82,6 +83,7 @@ class CreateTaskTemplateLogic extends BaseLogic
try {
CreateTaskTemplate::where('id', $params['id'])->update([
'title' => $params['title'],
'admin_id' => $params['admin_id'],
'task_role_id' => $params['task_role_id'],
'type' => $params['type'],
'stage_day_one' => $params['stage_day_one'],
@ -114,7 +116,7 @@ class CreateTaskTemplateLogic extends BaseLogic
* @param array $params
* @return bool
* @author likeadmin
* @date 2023/12/18 14:06
* @date 2023/12/18 14:50
*/
public static function delete(array $params): bool
{
@ -127,7 +129,7 @@ class CreateTaskTemplateLogic extends BaseLogic
* @param $params
* @return array
* @author likeadmin
* @date 2023/12/18 14:06
* @date 2023/12/18 14:50
*/
public static function detail($params): array
{

View File

@ -12,7 +12,7 @@
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\validate;
namespace app\adminapi\validate\create_task_template;
use app\common\validate\BaseValidate;
@ -21,7 +21,7 @@ use app\common\validate\BaseValidate;
/**
* CreateTaskTemplate验证器
* Class CreateTaskTemplateValidate
* @package app\adminapi\validate
* @package app\adminapi\validate\create_task_template
*/
class CreateTaskTemplateValidate extends BaseValidate
{
@ -48,7 +48,7 @@ class CreateTaskTemplateValidate extends BaseValidate
* @notes 添加场景
* @return CreateTaskTemplateValidate
* @author likeadmin
* @date 2023/12/18 14:06
* @date 2023/12/18 14:50
*/
public function sceneAdd()
{
@ -60,7 +60,7 @@ class CreateTaskTemplateValidate extends BaseValidate
* @notes 编辑场景
* @return CreateTaskTemplateValidate
* @author likeadmin
* @date 2023/12/18 14:06
* @date 2023/12/18 14:50
*/
public function sceneEdit()
{
@ -72,7 +72,7 @@ class CreateTaskTemplateValidate extends BaseValidate
* @notes 删除场景
* @return CreateTaskTemplateValidate
* @author likeadmin
* @date 2023/12/18 14:06
* @date 2023/12/18 14:50
*/
public function sceneDelete()
{
@ -84,7 +84,7 @@ class CreateTaskTemplateValidate extends BaseValidate
* @notes 详情场景
* @return CreateTaskTemplateValidate
* @author likeadmin
* @date 2023/12/18 14:06
* @date 2023/12/18 14:50
*/
public function sceneDetail()
{

View File

@ -12,23 +12,23 @@
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model;
namespace app\common\model\create_task_template;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* CreateTaskTemplate模型
* Class CreateTaskTemplate
* @package app\common\model
* @package app\common\model\create_task_template
*/
class CreateTaskTemplate extends BaseModel
{
use SoftDelete;
protected $name = 'create_task_template';
protected $deleteTime = 'delete_time';
}