2023-08-07 09:36:32 +08:00
|
|
|
|
<?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\adminapi\controller\task_template;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use app\adminapi\controller\BaseAdminController;
|
|
|
|
|
use app\adminapi\lists\task_template\TaskTemplateLists;
|
2023-10-24 11:23:20 +08:00
|
|
|
|
use app\common\logic\ShopRequestLogic;
|
2023-08-07 09:36:32 +08:00
|
|
|
|
use app\common\logic\task_template\TaskTemplateLogic;
|
|
|
|
|
use app\adminapi\validate\task_template\TaskTemplateValidate;
|
2023-09-19 18:37:58 +08:00
|
|
|
|
use app\common\model\Company;
|
2023-08-07 09:36:32 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 任务模板控制器
|
|
|
|
|
* Class TaskTemplateController
|
|
|
|
|
* @package app\adminapi\controller\task_template
|
|
|
|
|
*/
|
|
|
|
|
class TaskTemplateController extends BaseAdminController
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @notes 获取任务模板列表
|
|
|
|
|
* @return \think\response\Json
|
|
|
|
|
* @author likeadmin
|
|
|
|
|
* @date 2023/08/06 17:30
|
|
|
|
|
*/
|
|
|
|
|
public function lists()
|
|
|
|
|
{
|
|
|
|
|
return $this->dataLists(new TaskTemplateLists());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @notes 添加任务模板
|
|
|
|
|
* @return \think\response\Json
|
|
|
|
|
* @author likeadmin
|
|
|
|
|
* @date 2023/08/06 17:30
|
|
|
|
|
*/
|
|
|
|
|
public function add()
|
|
|
|
|
{
|
|
|
|
|
$params = (new TaskTemplateValidate())->post()->goCheck('add');
|
|
|
|
|
$params['admin_id'] = $this->adminId;
|
2023-09-20 10:01:50 +08:00
|
|
|
|
$company = Company::find($params['company_id']);
|
|
|
|
|
if ($company->company_type == 41) {
|
2023-09-25 19:11:50 +08:00
|
|
|
|
// 创建 镇农科公司 任务模板
|
2023-09-20 10:01:50 +08:00
|
|
|
|
$result = TaskTemplateLogic::addTownTaskTemplate($params);
|
2023-10-19 10:49:03 +08:00
|
|
|
|
} else if ($company->company_type == 17) {
|
|
|
|
|
$result = TaskTemplateLogic::addVillageTaskTemplate($params);
|
2023-09-20 10:01:50 +08:00
|
|
|
|
} else {
|
|
|
|
|
$result = TaskTemplateLogic::add($params);
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-07 09:36:32 +08:00
|
|
|
|
if (true === $result) {
|
2023-09-19 18:37:58 +08:00
|
|
|
|
/**
|
|
|
|
|
* 如果是公司第一次创建安排任务,则初始化公司的提现周期截止时间
|
|
|
|
|
*/
|
|
|
|
|
TaskTemplateLogic::initCompanyWithdrawDeadline($params['company_id']);
|
2023-08-07 09:36:32 +08:00
|
|
|
|
return $this->success('添加成功', [], 1, 1);
|
|
|
|
|
}
|
|
|
|
|
return $this->fail(TaskTemplateLogic::getError());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @notes 编辑任务模板
|
|
|
|
|
* @return \think\response\Json
|
|
|
|
|
* @author likeadmin
|
|
|
|
|
* @date 2023/08/06 17:30
|
|
|
|
|
*/
|
|
|
|
|
public function edit()
|
|
|
|
|
{
|
|
|
|
|
$params = (new TaskTemplateValidate())->post()->goCheck('edit');
|
|
|
|
|
$result = TaskTemplateLogic::edit($params);
|
|
|
|
|
if (true === $result) {
|
|
|
|
|
return $this->success('编辑成功', [], 1, 1);
|
|
|
|
|
}
|
|
|
|
|
return $this->fail(TaskTemplateLogic::getError());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @notes 删除任务模板
|
|
|
|
|
* @return \think\response\Json
|
|
|
|
|
* @author likeadmin
|
|
|
|
|
* @date 2023/08/06 17:30
|
|
|
|
|
*/
|
|
|
|
|
public function delete()
|
|
|
|
|
{
|
|
|
|
|
$params = (new TaskTemplateValidate())->post()->goCheck('delete');
|
|
|
|
|
TaskTemplateLogic::delete($params);
|
|
|
|
|
return $this->success('删除成功', [], 1, 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @notes 获取任务模板详情
|
|
|
|
|
* @return \think\response\Json
|
|
|
|
|
* @author likeadmin
|
|
|
|
|
* @date 2023/08/06 17:30
|
|
|
|
|
*/
|
|
|
|
|
public function detail()
|
|
|
|
|
{
|
|
|
|
|
$params = (new TaskTemplateValidate())->goCheck('detail');
|
|
|
|
|
$result = TaskTemplateLogic::detail($params);
|
|
|
|
|
return $this->data($result);
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-24 11:23:20 +08:00
|
|
|
|
public function getProductList()
|
|
|
|
|
{
|
|
|
|
|
$param = $this->request->param(); // page keyword
|
|
|
|
|
$p['page'] = $param['page_no'] ?? 1;
|
2023-11-10 11:45:36 +08:00
|
|
|
|
$p['keyword'] = $param['keyword'] ??'';
|
2023-10-24 13:43:35 +08:00
|
|
|
|
$result = ShopRequestLogic::getProductList($p);;
|
2023-11-10 11:42:32 +08:00
|
|
|
|
// $result['data']['count'] = 1000;
|
2023-10-24 13:43:35 +08:00
|
|
|
|
$data = [
|
|
|
|
|
'lists' => $result['data']['data'],
|
|
|
|
|
'count' => $result['data']['count'],
|
|
|
|
|
'page_no' => $result['data']['page'],
|
|
|
|
|
'page_size' => 10,
|
|
|
|
|
];
|
|
|
|
|
return $this->data($data);
|
2023-10-24 11:23:20 +08:00
|
|
|
|
}
|
2023-08-07 09:36:32 +08:00
|
|
|
|
}
|