1、增加任务开始时间配置 2、增加新任务默认开启隐私模式配置

Signed-off-by: vilson <545522390@qq.com>
This commit is contained in:
vilson 2019-06-14 18:05:42 +08:00
parent e727d5fcc7
commit 33d4d12b08
6 changed files with 51 additions and 31 deletions

View File

@ -28,7 +28,7 @@ class Task extends CommonModel
if (!$task) {
throw new \Exception('该任务已失效', 404);
}
$project = Project::where(['code' => $task['project_code']])->field('name')->find();
$project = Project::where(['code' => $task['project_code']])->field('name,open_begin_time')->find();
$stage = TaskStages::where(['code' => $task['stage_code']])->field('name')->find();
$task['executor'] = null;
if ($task['assign_to']) {
@ -48,6 +48,7 @@ class Task extends CommonModel
}
$task['parentTasks'] = array_reverse($parents);
}
$task['openBeginTime'] = $project['open_begin_time'];
$task['projectName'] = $project['name'];
$task['stageName'] = $stage['name'];
//TODO 查看权限
@ -83,6 +84,7 @@ class Task extends CommonModel
public function edit($code, $data)
{
if (!$code) {
throw new \Exception('请选择任务', 1);
}
@ -215,9 +217,9 @@ class Task extends CommonModel
if (!$stage) {
throw new \Exception('该任务列表无效', 2);
}
$project = Project::where(['code' => $projectCode, 'deleted' => 0])->field('id')->find();
$project = Project::where(['code' => $projectCode, 'deleted' => 0])->field('id,open_task_private')->find();
if (!$project) {
throw new \Exception('该任务已失效', 3);
throw new \Exception('该项目已失效', 3);
}
if ($parentCode) {
$parentTask = self::where(['code' => $parentCode])->find();
@ -264,6 +266,7 @@ class Task extends CommonModel
'pcode' => $parentCode,
'path' => $path,
'stage_code' => $stageCode,
'private' => $project['open_task_private'] ? 1 : 0,
'name' => trim($taskTitle),
];
$result = self::create($data);

View File

@ -9,22 +9,35 @@ use app\common\Model\Notify;
use app\common\Model\SourceLink;
use app\common\Model\SystemConfig;
use controller\BasicApi;
use Exception;
use OSS\Core\OssException;
use service\FileService;
use service\NodeService;
use think\db\exception\DataNotFoundException;
use think\db\exception\ModelNotFoundException;
use think\Exception\DbException;
use think\exception\PDOException;
use think\facade\Request;
use think\File;
/**
* 应用入口控制器
* @title 项目管理
* @description 接口说明
* @group 接口分组
*/
class Index extends BasicApi
{
/**
* 后台框架布局
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @title 用户菜单
* @description 获取用户菜单列表
* @author PearProject
* @url /project/index
* @method GET
* @return void :名称
* @throws DataNotFoundException
* @throws ModelNotFoundException
* @throws DbException
*/
public function index()
{
@ -34,9 +47,9 @@ class Index extends BasicApi
/**
* 更换当前组织
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws DataNotFoundException
* @throws ModelNotFoundException
* @throws DbException
*/
public function changeCurrentOrganization()
{
@ -71,9 +84,9 @@ class Index extends BasicApi
/**
* 个人个信息
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws DataNotFoundException
* @throws ModelNotFoundException
* @throws DbException
*/
public function info()
{
@ -98,7 +111,7 @@ class Index extends BasicApi
/**
* 密码修改
* @return array|string
* @throws \think\Exception\DbException
* @throws DbException
*/
public function editPassword()
{
@ -124,9 +137,9 @@ class Index extends BasicApi
/**
* @return void
* @throws \OSS\Core\OssException
* @throws OssException
* @throws \think\Exception
* @throws \think\exception\PDOException
* @throws PDOException
*/
public function uploadImg()
{
@ -154,7 +167,7 @@ class Index extends BasicApi
$accountModel = new MemberAccount();
try {
$file = $accountModel->uploadImg(Request::file('avatar'));
} catch (\Exception $e) {
} catch (Exception $e) {
$this->error($e->getMessage(), $e->getCode());;
}
$this->success('', $file);

View File

@ -3,8 +3,10 @@
namespace app\project\controller;
use app\common\Model\Member;
use app\common\Model\MemberAccount;
use app\common\Model\Organization;
use controller\BasicApi;
use Exception;
use service\JwtService;
use service\LogService;
use service\NodeService;
@ -15,6 +17,7 @@ use think\Db;
use think\db\exception\DataNotFoundException;
use think\db\exception\ModelNotFoundException;
use think\exception\DbException;
use think\exception\PDOException;
use think\facade\Hook;
use think\facade\Log;
use think\facade\Request;
@ -47,7 +50,7 @@ class Login extends BasicApi
* @throws DbException
* @throws ModelNotFoundException
* @throws \think\Exception
* @throws \think\exception\PDOException
* @throws PDOException
*/
public function index()
{
@ -79,9 +82,9 @@ class Login extends BasicApi
if (cache('captchaMobile') != $mobile) {
$this->error('手机号与验证码不匹配', 203);
}
$member = \app\common\Model\Member::where(['mobile' => $mobile])->order('id asc')->find();
$member = Member::where(['mobile' => $mobile])->order('id asc')->find();
} else {
$member = \app\common\Model\Member::where(['account' => $data['account']])->whereOr(['email' => $data['account']])->order('id asc')->find();
$member = Member::where(['account' => $data['account']])->whereOr(['email' => $data['account']])->order('id asc')->find();
}
empty($member) && $this->error('账号或密码错误', 201);
$member = $member->toArray();
@ -93,7 +96,7 @@ class Login extends BasicApi
Db::name('Member')->where(['id' => $member['id']])->update([
'last_login_time' => Db::raw('now()'),
]);
$list = \app\common\Model\MemberAccount::where(['member_code' => $member['code']])->order('id asc')->select()->toArray();
$list = MemberAccount::where(['member_code' => $member['code']])->order('id asc')->select()->toArray();
$organizationList = [];
if ($list) {
foreach ($list as $item) {
@ -192,7 +195,7 @@ class Login extends BasicApi
];
try {
$result = Member::createMember($memberData);
} catch (\Exception $e) {
} catch (Exception $e) {
$this->error($e->getMessage(), 205);
}
if (!$result) {
@ -272,7 +275,7 @@ class Login extends BasicApi
<a href="' . $link . '">' . $link . '</a>
';
$mail->send();
} catch (\Exception $e) {
} catch (Exception $e) {
ob_clean();
$this->error('发送失败 ');
}

View File

@ -118,6 +118,9 @@ class Project extends BasicApi
} else {
$member = Member::where(['code' => $memberCode])->find();
}
if (!$member) {
$this->error("参数有误");
}
$deleted = 1;
if (!$type) {
$deleted = 0;
@ -210,7 +213,7 @@ class Project extends BasicApi
*/
public function edit(Request $request)
{
$data = $request::only('name,description,cover,private,prefix,open_prefix,schedule');
$data = $request::only('name,description,cover,private,prefix,open_prefix,schedule,open_begin_time,open_task_private');
$code = $request::param('projectCode');
try {
$result = $this->model->edit($code, $data);

View File

@ -145,10 +145,8 @@ class Task extends BasicApi
if ($parentTask['deleted']) {
throw new \Exception('父任务在回收站中无法编辑', 6);
}
$result = $this->model->createTask($parentTask['stage_code'], $parentTask['project_code'], $data['name'], $member['code'], $data['assign_to'], $data['pcode']);
} else {
$result = $this->model->createTask($data['stage_code'], $data['project_code'], $data['name'], $member['code'], $data['assign_to']);
}
$result = $this->model->createTask($data['stage_code'], $data['project_code'], $data['name'], $member['code'], $data['assign_to'], $data['pcode']);
} catch (\Exception $e) {
$this->error($e->getMessage(), $e->getCode());;
}
@ -268,7 +266,7 @@ class Task extends BasicApi
*/
public function edit(Request $request)
{
$data = $request::only('name,sort,end_time,pri,description');
$data = $request::only('name,sort,end_time,begin_time,pri,description');
$code = $request::post('taskCode');
if (!$code) {
$this->error("请选择一个任务");

View File

@ -69,7 +69,7 @@ class ToolsService
*/
public static function success($msg, $data = [], $code = 1)
{
$result = ['code' => $code, 'msg' => $msg, 'data' => $data, 'token' => encode(session_name() . '=' . session_id())];
$result = ['code' => $code, 'msg' => $msg, 'data' => $data];
throw new HttpResponseException(Response::create($result, 'json', 200, self::corsRequestHander()));
}
@ -81,7 +81,7 @@ class ToolsService
*/
public static function error($msg, $data = [], $code = 0)
{
$result = ['code' => $code, 'msg' => $msg, 'data' => $data, 'token' => encode(session_name() . '=' . session_id())];
$result = ['code' => $code, 'msg' => $msg, 'data' => $data];
throw new HttpResponseException(Response::create($result, 'json', $code, self::corsRequestHander()));
}