first commit
This commit is contained in:
@@ -0,0 +1,173 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2023-2024 美天智能科技
|
||||
* @author 李志强
|
||||
* @link http://www.meteteme.com
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\api;
|
||||
|
||||
use think\App;
|
||||
use think\exception\HttpResponseException;
|
||||
use think\facade\Request;
|
||||
use think\facade\Session;
|
||||
use think\facade\View;
|
||||
use think\Response;
|
||||
|
||||
/**
|
||||
* 控制器基础类
|
||||
*/
|
||||
abstract class BaseController
|
||||
{
|
||||
/**
|
||||
* Request实例
|
||||
* @var \think\Request
|
||||
*/
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
* 应用实例
|
||||
* @var \think\App
|
||||
*/
|
||||
protected $app;
|
||||
|
||||
/**
|
||||
* 是否批量验证
|
||||
* @var bool
|
||||
*/
|
||||
protected $batchValidate = false;
|
||||
|
||||
/**
|
||||
* 控制器中间件
|
||||
* @var array
|
||||
*/
|
||||
protected $middleware = [];
|
||||
|
||||
/**
|
||||
* 分页数量
|
||||
* @var string
|
||||
*/
|
||||
protected $pageSize = '';
|
||||
|
||||
/**
|
||||
* 无需登录验证的接口
|
||||
* @var array
|
||||
*/
|
||||
protected $noNeedLogin = ['bifill'];
|
||||
|
||||
/**
|
||||
* 构造方法
|
||||
* @access public
|
||||
* @param App $app 应用对象
|
||||
*/
|
||||
public function __construct(App $app)
|
||||
{
|
||||
$this->app = $app;
|
||||
$this->request = $this->app->request;
|
||||
$this->module = strtolower(app('http')->getName());
|
||||
$this->controller = strtolower($this->request->controller());
|
||||
$this->action = strtolower($this->request->action());
|
||||
$this->uid = 0;
|
||||
|
||||
// 控制器初始化
|
||||
$this->initialize();
|
||||
}
|
||||
|
||||
// 初始化
|
||||
protected function initialize()
|
||||
{
|
||||
// 调用 Auth 中间件
|
||||
$this->app->middleware->add(\app\api\middleware\Auth::class);
|
||||
// 检测权限
|
||||
$this->checkLogin();
|
||||
// 每页显示数据量
|
||||
$this->pageSize = Request::param('page_size', \think\facade\Config::get('app.page_size'));
|
||||
// 显示当前登录账户权限
|
||||
// $this->showLoginUserInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示当前登录账户信息
|
||||
*/
|
||||
protected function showLoginUserInfo()
|
||||
{
|
||||
$session_admin = get_config('app.session_admin');
|
||||
if (Session::has($session_admin)) {
|
||||
$loginUser = Session::get($session_admin);
|
||||
// 输出当前登录账户信息
|
||||
// echo '当前登录账户信息:' . $loginUser['username'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证用户登录
|
||||
*/
|
||||
protected function checkLogin()
|
||||
{
|
||||
// 检查当前方法是否在无需登录列表中
|
||||
if (in_array($this->action, $this->noNeedLogin)) {
|
||||
return; // 跳过登录验证
|
||||
}
|
||||
|
||||
$session_admin = get_config('app.session_admin');
|
||||
if (!Session::has($session_admin)) {
|
||||
$this->apiError('请先登录');
|
||||
} else {
|
||||
$this->uid = Session::get($session_admin)['id'];
|
||||
View::assign('login_user', $this->uid);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Api处理成功结果返回方法
|
||||
* @param $message
|
||||
* @param null $redirect
|
||||
* @param null $extra
|
||||
* @return mixed
|
||||
* @throws ReturnException
|
||||
*/
|
||||
protected function apiSuccess($msg = 'success', $data = [])
|
||||
{
|
||||
return $this->apiReturn($data, 0, $msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Api处理结果失败返回方法
|
||||
* @param $error_code
|
||||
* @param $message
|
||||
* @param null $redirect
|
||||
* @param null $extra
|
||||
* @return mixed
|
||||
* @throws ReturnException
|
||||
*/
|
||||
protected function apiError($msg = 'fail', $data = [], $code = 1)
|
||||
{
|
||||
return $this->apiReturn($data, $code, $msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回封装后的API数据到客户端
|
||||
* @param mixed $data 要返回的数据
|
||||
* @param integer $code 返回的code
|
||||
* @param mixed $msg 提示信息
|
||||
* @param string $type 返回数据格式
|
||||
* @param array $header 发送的Header信息
|
||||
* @return Response
|
||||
*/
|
||||
protected function apiReturn($data, int $code = 0, $msg = '', string $type = '', array $header = []): Response
|
||||
{
|
||||
$result = [
|
||||
'code' => $code,
|
||||
'msg' => $msg,
|
||||
'time' => time(),
|
||||
'data' => $data,
|
||||
];
|
||||
|
||||
$type = $type ?: 'json';
|
||||
$response = Response::create($result, $type)->header($header);
|
||||
|
||||
throw new HttpResponseException($response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2023-2024 美天智能科技
|
||||
* @author 李志强
|
||||
* @link http://www.meteteme.com
|
||||
*/
|
||||
@@ -0,0 +1,183 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2023-2024 美天智能科技
|
||||
* @author 李志强
|
||||
* @link http://www.meteteme.com
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\api\BaseController;
|
||||
use think\facade\Db;
|
||||
|
||||
class Appendix extends BaseController
|
||||
{
|
||||
//添加修改
|
||||
public function add()
|
||||
{
|
||||
$param = get_params();
|
||||
$param['create_time'] = time();
|
||||
$param['admin_id'] = $this->uid;
|
||||
$fid = Db::name('FileInterfix')->strict(false)->field(true)->insertGetId($param);
|
||||
if ($fid) {
|
||||
$log_data = array(
|
||||
'module' => $param['module'],
|
||||
'field' => 'file',
|
||||
'action' => 'upload',
|
||||
$param['module'] . '_id' => $param['topic_id'],
|
||||
'admin_id' => $this->uid,
|
||||
'old_content' => '',
|
||||
'new_content' => $param['file_name'],
|
||||
'create_time' => time(),
|
||||
);
|
||||
Db::name('Log')->strict(false)->field(true)->insert($log_data);
|
||||
return to_assign(0, '', $fid);
|
||||
}
|
||||
}
|
||||
|
||||
//删除
|
||||
public function delete()
|
||||
{
|
||||
if (request()->isDelete()) {
|
||||
$id = get_params("id");
|
||||
$detail = Db::name('FileInterfix')->where('id', $id)->find();
|
||||
if (Db::name('FileInterfix')->where('id', $id)->delete() !== false) {
|
||||
$file_name = Db::name('File')->where('id', $detail['file_id'])->value('name');
|
||||
$log_data = array(
|
||||
'module' => $detail['module'],
|
||||
'field' => 'file',
|
||||
'action' => 'delete',
|
||||
$detail['module'] . '_id' => $detail['topic_id'],
|
||||
'admin_id' => $this->uid,
|
||||
'new_content' => $file_name,
|
||||
'create_time' => time(),
|
||||
);
|
||||
Db::name('Log')->strict(false)->field(true)->insert($log_data);
|
||||
return to_assign(0, "删除成功");
|
||||
} else {
|
||||
return to_assign(0, "删除失败");
|
||||
}
|
||||
} else {
|
||||
return to_assign(1, "错误的请求");
|
||||
}
|
||||
}
|
||||
|
||||
//链接添加修改
|
||||
public function add_link()
|
||||
{
|
||||
$param = get_params();
|
||||
$validate = \think\facade\Validate::rule([
|
||||
'url' => 'url',
|
||||
]);
|
||||
if (!$validate->check($param)) {
|
||||
return to_assign(1, $validate->getError());
|
||||
}
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
$param['update_time'] = time();
|
||||
$res = Db::name('LinkInterfix')->where('id', $param['id'])->strict(false)->field(true)->update($param);
|
||||
if ($res) {
|
||||
$log_data = array(
|
||||
'module' => $param['module'],
|
||||
'field' => 'link',
|
||||
'action' => 'edit',
|
||||
$param['module'] . '_id' => $param['topic_id'],
|
||||
'admin_id' => $this->uid,
|
||||
'old_content' => $param['url'],
|
||||
'new_content' => $param['desc'],
|
||||
'create_time' => time(),
|
||||
);
|
||||
Db::name('Log')->strict(false)->field(true)->insert($log_data);
|
||||
return to_assign(0, '编辑成功');
|
||||
}
|
||||
} else {
|
||||
$param['create_time'] = time();
|
||||
$param['admin_id'] = $this->uid;
|
||||
$lid = Db::name('LinkInterfix')->strict(false)->field(true)->insertGetId($param);
|
||||
if ($lid) {
|
||||
$log_data = array(
|
||||
'module' => $param['module'],
|
||||
'field' => 'link',
|
||||
'action' => 'add',
|
||||
$param['module'] . '_id' => $param['topic_id'],
|
||||
'admin_id' => $this->uid,
|
||||
'new_content' => $param['desc'],
|
||||
'create_time' => time(),
|
||||
);
|
||||
Db::name('Log')->strict(false)->field(true)->insert($log_data);
|
||||
return to_assign(0, '添加成功', $lid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//删除
|
||||
public function delete_link()
|
||||
{
|
||||
if (request()->isDelete()) {
|
||||
$id = get_params("id");
|
||||
$detail = Db::name('LinkInterfix')->where('id', $id)->find();
|
||||
if (Db::name('LinkInterfix')->where('id', $id)->update(['delete_time' => time()]) !== false) {
|
||||
$log_data = array(
|
||||
'module' => $detail['module'],
|
||||
'field' => 'link',
|
||||
'action' => 'delete',
|
||||
$detail['module'] . '_id' => $detail['topic_id'],
|
||||
'admin_id' => $this->uid,
|
||||
'new_content' => $detail['desc'],
|
||||
'create_time' => time(),
|
||||
);
|
||||
Db::name('Log')->strict(false)->field(true)->insert($log_data);
|
||||
return to_assign(0, "删除成功");
|
||||
} else {
|
||||
return to_assign(0, "删除失败");
|
||||
}
|
||||
} else {
|
||||
return to_assign(1, "错误的请求");
|
||||
}
|
||||
}
|
||||
|
||||
//添加联系人
|
||||
public function add_contact()
|
||||
{
|
||||
$param = get_params();
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
$param['update_time'] = time();
|
||||
$res = BusinessContact::where(['admin_id' => $this->uid, 'id' => $param['id']])->strict(false)->field(true)->update($param);
|
||||
if ($res) {
|
||||
add_log('edit', $param['id'], $param);
|
||||
return to_assign();
|
||||
}
|
||||
} else {
|
||||
$param['create_time'] = time();
|
||||
$param['admin_id'] = $this->uid;
|
||||
$cid = BusinessContact::strict(false)->field(true)->insertGetId($param);
|
||||
if ($cid) {
|
||||
add_log('add', $cid, $param);
|
||||
//sendMessage($users,1,['title'=>$param['title'],'action_id'=>$sid]);
|
||||
return to_assign();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//删除联系人
|
||||
public function delete_contact()
|
||||
{
|
||||
if (request()->isDelete()) {
|
||||
$id = get_params("id");
|
||||
$detail = Businesscontact::where(['admin_id' => $this->uid, 'id' => $id])->find();
|
||||
if (Businesscontact::where(['admin_id' => $this->uid, 'id' => $id])->update(['delete_time' => time()]) !== false) {
|
||||
add_log('delete', $id, $detail);
|
||||
return to_assign(0, "删除成功");
|
||||
} else {
|
||||
return to_assign(0, "删除失败");
|
||||
}
|
||||
} else {
|
||||
return to_assign(1, "错误的请求");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2023-2024 美天智能科技
|
||||
* @author 李志强
|
||||
* @link http://www.meteteme.com
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\api\BaseController;
|
||||
use think\facade\Db;
|
||||
|
||||
class Business extends BaseController
|
||||
{
|
||||
//添加联系人
|
||||
public function add_contact()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isPost()) {
|
||||
$has = Db::name('Businesscontact')->where(['contact' => $param['contact'], 'phone' => $param['phone'], 'business_id' => $param['business_id']])->find();
|
||||
if (!empty($has)) {
|
||||
to_assign(1, '该联系人已经存在');
|
||||
}
|
||||
$param['admin_id'] = $this->uid;
|
||||
$param['create_time'] = time();
|
||||
$res = Db::name('Businesscontact')->strict(false)->field(true)->insert($param);
|
||||
if ($res) {
|
||||
$log_data = array(
|
||||
'module' => 'businesscontact',
|
||||
'field' => 'contact',
|
||||
'action' => 'add',
|
||||
'admin_id' => $this->uid,
|
||||
'new_content' => $param['contact'],
|
||||
'create_time' => time(),
|
||||
);
|
||||
Db::name('Log')->strict(false)->field(true)->insert($log_data);
|
||||
return to_assign(0, "添加联系人成功!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//编辑联系人
|
||||
public function edit_contact()
|
||||
{
|
||||
$param = get_params();
|
||||
print_r($param);
|
||||
if (request()->isPost()) {
|
||||
$param['admin_id'] = $this->uid;
|
||||
$param['update_time'] = time();
|
||||
$res = Db::name('Businesscontact')->where('id', $param['id'])->strict(false)->field(true)->update($param);
|
||||
// $res = Db::name('Businesscontact')->where('id',$param['id'])->strict(false)->field(true)->update($param);
|
||||
if ($res) {
|
||||
$log_data = array(
|
||||
'module' => 'businesscontact',
|
||||
'field' => 'contact',
|
||||
'action' => 'edit',
|
||||
'admin_id' => $this->uid,
|
||||
'new_content' => $param['contact'],
|
||||
'update_time' => time(),
|
||||
);
|
||||
Db::name('Log')->strict(false)->field(true)->insert($log_data);
|
||||
return to_assign(0, "修改联系人成功!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//删除联系人
|
||||
public function delete_contact()
|
||||
{
|
||||
if (request()->isDelete()) {
|
||||
$id = get_params("id");
|
||||
$time = time();
|
||||
$module = 'Business';
|
||||
$detail = Db::name('Businesscontact')->where('id', $id)->find();
|
||||
if (Db::name('Businesscontact')->where('id', $id)->update(['delete_time' => $time]) !== false) {
|
||||
$log_data = array(
|
||||
'field' => 'contact',
|
||||
'action' => 'delete',
|
||||
'admin_id' => $this->uid,
|
||||
'new_content' => $detail['contact'],
|
||||
'create_time' => $time,
|
||||
'module' => $module,
|
||||
|
||||
);
|
||||
Db::name('Log')->strict(false)->field(true)->insert($log_data);
|
||||
return to_assign(0, "删除成功");
|
||||
} else {
|
||||
return to_assign(0, "删除失败");
|
||||
}
|
||||
} else {
|
||||
return to_assign(1, "错误的请求");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c)
|
||||
* @company 美天智能科技
|
||||
* @author 李志强
|
||||
* @link http://www.meteteme.com
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\api\BaseController;
|
||||
use think\facade\Db;
|
||||
|
||||
class BusinessInfo extends BaseController
|
||||
{
|
||||
//商机填写接口
|
||||
public function bifill()
|
||||
{
|
||||
// 允许来自kd.meteteme.top的跨域请求
|
||||
header('Access-Control-Allow-Origin: https://kd.meteteme.top');
|
||||
header('Access-Control-Allow-Origin: http://test1.mete.com/');
|
||||
header('Access-Control-Allow-Headers: Content-Type');
|
||||
|
||||
// 获取表单数据
|
||||
$name = isset($_POST['name']) ? $_POST['name'] : '';
|
||||
$email = isset($_POST['email']) ? $_POST['email'] : '';
|
||||
$phone = isset($_POST['phone']) ? $_POST['phone'] : '';
|
||||
$ip = isset($_POST['IP']) ? $_POST['IP'] : '';
|
||||
$message = isset($_POST['message']) ? $_POST['message'] : '';
|
||||
$product = isset($_POST['product']) ? $_POST['product'] : '';
|
||||
$company = isset($_POST['company']) ? $_POST['company'] : '';
|
||||
$create_time = time();
|
||||
|
||||
// 判断表单数据是否完整
|
||||
if ($name && $message && $product) {
|
||||
// 向数据库插入数据
|
||||
$result = Db::name('Information')->insert([
|
||||
'name' => $name,
|
||||
'email' => $email,
|
||||
'phone' => $phone,
|
||||
'ip' => $ip,
|
||||
'message' => $message,
|
||||
'product' => $product,
|
||||
'company' => $company,
|
||||
'create_time' => $create_time,
|
||||
]);
|
||||
|
||||
// 判断插入结果
|
||||
if ($result) {
|
||||
$webhook = 'https://oapi.dingtalk.com/robot/send?access_token=c39726abd36659f92442847430eda90bebb360c438270f7c05bea388f1c8168c';
|
||||
|
||||
$title = '**有新的商机生成!**';
|
||||
$line = '------------------------------';
|
||||
$companynames = '公司名称:' . $company;
|
||||
$names = '联 系 人 :' . $name;
|
||||
$contents = '请及时进入项管系统查看!';
|
||||
$times = '创建日期:' . date('Y-m-d H:i:s', $create_time);
|
||||
|
||||
$data = array(
|
||||
'msgtype' => 'actionCard',
|
||||
'actionCard' => array(
|
||||
'title' => $title,
|
||||
'text' => $title . "\n\n" . $companynames . "\n\n" . $names . "\n\n" . $times,
|
||||
'btnOrientation' => '0',
|
||||
'btns' => [
|
||||
[
|
||||
'title' => '查看商机',
|
||||
'actionURL' => 'dingtalk://dingtalkclient/page/link?url=' . urlencode('https://project.meteteme.com/business_info/index/index') . '&pc_slide=false'
|
||||
]
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
$options = array(
|
||||
'http' => array(
|
||||
'header' => "Content-type: application/json",
|
||||
'method' => 'POST',
|
||||
'content' => json_encode($data),
|
||||
)
|
||||
);
|
||||
|
||||
$context = stream_context_create($options);
|
||||
$result = file_get_contents($webhook, false, $context);
|
||||
|
||||
// return json(['code' => 0, 'msg' => '留言提交成功!']);
|
||||
return json([
|
||||
'code' => 0,
|
||||
'msg' => '留言提交成功!',
|
||||
'data' => [
|
||||
'name' => $name,
|
||||
'email' => $email,
|
||||
'phone' => $phone,
|
||||
'ip' => $ip,
|
||||
'message' => $message,
|
||||
'product' => $product,
|
||||
'company' => $company,
|
||||
'create_time' => date('Y-m-d H:i:s', $create_time)
|
||||
]
|
||||
]);
|
||||
} else {
|
||||
return json(['code' => 1, 'msg' => '留言提交失败!']);
|
||||
}
|
||||
} else {
|
||||
return json(['code' => 2, 'msg' => '请填写完整的表单数据!']);
|
||||
}
|
||||
}
|
||||
|
||||
//获取产品信息
|
||||
public function product_info()
|
||||
{
|
||||
// 查询Product表中的所有产品信息
|
||||
$products = Db::name('Product')->field('id, name')->select();
|
||||
|
||||
// 返回产品信息数组给前端,包括id和name
|
||||
return json(['code' => 0, 'msg' => '获取产品信息成功', 'data' => $products]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2023-2024 美天智能科技
|
||||
* @author 李志强
|
||||
* @link http://www.meteteme.com
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\api\BaseController;
|
||||
use app\model\Comment as CommentList;
|
||||
use app\model\Admin as AdminList;
|
||||
use think\facade\Db;
|
||||
use think\facade\Session;
|
||||
|
||||
class Comment extends BaseController
|
||||
{
|
||||
//获取评论列表
|
||||
public function get_list()
|
||||
{
|
||||
$param = get_params();
|
||||
$contents = CommentList::where(['topic_id' => $param['tid'], 'module' => $param['m']])->select();
|
||||
|
||||
// 获取所有admin_id
|
||||
$adminIds = array_unique(array_column($contents->toArray(), 'admin_id'));
|
||||
|
||||
// 查询Admin表获取名称
|
||||
$admins = AdminList::whereIn('id', $adminIds)->column('name', 'id');
|
||||
$thumb = AdminList::whereIn('id', $adminIds)->column('thumb', 'id');
|
||||
|
||||
// 加工数据,添加管理员名称
|
||||
foreach ($contents as $content) {
|
||||
$content['name'] = $admins[$content['admin_id']] ?? '未知';
|
||||
$content['thumb'] = $thumb[$content['admin_id']] ?? '未知';
|
||||
}
|
||||
|
||||
return to_assign(0, '', $contents);
|
||||
}
|
||||
|
||||
//添加修改评论内容
|
||||
public function add()
|
||||
{
|
||||
$param = get_params();
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
$param['update_time'] = time();
|
||||
$res = CommentList::where(['admin_id' => $this->uid, 'id' => $param['id']])->strict(false)->field(true)->update($param);
|
||||
if ($res) {
|
||||
add_log('edit', $param['id'], $param);
|
||||
return to_assign();
|
||||
}
|
||||
} else {
|
||||
$param['create_time'] = time();
|
||||
$param['admin_id'] = $this->uid;
|
||||
$cid = CommentList::strict(false)->field(true)->insertGetId($param);
|
||||
if ($cid) {
|
||||
add_log('add', $cid, $param);
|
||||
//sendMessage($users,1,['title'=>$param['title'],'action_id'=>$sid]);
|
||||
return to_assign();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//删除
|
||||
public function delete()
|
||||
{
|
||||
if (request()->isDelete()) {
|
||||
$id = get_params("id");
|
||||
$res = CommentList::where('id', $id)->strict(false)->field(true)->update(['delete_time' => time()]);
|
||||
if ($res) {
|
||||
add_log('delete', $id);
|
||||
return to_assign(0, "删除成功");
|
||||
} else {
|
||||
return to_assign(1, "删除失败");
|
||||
}
|
||||
} else {
|
||||
return to_assign(1, "错误的请求");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2023-2024 美天智能科技
|
||||
* @author 李志强
|
||||
* @link http://www.meteteme.com
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\api\BaseController;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
use app\api\controller\Schedule;
|
||||
|
||||
class Dingdingrobot extends BaseController
|
||||
{
|
||||
public function sendto()
|
||||
{
|
||||
// 获取前端传递的消息
|
||||
$message = $this->request->param('message');
|
||||
|
||||
// 警保项目群机器人地址
|
||||
$webhook1 = 'https://oapi.dingtalk.com/robot/send?access_token=46ad1d7d5aa6e365a50a1a08608f1d89f16031a658bf729c32f38d369bcfc520';
|
||||
|
||||
// 功能测试群机器人地址
|
||||
$webhook2 = 'https://oapi.dingtalk.com/robot/send?access_token=4448cd3d356856f7f91739b832f3ef466c2c1d8df6ce43a80e02661b6cfc3ea3';
|
||||
|
||||
// 选择要使用的webhook地址
|
||||
$webhook = $webhook2;
|
||||
|
||||
// 定义消息内容
|
||||
$content = [
|
||||
'msgtype' => 'text',
|
||||
'text' => [
|
||||
'content' => $message
|
||||
]
|
||||
];
|
||||
|
||||
// 将消息内容转换为json格式
|
||||
$jsonContent = json_encode($content);
|
||||
|
||||
$options = [
|
||||
'http' => [
|
||||
'header' => 'Content-Type: application/json',
|
||||
'method' => 'POST',
|
||||
'content' => $jsonContent
|
||||
]
|
||||
];
|
||||
|
||||
$context = stream_context_create($options);
|
||||
$result = file_get_contents($webhook, false, $context);
|
||||
|
||||
if ($result === false) {
|
||||
// 发送失败
|
||||
return '消息发送失败!';
|
||||
} else {
|
||||
// 发送成功
|
||||
return '消息发送成功!';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2023-2024 美天智能科技
|
||||
* @author 李志强
|
||||
* @link http://www.meteteme.com
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\api\BaseController;
|
||||
use app\model\Document as DocumentList;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class Document extends BaseController
|
||||
{
|
||||
//获取文档列表
|
||||
public function get_list()
|
||||
{
|
||||
$param = get_params();
|
||||
$model = new DocumentList();
|
||||
$list = $model->get_list($param);
|
||||
return to_assign(0, '', $list);
|
||||
}
|
||||
|
||||
//添加修改
|
||||
public function add()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isPost()) {
|
||||
//markdown数据处理
|
||||
if (isset($param['table-align'])) {
|
||||
unset($param['table-align']);
|
||||
}
|
||||
if (isset($param['docContent-html-code'])) {
|
||||
$param['content'] = $param['docContent-html-code'];
|
||||
$param['md_content'] = $param['docContent-markdown-doc'];
|
||||
unset($param['docContent-html-code']);
|
||||
unset($param['docContent-markdown-doc']);
|
||||
}
|
||||
if (isset($param['ueditorcontent'])) {
|
||||
$param['content'] = $param['ueditorcontent'];
|
||||
$param['md_content'] = '';
|
||||
}
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
$param['update_time'] = time();
|
||||
|
||||
printf($param->uid);
|
||||
$detail = (new DocumentList())->detail($param['id']);
|
||||
$res = DocumentList::where('id', $param['id'])->strict(false)->field(true)->update($param);
|
||||
if ($res) {
|
||||
$log_data = array(
|
||||
'module' => 'document',
|
||||
'field' => 'document',
|
||||
'action' => 'edit',
|
||||
'document_id' => $param['id'],
|
||||
'admin_id' => $this->uid,
|
||||
'old_content' => $detail['content'],
|
||||
'new_content' => $param['content'],
|
||||
'remark' => $param['title'],
|
||||
'create_time' => time(),
|
||||
);
|
||||
Db::name('Log')->strict(false)->field(true)->insert($log_data);
|
||||
}
|
||||
return to_assign();
|
||||
} else {
|
||||
$param['create_time'] = time();
|
||||
$param['admin_id'] = $this->uid;
|
||||
$sid = DocumentList::strict(false)->field(true)->insertGetId($param);
|
||||
if ($sid) {
|
||||
$log_data = array(
|
||||
'module' => 'document',
|
||||
'field' => 'document',
|
||||
'action' => 'add',
|
||||
'document_id' => $sid,
|
||||
'admin_id' => $this->uid,
|
||||
'remark' => $param['title'],
|
||||
'create_time' => time(),
|
||||
);
|
||||
Db::name('Log')->strict(false)->field(true)->insert($log_data);
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
} else {
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
if ($id > 0) {
|
||||
$detail = (new DocumentList())->detail($id);
|
||||
if (empty($detail)) {
|
||||
return to_assign(1, '文档不存在');
|
||||
}
|
||||
View::assign('project_id', $detail['topic_id']);
|
||||
View::assign('detail', $detail);
|
||||
}
|
||||
if (isset($param['project_id'])) {
|
||||
View::assign('project_id', $param['project_id']);
|
||||
}
|
||||
View::assign('id', $id);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//查看
|
||||
public function view()
|
||||
{
|
||||
$param = get_params();
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$detail = (new DocumentList())->detail($id);
|
||||
if (empty($detail)) {
|
||||
return to_assign(1, '文档不存在');
|
||||
} else {
|
||||
View::assign('detail', $detail);
|
||||
View::assign('id', $id);
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//删除
|
||||
public function delete()
|
||||
{
|
||||
if (request()->isDelete()) {
|
||||
$id = get_params("id");
|
||||
$detail = (new DocumentList())->detail($id);
|
||||
if (DocumentList::where('id', $id)->update(['delete_time' => time()]) !== false) {
|
||||
$log_data = array(
|
||||
'module' => $detail['module'],
|
||||
'field' => 'document',
|
||||
'action' => 'delete',
|
||||
'document_id' => $param['id'],
|
||||
'admin_id' => $this->uid,
|
||||
'remark' => $detail['title'],
|
||||
'new_content' => '',
|
||||
'create_time' => time(),
|
||||
);
|
||||
Db::name('Log')->strict(false)->field(true)->insert($log_data);
|
||||
return to_assign(0, "删除成功");
|
||||
} else {
|
||||
return to_assign(0, "删除失败");
|
||||
}
|
||||
} else {
|
||||
return to_assign(1, "错误的请求");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,591 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2023-2024 美天智能科技
|
||||
* @author 李志强
|
||||
* @link http://www.meteteme.com
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\api\BaseController;
|
||||
use think\facade\Db;
|
||||
use think\Response;
|
||||
use app\model\PicbedImages as PicbedList;
|
||||
|
||||
class Index extends BaseController
|
||||
{
|
||||
//上传文件
|
||||
public function upload()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->file('file')) {
|
||||
$file = request()->file('file');
|
||||
} else {
|
||||
return to_assign(1, '没有选择上传文件');
|
||||
}
|
||||
// dump($file);die;
|
||||
// 获取上传文件的hash散列值
|
||||
$sha1 = $file->hash('sha1');
|
||||
$md5 = $file->hash('md5');
|
||||
$rule = [
|
||||
'image' => 'jpg,png,jpeg,gif,ai,psd',
|
||||
'doc' => 'txt,doc,docx,ppt,pptx,xls,xlsx,pdf,xmind,drawio',
|
||||
'file' => 'zip,gz,7z,rar,tar',
|
||||
'video' => 'mpg,mp4,mpeg,avi,wmv,mov,flv,m4v',
|
||||
];
|
||||
$fileExt = $rule['image'] . ',' . $rule['doc'] . ',' . $rule['file'] . ',' . $rule['video'];
|
||||
//1M=1024*1024=1048576字节
|
||||
$fileSize = 100 * 1024 * 1024;
|
||||
if (isset($param['type']) && $param['type']) {
|
||||
$fileExt = $rule[$param['type']];
|
||||
}
|
||||
if (isset($param['size']) && $param['size']) {
|
||||
$fileSize = $param['size'];
|
||||
}
|
||||
$validate = \think\facade\Validate::rule([
|
||||
'image' => 'require|fileSize:' . $fileSize . '|fileExt:' . $fileExt,
|
||||
]);
|
||||
$file_check['image'] = $file;
|
||||
if (!$validate->check($file_check)) {
|
||||
return to_assign(1, $validate->getError());
|
||||
}
|
||||
// 日期前綴
|
||||
$dataPath = date('Ym');
|
||||
$use = 'thumb';
|
||||
$filename = \think\facade\Filesystem::disk('public')->putFile($dataPath, $file, function () use ($md5) {
|
||||
return $md5;
|
||||
});
|
||||
if ($filename) {
|
||||
//写入到附件表
|
||||
$data = [];
|
||||
$path = get_config('filesystem.disks.public.url');
|
||||
$data['filepath'] = $path . '/' . $filename;
|
||||
$data['name'] = $file->getOriginalName();
|
||||
$data['mimetype'] = $file->getOriginalMime();
|
||||
$data['fileext'] = $file->extension();
|
||||
$data['filesize'] = $file->getSize();
|
||||
$data['filename'] = $filename;
|
||||
$data['sha1'] = $sha1;
|
||||
$data['md5'] = $md5;
|
||||
$data['module'] = \think\facade\App::initialize()->http->getName();
|
||||
$data['action'] = app('request')->action();
|
||||
$data['uploadip'] = app('request')->ip();
|
||||
$data['create_time'] = time();
|
||||
$data['user_id'] = $this->uid;
|
||||
if ($data['module'] = 'admin') {
|
||||
//通过后台上传的文件直接审核通过
|
||||
$data['status'] = 1;
|
||||
$data['admin_id'] = $data['user_id'];
|
||||
$data['audit_time'] = time();
|
||||
}
|
||||
$data['use'] = request()->has('use') ? request()->param('use') : $use; //附件用处
|
||||
$res['id'] = Db::name('file')->insertGetId($data);
|
||||
$res['filepath'] = $data['filepath'];
|
||||
$res['name'] = $data['name'];
|
||||
$res['filename'] = $data['filename'];
|
||||
$res['filesize'] = $data['filesize'];
|
||||
add_log('upload', $data['user_id'], $data);
|
||||
return to_assign(0, '上传成功', $res);
|
||||
} else {
|
||||
return to_assign(1, '上传失败,请重试');
|
||||
}
|
||||
}
|
||||
|
||||
// 图床上传
|
||||
public function upload_picbed()
|
||||
{
|
||||
if (request()->file('file')) {
|
||||
// 获取文件信息
|
||||
$file = request()->file('file');
|
||||
$file_name = $file->getOriginalName();
|
||||
$file_size = $file->getSize();
|
||||
$file_type = $file->getMime();
|
||||
$file_extension = pathinfo($file->getOriginalName(), PATHINFO_EXTENSION);
|
||||
|
||||
// 检查文件类型
|
||||
$allowed_types = Db::name('FileType')->column('suffix');
|
||||
if (!in_array($file_extension, $allowed_types)) {
|
||||
return json(['code' => 1, 'msg' => '该文件类型不允许上传!请联系管理员!']);
|
||||
}
|
||||
|
||||
// 检查文件大小
|
||||
$max_file_size = 10 * 1024 * 1024; // 10MB
|
||||
if ($file_size > $max_file_size) {
|
||||
return json(['code' => 2, 'msg' => '文件过大,已经超过10M,请联系管理员!']);
|
||||
}
|
||||
|
||||
// 创建文件夹
|
||||
$upload_dir = 'upload/' . date('Y-m-d') . '/';
|
||||
if (!is_dir($upload_dir)) {
|
||||
mkdir($upload_dir, 0777, true);
|
||||
}
|
||||
|
||||
// 生成新文件名
|
||||
$new_name = $this->generateRandomName(5) . '.' . $file_extension;
|
||||
|
||||
// 保存文件
|
||||
$file->move($upload_dir, $new_name);
|
||||
|
||||
// 添加数据到数据库
|
||||
$data = [
|
||||
'name' => $file_name,
|
||||
'new_name' => $new_name,
|
||||
'path' => $upload_dir . $new_name,
|
||||
'admin_id' => $this->uid,
|
||||
'size' => $file_size,
|
||||
'type' => $file_extension,
|
||||
'create_time' => time()
|
||||
];
|
||||
Db::name('PicbedImages')->insert($data);
|
||||
|
||||
// 获取文件上传域名
|
||||
$fileDomain = $_SERVER['HTTP_HOST'];
|
||||
|
||||
// 构建文件访问地址
|
||||
$url = $fileDomain . '/upload/' . date('Y-m-d') . '/' . $new_name;
|
||||
|
||||
// 返回 JSON 数据
|
||||
return json([
|
||||
'code' => 200,
|
||||
'msg' => '文件上传成功!',
|
||||
'fileDomain' => $fileDomain,
|
||||
'filename' => $file_name,
|
||||
'filepath' => $upload_dir . $new_name,
|
||||
'url' => $url,
|
||||
'admin_id' => $this->uid
|
||||
]);
|
||||
} else {
|
||||
return json(['code' => 400, 'msg' => '未选择上传文件!']);
|
||||
}
|
||||
}
|
||||
|
||||
// 生成随机文件名
|
||||
private function generateRandomName($length)
|
||||
{
|
||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
$random_name = '';
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$random_name .= $characters[rand(0, strlen($characters) - 1)];
|
||||
}
|
||||
return $random_name;
|
||||
}
|
||||
|
||||
// 外部站点上传图片到本站接口
|
||||
public function upload_pic_out()
|
||||
{
|
||||
if (request()->file('file')) {
|
||||
// 获取文件信息
|
||||
$file = request()->file('file');
|
||||
$file_name = $file->getOriginalName();
|
||||
$file_size = $file->getSize();
|
||||
$file_type = $file->getMime();
|
||||
$file_extension = pathinfo($file->getOriginalName(), PATHINFO_EXTENSION);
|
||||
|
||||
// 检查文件类型
|
||||
$allowed_types = Db::name('FileType')->column('suffix');
|
||||
if (!in_array($file_extension, $allowed_types)) {
|
||||
return json(['code' => 1, 'msg' => '该文件类型不允许上传!请联系管理员!'], 400);
|
||||
}
|
||||
|
||||
// 获取文件上传域名
|
||||
$fileDomain = '//' . $_SERVER['HTTP_HOST'];
|
||||
|
||||
// 检查文件大小
|
||||
$max_file_size = 10 * 1024 * 1024; // 10MB
|
||||
if ($file_size > $max_file_size) {
|
||||
return json(['code' => 2, 'msg' => '文件过大,已经超过10M,请联系管理员!'], 400);
|
||||
}
|
||||
|
||||
// 创建文件夹
|
||||
$upload_dir = './upload/' . date('Y-m-d') . '/';
|
||||
$upload_dir_1 = '/upload/' . date('Y-m-d') . '/';
|
||||
if (!is_dir($upload_dir)) {
|
||||
mkdir($upload_dir, 0777, true);
|
||||
}
|
||||
|
||||
// 生成新文件名
|
||||
$file_extension = pathinfo($file->getOriginalName(), PATHINFO_EXTENSION);
|
||||
$new_name = $this->generateRandomName(5) . '.' . $file_extension;
|
||||
|
||||
// 保存文件
|
||||
$file_destination = $upload_dir . $new_name;
|
||||
$file_destination1 = $upload_dir_1 . $new_name;
|
||||
$result = $file->move($upload_dir, $new_name);
|
||||
|
||||
if (!$result) {
|
||||
return json(['code' => 3, 'msg' => '文件保存失败'], 400);
|
||||
}
|
||||
|
||||
$file_name = urlencode($file_name);
|
||||
// 添加数据到数据库
|
||||
$data = [
|
||||
'name' => $file_name,
|
||||
'new_name' => $new_name,
|
||||
'path' => $file_destination,
|
||||
'admin_id' => request()->param('pr_name'),
|
||||
'size' => $file_size,
|
||||
'type' => $file_type,
|
||||
'create_time' => time()
|
||||
];
|
||||
|
||||
// 检查 admin_id 是否为空
|
||||
if (empty($data['admin_id'])) {
|
||||
return json(['code' => 4, 'msg' => '上传失败,缺少 pr_name 参数!'], 400);
|
||||
}
|
||||
|
||||
Db::name('PicbedImages')->insert($data);
|
||||
|
||||
// 构建文件访问地址
|
||||
$url = $_SERVER['HTTP_HOST'] . '/upload/' . date('Y-m-d') . '/' . $new_name;
|
||||
|
||||
// 构建响应数据
|
||||
$response_data = [
|
||||
'code' => 5,
|
||||
'msg' => '文件上传成功!',
|
||||
'filename' => $file_name,
|
||||
'fileDomain' => $fileDomain,
|
||||
'filepath' => $file_destination1,
|
||||
'url' => $url
|
||||
];
|
||||
|
||||
// 返回 JSON 格式的响应数据
|
||||
return json($response_data, 200);
|
||||
} else {
|
||||
return json(['code' => 6, 'msg' => '未选择上传文件!'], 400);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//编辑器图片上传
|
||||
public function tinymce_upload()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->file('file')) {
|
||||
$file = request()->file('file');
|
||||
} else {
|
||||
return json(['error' => 1, 'message' => '没有选择上传文件']);
|
||||
}
|
||||
|
||||
// 获取上传文件的hash散列值
|
||||
$sha1 = $file->hash('sha1');
|
||||
$md5 = $file->hash('md5');
|
||||
$rule = [
|
||||
'image' => 'jpg,png,jpeg,gif',
|
||||
'doc' => 'doc,docx,ppt,pptx,xls,xlsx,pdf,txt',
|
||||
'file' => 'zip,gz,7z,rar,tar',
|
||||
];
|
||||
$fileExt = $rule['image'] . ',' . $rule['doc'] . ',' . $rule['file'];
|
||||
$fileSize = 2 * 1024 * 1024; // 默认文件大小限制
|
||||
if (isset($param['type']) && $param['type']) {
|
||||
$fileExt = $rule[$param['type']];
|
||||
}
|
||||
if (isset($param['size']) && $param['size']) {
|
||||
$fileSize = $param['size'];
|
||||
}
|
||||
|
||||
$validate = \think\facade\Validate::rule([
|
||||
'image' => 'require|fileSize:' . $fileSize . '|fileExt:' . $fileExt,
|
||||
]);
|
||||
$file_check['image'] = $file;
|
||||
if (!$validate->check($file_check)) {
|
||||
return json(['error' => 1, 'message' => $validate->getError()]);
|
||||
}
|
||||
|
||||
$dataPath = date('Ym');
|
||||
$filename = \think\facade\Filesystem::disk('public')->putFile($dataPath, $file, function () use ($md5) {
|
||||
return $md5;
|
||||
});
|
||||
|
||||
if ($filename) {
|
||||
$path = get_config('filesystem.disks.public.url');
|
||||
$filepath = $path . '/' . $filename;
|
||||
return json(['location' => $filepath]); // Tinymce 需要的关键字段是 'location'
|
||||
} else {
|
||||
return json(['error' => 1, 'message' => '上传失败']);
|
||||
}
|
||||
}
|
||||
|
||||
public function md_upload()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->file('editormd-image-file')) {
|
||||
$file = request()->file('editormd-image-file');
|
||||
} else {
|
||||
return to_assign(1, '没有选择上传文件');
|
||||
}
|
||||
// dump($file);die;
|
||||
// 获取上传文件的hash散列值
|
||||
$sha1 = $file->hash('sha1');
|
||||
$md5 = $file->hash('md5');
|
||||
$rule = [
|
||||
'image' => 'jpg,png,jpeg,gif',
|
||||
'doc' => 'doc,docx,ppt,pptx,xls,xlsx,pdf',
|
||||
'file' => 'zip,gz,7z,rar,tar',
|
||||
];
|
||||
$fileExt = $rule['image'] . ',' . $rule['doc'] . ',' . $rule['file'];
|
||||
//1M=1024*1024=1048576字节
|
||||
$fileSize = 2 * 1024 * 1024;
|
||||
if (isset($param['type']) && $param['type']) {
|
||||
$fileExt = $rule[$param['type']];
|
||||
}
|
||||
if (isset($param['size']) && $param['size']) {
|
||||
$fileSize = $param['size'];
|
||||
}
|
||||
$validate = \think\facade\Validate::rule([
|
||||
'image' => 'require|fileSize:' . $fileSize . '|fileExt:' . $fileExt,
|
||||
]);
|
||||
$file_check['image'] = $file;
|
||||
if (!$validate->check($file_check)) {
|
||||
return to_assign(1, $validate->getError());
|
||||
}
|
||||
// 日期前綴
|
||||
$dataPath = date('Ym');
|
||||
$use = 'thumb';
|
||||
$filename = \think\facade\Filesystem::disk('public')->putFile($dataPath, $file, function () use ($md5) {
|
||||
return $md5;
|
||||
});
|
||||
if ($filename) {
|
||||
//写入到附件表
|
||||
$data = [];
|
||||
$path = get_config('filesystem.disks.public.url');
|
||||
$data['filepath'] = $path . '/' . $filename;
|
||||
$data['name'] = $file->getOriginalName();
|
||||
$data['mimetype'] = $file->getOriginalMime();
|
||||
$data['fileext'] = $file->extension();
|
||||
$data['filesize'] = $file->getSize();
|
||||
$data['filename'] = $filename;
|
||||
$data['sha1'] = $sha1;
|
||||
$data['md5'] = $md5;
|
||||
return json(['success' => 1, 'message' => '上传成功', 'url' => $data['filepath']]);
|
||||
} else {
|
||||
return json(['success' => 0, 'message' => '上传失败', 'url' => '']);
|
||||
}
|
||||
}
|
||||
|
||||
//清空缓存
|
||||
public function cache_clear()
|
||||
{
|
||||
\think\facade\Cache::clear();
|
||||
return to_assign(0, '系统缓存已清空');
|
||||
}
|
||||
|
||||
//获取部门树形节点列表
|
||||
public function get_department_tree()
|
||||
{
|
||||
$department = get_department();
|
||||
$list = get_tree($department, 0, 2);
|
||||
$data['trees'] = $list;
|
||||
return json($data);
|
||||
}
|
||||
|
||||
//获取部门树形节点列表2
|
||||
public function get_department_select()
|
||||
{
|
||||
$keyword = get_params('keyword');
|
||||
$selected = [];
|
||||
if (!empty($keyword)) {
|
||||
$selected = explode(",", $keyword);
|
||||
}
|
||||
$department = get_department();
|
||||
$list = get_select_tree($department, 0, 0, $selected);
|
||||
return to_assign(0, '', $list);
|
||||
}
|
||||
|
||||
//获取子部门所有员工
|
||||
public function get_employee($did = 0)
|
||||
{
|
||||
$did = get_params('did');
|
||||
/*
|
||||
if ($did == 1) {
|
||||
$department = $did;
|
||||
} else {
|
||||
$department = get_department_son($did);
|
||||
}
|
||||
*/
|
||||
$department = get_department_son($did);
|
||||
$employee = Db::name('admin')
|
||||
->field('a.id,a.did,a.position_id,a.mobile,a.name,a.nickname,a.sex,a.status,a.thumb,a.username,d.title as department')
|
||||
->alias('a')
|
||||
->join('Department d', 'a.did = d.id')
|
||||
->where(['a.status' => 1])
|
||||
->where('a.did', "in", $department)
|
||||
->select();
|
||||
return to_assign(0, '', $employee);
|
||||
}
|
||||
|
||||
//获取部门所有员工
|
||||
public function get_employee_select()
|
||||
{
|
||||
$employee = Db::name('admin')->field('id as value,name')->where(['status' => 1])->select();
|
||||
return to_assign(0, '', $employee);
|
||||
}
|
||||
|
||||
//获取角色列表
|
||||
public function get_position()
|
||||
{
|
||||
$position = Db::name('Position')->field('id,title as name')->where([['status', '=', 1], ['id', '>', 1]])->select();
|
||||
return to_assign(0, '', $position);
|
||||
}
|
||||
|
||||
//获取工作类型列表
|
||||
public function get_work()
|
||||
{
|
||||
$cate = Db::name('WorkCate')->field('id,title')->where([['status', '=', 1]])->select();
|
||||
return to_assign(0, '', $cate);
|
||||
}
|
||||
|
||||
//获取任务类型列表
|
||||
public function get_task_cate()
|
||||
{
|
||||
$cate = Db::name('TaskCate')->field('id,title')->where([['status', '=', 1]])->select();
|
||||
return to_assign(0, '', $cate);
|
||||
}
|
||||
|
||||
//获取产品列表
|
||||
public function get_product()
|
||||
{
|
||||
$product = Db::name('Product')->field('id,name as title')->where([['delete_time', '=', 0]])->select();
|
||||
return to_assign(0, '', $product);
|
||||
}
|
||||
|
||||
//获取客户列表
|
||||
public function get_business()
|
||||
{
|
||||
$business = Db::name('Business')->field('id,name as title')->where([['delete_time', '=', 0]])->select();
|
||||
return to_assign(0, '', $business);
|
||||
}
|
||||
|
||||
//获取项目列表
|
||||
public function get_project($pid = 0)
|
||||
{
|
||||
$where = [];
|
||||
$where[] = ['delete_time', '=', 0];
|
||||
if ($pid > 0) {
|
||||
$where[] = ['product_id', '=', $pid];
|
||||
}
|
||||
$project = Db::name('Project')->field('id,name as title')->where($where)->select();
|
||||
//$belong_project = Db::name('Project')->field('id,name_short as title')->where($where)->select();
|
||||
return to_assign(0, '', $project);
|
||||
}
|
||||
|
||||
//获取所属项目短名
|
||||
public function get_belong_project()
|
||||
{
|
||||
$where = [];
|
||||
$where[] = ['delete_time', '=', 0];
|
||||
if ($pid > 0) {
|
||||
$where[] = ['product_id', '=', $pid];
|
||||
}
|
||||
|
||||
$belong_project = Db::name('Project')->field('id,name_short as title')->where($where)->select();
|
||||
return to_assign(0, '', $belong_project);
|
||||
}
|
||||
|
||||
//文档列表
|
||||
public function get_doc_list($kid = 0, $tree = 0)
|
||||
{
|
||||
if ($tree == 2) {
|
||||
$list = Db::name('knowledgeDoc')->where(['knowledge_id' => $kid, 'delete_time' => 0])
|
||||
->field('id,pid as pId,title as name,type,link,knowledge_id,sort,read')
|
||||
->order('sort asc,id asc')
|
||||
->select();
|
||||
return to_assign(0, '', $list);
|
||||
} else {
|
||||
$list = Db::name('knowledgeDoc')->where(['knowledge_id' => $kid, 'delete_time' => 0])
|
||||
->field('id,pid,title,type,knowledge_id,sort,read')
|
||||
->order('sort asc,id asc')
|
||||
->select();
|
||||
if ($tree == 1) {
|
||||
foreach ($list as $k => &$v) {
|
||||
$v['title'] = sub_str($v['title'], 9);
|
||||
}
|
||||
$tree = get_tree($list, 0, 4);
|
||||
$data['trees'] = $tree;
|
||||
return json($data);
|
||||
} else {
|
||||
return to_assign(0, '', $list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//删除消息附件
|
||||
public function del_message_interfix()
|
||||
{
|
||||
$id = get_params("id");
|
||||
$detail = Db::name('MessageFileInterfix')->where('id', $id)->find();
|
||||
if ($detail['admin_id'] == $this->uid) {
|
||||
if (Db::name('MessageFileInterfix')->where('id', $id)->delete() !== false) {
|
||||
$data = Db::name('MessageFileInterfix')->where('mid', $detail['mid'])->column('file_id');
|
||||
return to_assign(0, "删除成功", $data);
|
||||
} else {
|
||||
return to_assign(1, "删除失败");
|
||||
}
|
||||
} else {
|
||||
return to_assign(1, "您没权限删除该消息附件");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 测试邮件发送
|
||||
public function email_test()
|
||||
{
|
||||
$sender = get_params('email');
|
||||
//检查是否邮箱格式
|
||||
if (!is_email($sender)) {
|
||||
return to_assign(1, '测试邮箱码格式有误');
|
||||
}
|
||||
$email_config = \think\facade\Db::name('config')->where('name', 'email')->find();
|
||||
$config = unserialize($email_config['content']);
|
||||
$content = $config['template'];
|
||||
//所有项目必须填写
|
||||
if (empty($config['smtp']) || empty($config['smtp_port']) || empty($config['smtp_user']) || empty($config['smtp_pwd'])) {
|
||||
return to_assign(1, '请完善邮件配置信息!');
|
||||
}
|
||||
|
||||
$send = send_email($sender, '测试邮件', $content);
|
||||
if ($send) {
|
||||
return to_assign(0, '邮件发送成功!');
|
||||
} else {
|
||||
return to_assign(1, '邮件发送失败!');
|
||||
}
|
||||
}
|
||||
|
||||
public function get_captcha()
|
||||
{
|
||||
return captcha();
|
||||
}
|
||||
|
||||
// 新增接口
|
||||
public function pullart()
|
||||
{
|
||||
// 允许来自任何来源的跨域请求
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header('Access-Control-Allow-Headers: Content-Type');
|
||||
|
||||
$images = Db::name('PicbedImages')->order('id', 'desc')->select()->toArray();
|
||||
|
||||
// 获取当前请求的域名
|
||||
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
|
||||
$host = $_SERVER['HTTP_HOST'];
|
||||
$baseUrl = $protocol . '://' . $host;
|
||||
|
||||
// 筛选出只需要的字段并拼接完整路径
|
||||
$images = array_map(function ($image) use ($baseUrl) {
|
||||
return [
|
||||
'name' => htmlspecialchars($image['name'], ENT_QUOTES),
|
||||
'path' => $baseUrl . '/' . $image['path'],
|
||||
];
|
||||
}, $images);
|
||||
|
||||
return json(['code' => 0, 'msg' => '', 'data' => $images]);
|
||||
}
|
||||
|
||||
public function getallstaff(){
|
||||
$employees = Db::name('admin')
|
||||
->field('id, name, status') // 根据需要选择字段
|
||||
->where('status', 1) // 只获取在职员工
|
||||
->select();
|
||||
return to_assign(0, '', $employees);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2023-2024 美天智能科技
|
||||
* @author 李志强
|
||||
* @link http://www.meteteme.com
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\api\BaseController;
|
||||
use app\model\Log as LogList;
|
||||
use think\facade\Db;
|
||||
use think\facade\Session;
|
||||
|
||||
class Log extends BaseController
|
||||
{
|
||||
//获取日志列表
|
||||
public function get_list()
|
||||
{
|
||||
$param = get_params();
|
||||
$list = new LogList();
|
||||
$content = $list->get_list($param);
|
||||
return to_assign(0, '', $content);
|
||||
}
|
||||
|
||||
//获取日志列表
|
||||
public function log_list()
|
||||
{
|
||||
$param = get_params();
|
||||
$list = new LogList();
|
||||
$content = $list->log_list($param);
|
||||
return to_assign(0, '', $content);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,460 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2023-2024 美天智能科技
|
||||
* @author 李志强
|
||||
* @link http://www.meteteme.com
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\api\BaseController;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class Project extends BaseController
|
||||
{
|
||||
public function view()
|
||||
{
|
||||
$param = get_params();
|
||||
View::assign('id', $param['id']);
|
||||
View::assign('user_info', get_login_admin());
|
||||
return view('view_' . $param['page']);
|
||||
}
|
||||
public function get_chart_data()
|
||||
{
|
||||
$param = get_params();
|
||||
$tasks = Db::name('Task')->field('id,plan_hours,end_time,flow_status,over_time')->order('end_time asc')->where([['project_id', '=', $param['project_id']], ['delete_time', '=', 0], ['is_bug', '=', 0]])->select()->toArray();
|
||||
|
||||
$task_count = count($tasks);
|
||||
$task_count_ok = Db::name('Task')->where([['project_id', '=', $param['project_id']], ['delete_time', '=', 0], ['is_bug', '=', 0], ['flow_status', '>', 2]])->count();
|
||||
$task_delay = 0;
|
||||
if ($task_count > 0) {
|
||||
foreach ($tasks as $k => $v) {
|
||||
if (($v['flow_status'] < 3) && ($v['end_time'] < time() - 86400)) {
|
||||
$task_delay++;
|
||||
}
|
||||
if (($v['flow_status'] == 3) && ($v['end_time'] < $v['over_time'] - 86400)) {
|
||||
$task_delay++;
|
||||
}
|
||||
}
|
||||
}
|
||||
$task_pie = [
|
||||
'count' => $task_count,
|
||||
'count_ok' => $task_count_ok,
|
||||
'delay' => $task_delay,
|
||||
'ok_lv' => $task_count == 0 ? 100 : round($task_count_ok * 100 / $task_count, 2),
|
||||
'delay_lv' => $task_count == 0 ? 100 : round($task_delay * 100 / $task_count, 2),
|
||||
];
|
||||
|
||||
$bugs = Db::name('Task')->field('id,flow_status')->order('end_time asc')->where(['delete_time' => 0, 'is_bug' => 1, 'project_id' => $param['project_id']])->select()->toArray();
|
||||
$status_a = $status_b = $status_c = $status_d = $status_e = 0;
|
||||
foreach ($bugs as $k => $v) {
|
||||
if ($v['flow_status'] == 1) {
|
||||
$status_a++;
|
||||
} else if ($v['flow_status'] == 2) {
|
||||
$status_b++;
|
||||
} else if ($v['flow_status'] == 3) {
|
||||
$status_c++;
|
||||
} else if ($v['flow_status'] == 4) {
|
||||
$status_d++;
|
||||
} else if ($v['flow_status'] == 5) {
|
||||
$status_e++;
|
||||
}
|
||||
}
|
||||
$bug_status = [
|
||||
'status_a' => $status_a,
|
||||
'status_b' => $status_b,
|
||||
'status_c' => $status_c,
|
||||
'status_d' => $status_d,
|
||||
'status_e' => $status_e,
|
||||
];
|
||||
|
||||
$date_tasks = [];
|
||||
if ($tasks) {
|
||||
$date_tasks = plan_count($tasks);
|
||||
}
|
||||
|
||||
$tasks_ok = Db::name('Task')->field('id,over_time as end_time')->order('over_time asc')->where([['over_time', '>', 0], ['delete_time', '=', 0], ['project_id', '=', $param['project_id']]])->select()->toArray();
|
||||
$date_tasks_ok = [];
|
||||
if ($tasks_ok) {
|
||||
$date_tasks_ok = plan_count($tasks_ok);
|
||||
}
|
||||
$tids = Db::name('Task')->where(['delete_time' => 0, 'project_id' => $param['project_id']])->column('id');
|
||||
$schedules = Db::name('Schedule')->where([['tid', 'in', $tids], ['delete_time', '=', 0]])->select()->toArray();
|
||||
$date_schedules = [];
|
||||
if ($schedules) {
|
||||
$date_schedules = hour_count($schedules);
|
||||
}
|
||||
|
||||
$res['task_pie'] = $task_pie;
|
||||
$res['bug_status'] = $bug_status;
|
||||
$res['date_tasks'] = $date_tasks;
|
||||
$res['date_tasks_ok'] = $date_tasks_ok;
|
||||
$res['date_schedules'] = $date_schedules;
|
||||
to_assign(0, '', $res);
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
$param = get_params();
|
||||
$project = Db::name('Project')->where(['id' => $param['tid']])->find();
|
||||
$users = Db::name('ProjectUser')
|
||||
->field('pu.*,a.name,a.mobile,p.title as position,d.title as department')
|
||||
->alias('pu')
|
||||
->join('Admin a', 'pu.uid = a.id', 'LEFT')
|
||||
->join('Department d', 'a.did = d.id', 'LEFT')
|
||||
->join('Position p', 'a.position_id = p.id', 'LEFT')
|
||||
->order('pu.id asc')
|
||||
->where(['pu.project_id' => $param['tid']])
|
||||
->select()->toArray();
|
||||
if (!empty($users)) {
|
||||
foreach ($users as $k => &$v) {
|
||||
$v['role'] = 0; //普通项目成员
|
||||
if ($v['uid'] == $project['admin_id']) {
|
||||
$v['role'] = 1; //项目创建人
|
||||
}
|
||||
if ($v['uid'] == $project['director_uid']) {
|
||||
$v['role'] = 2; //项目负责人
|
||||
}
|
||||
|
||||
$v['create_time'] = date('Y-m-d', (int) $v['create_time']);
|
||||
if ($v['delete_time'] > 0) {
|
||||
$v['delete_time'] = date('Y-m-d', (int) $v['delete_time']);
|
||||
}
|
||||
|
||||
$tids = Db::name('Task')->where([['project_id', '=', $param['tid']], ['delete_time', '=', 0]])->column('id');
|
||||
$schedule_map = [];
|
||||
$schedule_map[] = ['tid', 'in', $tids];
|
||||
$schedule_map[] = ['delete_time', '=', 0];
|
||||
$schedule_map[] = ['admin_id', '=', $v['uid']];
|
||||
$v['schedules'] = Db::name('Schedule')->where($schedule_map)->count();
|
||||
$v['labor_times'] = Db::name('Schedule')->where($schedule_map)->sum('labor_time');
|
||||
|
||||
$task_map = [];
|
||||
$task_map[] = ['project_id', '=', $param['tid']];
|
||||
$task_map[] = ['delete_time', '=', 0];
|
||||
|
||||
$task_map1 = [
|
||||
['admin_id', '=', $v['uid']],
|
||||
];
|
||||
$task_map2 = [
|
||||
['director_uid', '=', $v['uid']],
|
||||
];
|
||||
$task_map3 = [
|
||||
['', 'exp', Db::raw("FIND_IN_SET('{$v['uid']}',assist_admin_ids)")],
|
||||
];
|
||||
|
||||
//任务
|
||||
$task_map_a = $task_map;
|
||||
$task_map_a[] = ['is_bug', '=', 0];
|
||||
//任务总数
|
||||
$v['tasks_a_total'] = Db::name('Task')
|
||||
->where(function ($query) use ($task_map1, $task_map2, $task_map3) {
|
||||
$query->where($task_map1)->whereor($task_map2)->whereor($task_map3);
|
||||
})
|
||||
->where($task_map_a)->count();
|
||||
//已完成任务
|
||||
$task_map_a[] = ['flow_status', '>', 2]; //已完成
|
||||
$v['tasks_a_finish'] = Db::name('Task')->where(function ($query) use ($task_map1, $task_map2, $task_map3) {
|
||||
$query->where($task_map1)->whereor($task_map2)->whereor($task_map3);
|
||||
})
|
||||
->where($task_map_a)->count();
|
||||
//未完成任务
|
||||
$v['tasks_a_unfinish'] = $v['tasks_a_total'] - $v['tasks_a_finish'];
|
||||
$v['tasks_a_pensent'] = "100%";
|
||||
if ($v['tasks_a_total'] > 0) {
|
||||
$v['tasks_a_pensent'] = round($v['tasks_a_finish'] / $v['tasks_a_total'] * 100, 2) . "%";
|
||||
}
|
||||
|
||||
//缺陷
|
||||
$task_map_b = $task_map;
|
||||
$task_map_b[] = ['is_bug', '=', 1];
|
||||
//缺陷总数
|
||||
$v['tasks_b_total'] = Db::name('Task')
|
||||
->where(function ($query) use ($task_map1, $task_map2, $task_map3) {
|
||||
$query->where($task_map1)->whereor($task_map2)->whereor($task_map3);
|
||||
})
|
||||
->where($task_map_b)->count();
|
||||
//已完成缺陷
|
||||
$task_map_b[] = ['flow_status', '>', 2]; //已完成
|
||||
$v['tasks_b_finish'] = Db::name('Task')->where(function ($query) use ($task_map1, $task_map2, $task_map3) {
|
||||
$query->where($task_map1)->whereor($task_map2)->whereor($task_map3);
|
||||
})
|
||||
->where($task_map_b)->count();
|
||||
//未完成缺陷
|
||||
$v['tasks_b_unfinish'] = $v['tasks_b_total'] - $v['tasks_b_finish'];
|
||||
$v['tasks_b_pensent'] = "100%";
|
||||
if ($v['tasks_b_total'] > 0) {
|
||||
$v['tasks_b_pensent'] = round($v['tasks_b_finish'] / $v['tasks_b_total'] * 100, 2) . "%";
|
||||
}
|
||||
}
|
||||
}
|
||||
to_assign(0, '', $users);
|
||||
}
|
||||
|
||||
//新增项目成员
|
||||
public function add_user()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isPost()) {
|
||||
$has = Db::name('ProjectUser')->where(['uid' => $param['uid'], 'project_id' => $param['project_id']])->find();
|
||||
if (!empty($has)) {
|
||||
to_assign(1, '该员工已经是项目成员');
|
||||
}
|
||||
$project = Db::name('Project')->where(['id' => $param['project_id']])->find();
|
||||
if ($this->uid == $project['admin_id'] || $this->uid == $project['director_uid']) {
|
||||
$param['admin_id'] = $this->uid;
|
||||
$param['create_time'] = time();
|
||||
$res = Db::name('ProjectUser')->strict(false)->field(true)->insert($param);
|
||||
if ($res) {
|
||||
$log_data = array(
|
||||
'module' => 'project',
|
||||
'field' => 'user',
|
||||
'action' => 'add',
|
||||
'project_id' => $param['project_id'],
|
||||
'admin_id' => $this->uid,
|
||||
'new_content' => $param['uid'],
|
||||
'create_time' => time(),
|
||||
);
|
||||
Db::name('Log')->strict(false)->field(true)->insert($log_data);
|
||||
to_assign();
|
||||
}
|
||||
} else {
|
||||
to_assign(1, '只有项目创建者和负责人才有权限新增项目成员');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//移除项目成员
|
||||
public function remove_user()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isDelete()) {
|
||||
$detail = Db::name('ProjectUser')->where(['id' => $param['id']])->find();
|
||||
$project = Db::name('Project')->where(['id' => $detail['project_id']])->find();
|
||||
if ($this->uid == $project['admin_id'] || $this->uid == $project['director_uid']) {
|
||||
if ($detail['uid'] == $project['admin_id']) {
|
||||
to_assign(1, '该项目成员是项目的创建者,不能移除');
|
||||
}
|
||||
if ($detail['uid'] == $project['director_uid']) {
|
||||
to_assign(1, '该项目成员是项目的负责人,需要去除负责人权限才能移除');
|
||||
}
|
||||
$param['delete_time'] = time();
|
||||
if (Db::name('ProjectUser')->update($param) !== false) {
|
||||
$log_data = array(
|
||||
'module' => 'project',
|
||||
'field' => 'user',
|
||||
'action' => 'remove',
|
||||
'project_id' => $detail['project_id'],
|
||||
'admin_id' => $this->uid,
|
||||
'new_content' => $detail['uid'],
|
||||
'create_time' => time(),
|
||||
);
|
||||
Db::name('Log')->strict(false)->field(true)->insert($log_data);
|
||||
return to_assign(0, "移除成功");
|
||||
} else {
|
||||
return to_assign(1, "移除失败");
|
||||
}
|
||||
} else {
|
||||
to_assign(1, '只有项目创建者和负责人才有权限移除项目成员');
|
||||
}
|
||||
} else {
|
||||
return to_assign(1, "错误的请求");
|
||||
}
|
||||
}
|
||||
//恢复项目成员
|
||||
public function recover_user()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isPost()) {
|
||||
$detail = Db::name('ProjectUser')->where(['id' => $param['id']])->find();
|
||||
$project = Db::name('Project')->where(['id' => $detail['project_id']])->find();
|
||||
if ($this->uid == $project['admin_id'] || $this->uid == $project['director_uid']) {
|
||||
$param['delete_time'] = 0;
|
||||
if (Db::name('ProjectUser')->update($param) !== false) {
|
||||
$log_data = array(
|
||||
'module' => 'project',
|
||||
'field' => 'user',
|
||||
'action' => 'recover',
|
||||
'project_id' => $detail['project_id'],
|
||||
'admin_id' => $this->uid,
|
||||
'new_content' => $detail['uid'],
|
||||
'create_time' => time(),
|
||||
);
|
||||
Db::name('Log')->strict(false)->field(true)->insert($log_data);
|
||||
return to_assign(0, "恢复成功");
|
||||
} else {
|
||||
return to_assign(1, "恢复失败");
|
||||
}
|
||||
} else {
|
||||
to_assign(1, '只有项目创建者和负责人才有权限恢复项目成员');
|
||||
}
|
||||
} else {
|
||||
return to_assign(1, "错误的请求");
|
||||
}
|
||||
}
|
||||
|
||||
//编辑阶段
|
||||
public function reset_check()
|
||||
{
|
||||
$param = get_params();
|
||||
$id = isset($param['id']) ? $param['id'] : 0;
|
||||
$detail = Db::name('Project')->where(['id' => $param['id']])->find();
|
||||
if (request()->isPost()) {
|
||||
$flowNameData = isset($param['flowName']) ? $param['flowName'] : '';
|
||||
$flowUidsData = isset($param['chargeIds']) ? $param['chargeIds'] : '';
|
||||
$flowIdsData = isset($param['membeIds']) ? $param['membeIds'] : '';
|
||||
// $flowDateData = isset($param['cycleDate']) ? $param['cycleDate'] : '';
|
||||
$flow = [];
|
||||
$time_1 = $detail['start_time'];
|
||||
$time_2 = $detail['end_time'];
|
||||
foreach ($flowNameData as $key => $value) {
|
||||
if (!$value) {
|
||||
continue;
|
||||
}
|
||||
// $flowDate = explode('到', $flowDateData[$key]);
|
||||
// $start_time = strtotime(urldecode(trim($flowDate[0])));
|
||||
// $end_time = strtotime(urldecode(trim($flowDate[1])));
|
||||
// if ($start_time < $time_1) {
|
||||
// if ($key == 0) {
|
||||
// return to_assign(1, '第' . ($key + 1) . '阶段的开始时间不能小于计划开始时间');
|
||||
// } else {
|
||||
// return to_assign(1, '第' . ($key + 1) . '阶段的开始时间不能小于第' . ($key) . '阶段的结束时间');
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// if ($end_time > $time_2) {
|
||||
// return to_assign(1, '第' . ($key + 1) . '阶段的结束时间不能大于计划结束时间');
|
||||
// break;
|
||||
// } else {
|
||||
// $time_1 = $end_time;
|
||||
// }
|
||||
$item = [];
|
||||
$item['action_id'] = $id;
|
||||
$item['flow_name'] = $value;
|
||||
$item['type'] = 1;
|
||||
$item['flow_uid'] = $flowUidsData[$key];
|
||||
$item['flow_ids'] = $flowIdsData[$key];
|
||||
$item['sort'] = $key;
|
||||
// $item['start_time'] = $start_time;
|
||||
// $item['end_time'] = $end_time;
|
||||
$item['create_time'] = time();
|
||||
$flow[] = $item;
|
||||
}
|
||||
//删除原来的阶段步骤
|
||||
Db::name('Step')->where(['action_id' => $id, 'type' => 1, 'delete_time' => 0])->update(['delete_time' => time()]);
|
||||
Db::name('StepRecord')->where(['action_id' => $id, 'type' => 1, 'delete_time' => 0])->update(['delete_time' => time()]);
|
||||
$res = Db::name('Step')->strict(false)->field(true)->insertAll($flow);
|
||||
if ($res) {
|
||||
$checkData = array(
|
||||
'action_id' => $id,
|
||||
'step_id' => 0,
|
||||
'check_uid' => $this->uid,
|
||||
'type' => 1,
|
||||
'check_time' => time(),
|
||||
'status' => 0,
|
||||
'create_time' => time()
|
||||
);
|
||||
$aid = Db::name('StepRecord')->strict(false)->field(true)->insertGetId($checkData);
|
||||
$resa = Db::name('Project')->where('id', $id)->strict(false)->field(true)->update(['step_sort' => 0, 'update_time' => time()]);
|
||||
add_log('reset', $param['id'], $param, [], '项目阶段');
|
||||
}
|
||||
return to_assign();
|
||||
}
|
||||
}
|
||||
|
||||
//审核
|
||||
public function step_check()
|
||||
{
|
||||
$param = get_params();
|
||||
$detail = Db::name('Project')->where(['id' => $param['id']])->find();
|
||||
//当前审核节点详情
|
||||
$step = Db::name('Step')->where(['action_id' => $detail['id'], 'type' => 1, 'sort' => $detail['step_sort'], 'delete_time' => 0])->find();
|
||||
// if ($this->uid != $step['flow_uid']) {
|
||||
// return to_assign(1, '您没权限操作');
|
||||
// }
|
||||
//审核通过
|
||||
if ($param['check'] == 1) {
|
||||
$next_step = Db::name('Step')->where(['action_id' => $detail['id'], 'type' => 1, 'sort' => ($detail['step_sort'] + 1), 'delete_time' => 0])->find();
|
||||
if ($next_step) {
|
||||
$param['step_sort'] = $next_step['sort'];
|
||||
$param['status'] = 2;
|
||||
} else {
|
||||
//不存在下一步审核,审核结束
|
||||
$param['status'] = 3;
|
||||
$param['step_sort'] = $detail['step_sort'] + 1;
|
||||
}
|
||||
//审核通过数据操作
|
||||
$res = Db::name('Project')->strict(false)->field('step_sort,status')->update($param);
|
||||
if ($res !== false) {
|
||||
$checkData = array(
|
||||
'action_id' => $detail['id'],
|
||||
'step_id' => $step['id'],
|
||||
'check_uid' => $this->uid,
|
||||
'type' => 1,
|
||||
'check_time' => time(),
|
||||
'status' => $param['check'],
|
||||
'create_time' => time()
|
||||
);
|
||||
$aid = Db::name('StepRecord')->strict(false)->field(true)->insertGetId($checkData);
|
||||
add_log('check', $param['id'], $param, [], '项目阶段');
|
||||
return to_assign();
|
||||
} else {
|
||||
return to_assign(1, '操作失败');
|
||||
}
|
||||
}
|
||||
//拒绝审核
|
||||
else if ($param['check'] == 2) {
|
||||
//获取上一步的审核信息
|
||||
$prev_step = Db::name('Step')->where(['action_id' => $detail['id'], 'type' => 1, 'sort' => ($detail['step_sort'] - 1), 'delete_time' => 0])->find();
|
||||
if ($prev_step) {
|
||||
//存在上一步审核
|
||||
$param['step_sort'] = $prev_step['sort'];
|
||||
} else {
|
||||
//不存在上一步审核,审核初始化步骤
|
||||
$param['step_sort'] = 0;
|
||||
$param['status'] = 1;
|
||||
}
|
||||
}
|
||||
$res = Db::name('Project')->strict(false)->field('step_sort,status')->update($param);
|
||||
if ($res !== false) {
|
||||
$checkData = array(
|
||||
'action_id' => $detail['id'],
|
||||
'step_id' => $step['id'],
|
||||
'check_uid' => $this->uid,
|
||||
'type' => 1,
|
||||
'check_time' => time(),
|
||||
'status' => $param['check'],
|
||||
'content' => $param['content'],
|
||||
'create_time' => time()
|
||||
);
|
||||
$aid = Db::name('StepRecord')->strict(false)->field(true)->insertGetId($checkData);
|
||||
add_log('refue', $param['id'], $param, [], '项目阶段');
|
||||
return to_assign();
|
||||
} else {
|
||||
return to_assign(1, '操作失败');
|
||||
}
|
||||
}
|
||||
|
||||
//获取钉钉机器人webhook
|
||||
public function getddurl()
|
||||
{
|
||||
$param = get_params();
|
||||
if (request()->isGet()) {
|
||||
$ddurl = Db::name('Project')->where('id', $param['id'])->value('ddurl');
|
||||
if ($ddurl) {
|
||||
return json(['id' => $param["id"], 'ddurl' => $ddurl]);
|
||||
} else {
|
||||
return json('操作失败');
|
||||
}
|
||||
} elseif (request()->isPost()) {
|
||||
$updateResult = Db::name('Project')->where('id', $param['id'])->update(['ddurl' => $param['ddurl']]);
|
||||
if ($updateResult) {
|
||||
return json(['id' => $param["id"], 'ddurl' => $param['ddurl']]);
|
||||
} else {
|
||||
return json('更新失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2023-2024 美天智能科技
|
||||
* @author 李志强
|
||||
* @link http://www.meteteme.com
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\api\BaseController;
|
||||
use app\model\Schedule as ScheduleList;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class Schedule extends BaseController
|
||||
{
|
||||
|
||||
//获取工作记录列表
|
||||
public function index()
|
||||
{
|
||||
if (request()->isAjax()) {
|
||||
$param = get_params();
|
||||
$task_ids = Db::name('Task')->where(['delete_time' => 0, 'project_id' => $param['tid']])->column('id');
|
||||
$where = array();
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['a.title', 'like', '%' . $param['keywords'] . '%'];
|
||||
}
|
||||
if (!empty($param['uid'])) {
|
||||
$where[] = ['a.admin_id', '=', $param['uid']];
|
||||
}
|
||||
if (!empty($task_ids)) {
|
||||
$where[] = ['a.tid', 'in', $task_ids];
|
||||
}
|
||||
$where[] = ['a.delete_time', '=', 0];
|
||||
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
||||
$list = ScheduleList::where($where)
|
||||
->field('a.*,u.name,d.title as department,t.title as task,p.name as project,w.title as work_cate')
|
||||
->alias('a')
|
||||
->join('Admin u', 'a.admin_id = u.id', 'LEFT')
|
||||
->join('Department d', 'u.did = d.id', 'LEFT')
|
||||
->join('Task t', 'a.tid = t.id', 'LEFT')
|
||||
->join('WorkCate w', 'w.id = t.cate', 'LEFT')
|
||||
->join('Project p', 't.project_id = p.id', 'LEFT')
|
||||
->order('a.end_time desc')
|
||||
->paginate($rows, false, ['query' => $param])
|
||||
->each(function ($item, $key) {
|
||||
$item->start_time_a = empty($item->start_time) ? '' : date('Y-m-d', $item->start_time);
|
||||
$item->start_time_b = empty($item->start_time) ? '' : date('H:i', $item->start_time);
|
||||
$item->end_time_a = empty($item->end_time) ? '' : date('Y-m-d', $item->end_time);
|
||||
$item->end_time_b = empty($item->end_time) ? '' : date('H:i', $item->end_time);
|
||||
|
||||
$item->start_time = empty($item->start_time) ? '' : date('Y-m-d H:i', $item->start_time);
|
||||
$item->end_time = empty($item->end_time) ? '' : date('H:i', $item->end_time);
|
||||
});
|
||||
return table_assign(0, '', $list);
|
||||
} else {
|
||||
return view();
|
||||
}
|
||||
}
|
||||
|
||||
//获取任务工作记录列表
|
||||
public function get_list()
|
||||
{
|
||||
$param = get_params();
|
||||
$where = array();
|
||||
$where['a.tid'] = $param['tid'];
|
||||
$where['a.delete_time'] = 0;
|
||||
$list = Db::name('Schedule')
|
||||
->field('a.*,u.name')
|
||||
->alias('a')
|
||||
->join('Admin u', 'u.id = a.admin_id')
|
||||
->order('a.create_time desc')
|
||||
->where($where)
|
||||
->select()->toArray();
|
||||
foreach ($list as $k => $v) {
|
||||
$list[$k]['start_time'] = empty($v['start_time']) ? '' : date('Y-m-d H:i', $v['start_time']);
|
||||
$list[$k]['end_time'] = empty($v['end_time']) ? '' : date('H:i', $v['end_time']);
|
||||
}
|
||||
return to_assign(0, '', $list);
|
||||
}
|
||||
|
||||
//查看
|
||||
public function view($id)
|
||||
{
|
||||
$id = get_params('id');
|
||||
$schedule = ScheduleList::where(['id' => $id])->find();
|
||||
if (!empty($schedule)) {
|
||||
$schedule['start_time_1'] = date('H:i', $schedule['start_time']);
|
||||
$schedule['end_time_1'] = date('H:i', $schedule['end_time']);
|
||||
$schedule['start_time'] = date('Y-m-d', $schedule['start_time']);
|
||||
$schedule['end_time'] = date('Y-m-d', $schedule['end_time']);
|
||||
// $schedule['create_time'] = date('Y-m-d H:i:s', $schedule['create_time']);
|
||||
$schedule['user'] = Db::name('Admin')->where(['id' => $schedule['admin_id']])->value('name');
|
||||
$schedule['department'] = Db::name('Department')->where(['id' => $schedule['did']])->value('title');
|
||||
}
|
||||
if (request()->isAjax()) {
|
||||
return to_assign(0, "", $schedule);
|
||||
} else {
|
||||
return $schedule;
|
||||
}
|
||||
}
|
||||
|
||||
//更新工作记录读取状态
|
||||
public function update_status()
|
||||
{
|
||||
$param = get_params();
|
||||
$id = $param['id'];
|
||||
$is_new = $param['is_new'];
|
||||
|
||||
$result = Db::name('Schedule')->where('id', $id)->update(['is_new' => $is_new]);
|
||||
if ($result) {
|
||||
return to_assign(0, '更新成功');
|
||||
} else {
|
||||
return to_assign(1, '更新失败');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
// 这是系统自动生成的event定义文件
|
||||
return [
|
||||
|
||||
];
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
// 这是系统自动生成的middleware定义文件
|
||||
return [
|
||||
//开启session中间件
|
||||
//'think\middleware\SessionInit',
|
||||
//验证勾股cms是否完成安装
|
||||
\app\home\middleware\Install::class,
|
||||
// 跳过登录验证 AuthMiddleware
|
||||
\app\api\middleware\Auth::class,
|
||||
];
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\middleware;
|
||||
|
||||
use Closure;
|
||||
use think\Request;
|
||||
use think\Response;
|
||||
|
||||
class Auth
|
||||
{
|
||||
protected $noNeedLogin = [
|
||||
'BusinessInfo' => ['product_info'],
|
||||
];
|
||||
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
// 获取当前请求的控制器和方法
|
||||
$controller = $request->controller();
|
||||
$action = $request->action();
|
||||
|
||||
// 判断当前请求是否在 noNeedLogin 列表中
|
||||
if (isset($this->noNeedLogin[$controller]) && in_array($action, $this->noNeedLogin[$controller])) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
// 执行登录验证逻辑
|
||||
if (!session('?user_id')) {
|
||||
// 未登录,返回错误或重定向到登录页面
|
||||
return redirect('login/index');
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
<form class="layui-form page-content p-4">
|
||||
{eq name="id" value ="0"}
|
||||
<h3 class="h3-title">新建文档</h3>
|
||||
<table class="layui-table layui-table-form">
|
||||
<tr>
|
||||
<td class="layui-td-gray">文档名称<font>*</font>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="title" lay-verify="required" lay-reqText="请输入文档名称" placeholder="请输入文档名称"
|
||||
class="layui-input" value="">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div>
|
||||
<div style="padding:10px 0">文档内容<span style="color: red">*</span></div>
|
||||
<div>
|
||||
<textarea id="mdContent" style="display:none;"></textarea>
|
||||
<div id="docContent"></div>
|
||||
</div>
|
||||
<input type="hidden" name="id" value="0" />
|
||||
<input type="hidden" name="topic_id" value="{$project_id}" />
|
||||
<input type="hidden" name="module" value="project" />
|
||||
</div>
|
||||
{else/}
|
||||
<h3 class="h3-title">编辑文档</h3>
|
||||
<table class="layui-table layui-table-form">
|
||||
<tr>
|
||||
<td class="layui-td-gray">文档名称<font>*</font>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="title" lay-verify="required" lay-reqText="请输入文档名称" placeholder="请输入文档名称"
|
||||
class="layui-input" value="{$detail.title}">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div>
|
||||
<div style="padding:10px 0">文档内容<span style="color: red">*</span></div>
|
||||
<div>
|
||||
<div id="docContent"></div>
|
||||
<textarea id="mdContent" style="display:none;">{$detail.md_content}</textarea>
|
||||
</div>
|
||||
<input type="hidden" name="id" value="{$detail.id}" />
|
||||
</div>
|
||||
{/eq}
|
||||
<div style="padding: 10px 0 0">
|
||||
<input type="hidden" name="module" value="project" />
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
function openInit() {
|
||||
var form = layui.form, layer = layui.layer, tool = layui.tool,editor = layui.editormd;
|
||||
|
||||
form.render();
|
||||
var edit = editor.render('docContent', {
|
||||
markdown: $('#mdContent').val(),
|
||||
imageUploadURL: "/api/index/md_upload",
|
||||
lineNumbers: false,
|
||||
toolbarIcons: function () {
|
||||
return [
|
||||
"undo", "redo","bold", "del", "italic", "quote","h1", "h2", "h3", "h4", "h5",
|
||||
"list-ul", "list-ol", "hr","link", "reference-link", "image", "code", "code-block", "table","watch", "fullscreen"
|
||||
];
|
||||
},
|
||||
height: window.innerHeight - 240,
|
||||
});
|
||||
//监听提交
|
||||
form.on('submit(webform)', function (data) {
|
||||
let callback = function (e) {
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
tool.close(1000);
|
||||
}
|
||||
}
|
||||
tool.post("/api/document/add", data.field, callback);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,20 @@
|
||||
<div class="page-content">
|
||||
<div class="p-4 border-b">
|
||||
<h3 class="h3-title">
|
||||
<span id="title_{$detail.id}" data-val="">{$detail.title}</span></i>
|
||||
</h3>
|
||||
<div>
|
||||
<span class="mr-2">{$detail.admin_name}</span>
|
||||
<span class="font-gray">创建于{$detail.times}<span id="editTips">{gt name="$detail.update_time" value="0"},最近更新于 {:time_trans($detail.update_time)}{/gt}</span></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-row p-4">
|
||||
<div class="md-content-content">{$detail.content|raw}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function openInit() {
|
||||
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,74 @@
|
||||
<div class="table-content">
|
||||
<!-- <div class="layui-form-bar border-t border-x">
|
||||
<button class="layui-btn layui-btn-sm add-new">+ 新建附件</button>
|
||||
</div> -->
|
||||
<div>
|
||||
<form class="layui-form layui-form-pane" action="">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">项目id</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" value="{$id}" autocomplete="off" readonly disabled placeholder="请输入项目id" lay-verify="required"
|
||||
class="layui-input">
|
||||
<input type="hidden" id="projectId" value="{$id}">
|
||||
<input type="hidden" id="attachments" value="attachment">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">附件地址</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="attachmentUrl" autocomplete="off" lay-verify="required"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<button class="layui-btn layui-btn-sm edit">修改</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
function pageInit() { }
|
||||
$(document).ready(function () {
|
||||
var id = $('#projectId').val();
|
||||
var attachment = $('#attachments').val();
|
||||
// 获取数据并填充到输入框
|
||||
$.ajax({
|
||||
url: '/api/project/getattachmenturl', // 接口地址
|
||||
type: 'GET', // 请求类型
|
||||
data: {
|
||||
id: id,
|
||||
page: attachment,
|
||||
},
|
||||
success: function (data) {
|
||||
$('input[name="attachmentUrl"]').val(data.attachmentUrl); // 填充数据
|
||||
},
|
||||
error: function () {
|
||||
alert('获取数据失败!');
|
||||
}
|
||||
});
|
||||
|
||||
// 修改按钮点击事件
|
||||
$('.edit').click(function (e) {
|
||||
e.preventDefault(); // 阻止表单默认提交
|
||||
var updatedUrl = $('input[name="attachmentUrl"]').val(); // 获取修改后的值
|
||||
$.ajax({
|
||||
url: '/api/project/getattachmenturl', // 提交修改的接口地址
|
||||
type: 'POST', // 请求类型
|
||||
data: {
|
||||
id: id,
|
||||
attachmentUrl: updatedUrl
|
||||
},
|
||||
success: function (response) {
|
||||
alert('修改成功!');
|
||||
},
|
||||
error: function () {
|
||||
alert('修改失败!');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,40 @@
|
||||
<div class="table-content">
|
||||
<div class="layui-card p-3 comment-list">
|
||||
<h4>项目评论</h4>
|
||||
<div class="comment-input my-2">
|
||||
<input type="text" id="commentInput" readonly placeholder="发表一下你的看法" class="layui-input" value="">
|
||||
</div>
|
||||
<div id="comment_project_{$id}"></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function pageInit(){
|
||||
let detail_id = {$id};
|
||||
let comment = layui.gouguComment;
|
||||
//评论
|
||||
comment.load(detail_id,'project');
|
||||
$('#commentInput').on('click',function(){
|
||||
comment.editor(0,detail_id,0,0,'project','');
|
||||
})
|
||||
//回复
|
||||
$('#comment_project_'+detail_id).on('click','[data-event="replay"]',function(){
|
||||
let pid = $(this).data('id');
|
||||
let padmin_id = $(this).data('uid');
|
||||
comment.editor(0,detail_id,pid,padmin_id,'project','');
|
||||
})
|
||||
//编辑
|
||||
$('#comment_project_'+detail_id).on('click','[data-event="edit"]',function(){
|
||||
let id = $(this).data('id');
|
||||
let mdcontent=$('#comment_'+id).data('mdcontent');
|
||||
comment.editor(id,detail_id,0,0,'project',mdcontent);
|
||||
})
|
||||
|
||||
//删除
|
||||
$('#comment_project_'+detail_id).on('click','[data-event="del"]',function(){
|
||||
let id = $(this).data('id');
|
||||
comment.del(id,detail_id,'project');
|
||||
})
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,68 @@
|
||||
<div class="table-content">
|
||||
<div class="layui-form-bar border-t border-x">
|
||||
<button class="layui-btn layui-btn-sm add-new">+ 新建文档</button>
|
||||
</div>
|
||||
<table class="layui-hide" id="test" lay-filter="test"></table>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="barDemo">
|
||||
<div class="layui-btn-group"><span class="layui-btn layui-btn-normal layui-btn-xs" lay-event="view">查看</span><span class="layui-btn layui-btn-xs" lay-event="edit">编辑</span><span class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</span></div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
function pageInit(){
|
||||
var project_id = {$id};
|
||||
var table = layui.table,tool = layui.tool;
|
||||
|
||||
layui.documentTable = table.render({
|
||||
elem: '#test',
|
||||
title: '文档列表',
|
||||
cellMinWidth:200,
|
||||
url: "/api/document/get_list", //数据接口
|
||||
where:{'m':'project','tid':project_id},
|
||||
page: true, //开启分页
|
||||
limit: 20,
|
||||
cols: [[
|
||||
{field:'id', title: 'ID编号',width: 80, align:'center'}
|
||||
,{field:'title',title: '标题'}
|
||||
,{field:'name',title: '创建人', align:'center',width: 100}
|
||||
,{field:'create_time',title: '创建时间',align:'center',width: 150}
|
||||
,{field:'update_time',title: '最后更新时间', align:'center',width: 150}
|
||||
,{title: '操作',align: 'center',width: 136,toolbar: '#barDemo',}
|
||||
]]
|
||||
});
|
||||
|
||||
//新增
|
||||
$('.add-new').on('click',function(){
|
||||
tool.open('/api/document/add?project_id='+project_id);
|
||||
});
|
||||
|
||||
//监听行工具事件
|
||||
table.on('tool(test)', function(obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'view') {
|
||||
tool.open('/api/document/view?id='+data.id);
|
||||
return;
|
||||
}
|
||||
if (obj.event === 'edit') {
|
||||
tool.open('/api/document/add?id='+data.id);
|
||||
return;
|
||||
}
|
||||
if (obj.event === 'del') {
|
||||
layer.confirm('确定删除该文档吗?', {
|
||||
icon: 3,
|
||||
title: '提示'
|
||||
}, function(index) {
|
||||
let callback = function (e) {
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
obj.del();
|
||||
}
|
||||
}
|
||||
tool.delete("/api/document/delete",{ id: obj.data.id,'module':'project'},callback);
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,78 @@
|
||||
<div class="table-content">
|
||||
<div id="logList" class="log-timeline layui-card p-3"></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function pageInit(){
|
||||
var project_id = {$id};
|
||||
var project_page = 1;
|
||||
var tool = layui.tool;
|
||||
let callback = function(res){
|
||||
$('.log-more').remove();
|
||||
if(res.code==0 && res.data.length>0){
|
||||
let itemLog = '',log_time='';
|
||||
$.each(res.data, function (index, item) {
|
||||
let link="",detail = "";
|
||||
if(log_time != item.create_time){
|
||||
if(log_time==''){
|
||||
itemLog+='<dl><dt><span class="date-second-point"></span>'+item.create_time+'</dt>'
|
||||
}
|
||||
else{
|
||||
itemLog+='</dl><dl><dt><span class="date-second-point"></span>'+item.create_time+'</dt>'
|
||||
}
|
||||
log_time = item.create_time;
|
||||
}
|
||||
|
||||
if(item.topic_title != ''){
|
||||
link='<a class="'+item.module+' open-a" data-href="'+item.url+'">'+item.topic+' '+item.topic_title+'</a>';
|
||||
}
|
||||
if(item.field =='new' || item.field =='delete'){
|
||||
detail= `
|
||||
<span class="log-content font-gray">${item.action}了项目${item.module_name}${link}</strong><span class="ml-4 font-gray" title="${item.create_time}">${item.times}</span>
|
||||
`;
|
||||
}
|
||||
else if(item.field =='content'){
|
||||
detail= `
|
||||
<span class="log-content font-gray">${item.action}了<strong>${item.title}</strong><i title="对比查看" class="iconfont icon-yuejuan" style="color:#1E9FFF; cursor: pointer;"></i> <span class="ml-4 font-gray" title="${item.create_time}">${item.times}</span></span>
|
||||
`;
|
||||
}
|
||||
else if(item.field =='file'|| item.field =='link' || item.field =='user'){
|
||||
detail= `
|
||||
<span class="log-content font-gray">${item.action}了${item.title}<strong>${item.new_content}</strong><span class="ml-4 font-gray" title="${item.create_time}">${item.times}</span></span>
|
||||
`;
|
||||
}
|
||||
else if(item.field =='document'){
|
||||
if(item.action =='修改'){
|
||||
detail= `
|
||||
<span class="log-content font-gray">项目${item.module_name}${link}${item.action}了${item.title}<strong>${item.remark}</strong><i title="对比查看" class="iconfont icon-yuejuan" style="color:#1E9FFF; cursor: pointer;"></i> <span class="ml-4 font-gray" title="${item.create_time}">${item.times}</span></span>
|
||||
`;
|
||||
}
|
||||
else{
|
||||
detail= `
|
||||
<span class="log-content font-gray">项目${item.module_name}${link}${item.action}了${item.title}<strong>${item.remark}</strong><span class="ml-4 font-gray" title="${item.create_time}">${item.times}</span></span>
|
||||
`;
|
||||
}
|
||||
}
|
||||
else{
|
||||
detail= `
|
||||
<span class="log-content font-gray">将项目${item.module_name}${link}<strong>${item.title}</strong>从 ${item.old_content} ${item.action}为<strong>${item.new_content}</strong><span class="ml-4 font-gray" title="${item.create_time}">${item.times}</span></span>
|
||||
`;
|
||||
}
|
||||
itemLog+= `
|
||||
<dd><img src="${item.thumb}" class="log-thumb" /><span class="log-name">${item.name}</span>${detail}</dd>
|
||||
`;
|
||||
});
|
||||
itemLog+='</dl>';
|
||||
if(res.data.length>19){
|
||||
itemLog+='<div class="py-3 log-more"><button class="layui-btn layui-btn-normal layui-btn-sm" type="button">查看更多项目动态</button></div>';
|
||||
}
|
||||
$("#logList").append(itemLog);
|
||||
}
|
||||
}
|
||||
tool.get("/api/log/log_list",{topic_id:project_id,page:project_page},callback);
|
||||
$('#logList').on('click','.log-more',function(){
|
||||
project_page++;
|
||||
tool.get("/api/log/log_list",{topic_id:project_id,page:project_page},callback);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,74 @@
|
||||
<div class="table-content">
|
||||
<!-- <div class="layui-form-bar border-t border-x">
|
||||
<button class="layui-btn layui-btn-sm add-new">+ 新建机器人</button>
|
||||
</div> -->
|
||||
<div>
|
||||
<form class="layui-form layui-form-pane" action="">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">项目id</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" value="{$id}" autocomplete="off" readonly disabled placeholder="请输入webhook" lay-verify="required"
|
||||
class="layui-input">
|
||||
<input type="hidden" id="projectId" value="{$id}">
|
||||
<input type="hidden" id="robots" value="robot">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">机器人地址</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="ddurl" autocomplete="off" lay-verify="required"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<button class="layui-btn layui-btn-sm edit">修改</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
function pageInit() { }
|
||||
$(document).ready(function () {
|
||||
var id = $('#projectId').val();
|
||||
var robot = $('#robots').val();
|
||||
// 获取数据并填充到输入框
|
||||
$.ajax({
|
||||
url: '/api/project/getddurl', // 接口地址
|
||||
type: 'GET', // 请求类型
|
||||
data: {
|
||||
id: id,
|
||||
page: robot,
|
||||
},
|
||||
success: function (data) {
|
||||
$('input[name="ddurl"]').val(data.ddurl); // 填充数据
|
||||
},
|
||||
error: function () {
|
||||
alert('获取数据失败!');
|
||||
}
|
||||
});
|
||||
|
||||
// 修改按钮点击事件
|
||||
$('.edit').click(function (e) {
|
||||
e.preventDefault(); // 阻止表单默认提交
|
||||
var updatedUrl = $('input[name="ddurl"]').val(); // 获取修改后的值
|
||||
$.ajax({
|
||||
url: '/api/project/getddurl', // 提交修改的接口地址
|
||||
type: 'POST', // 请求类型
|
||||
data: {
|
||||
id: id,
|
||||
ddurl: updatedUrl
|
||||
},
|
||||
success: function (response) {
|
||||
alert('修改成功!');
|
||||
},
|
||||
error: function () {
|
||||
alert('修改失败!');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,91 @@
|
||||
<div class="table-content" id="scheduleList">
|
||||
<div class="layui-form-bar border-t border-x">
|
||||
<form class="layui-form">
|
||||
<div class="layui-input-inline" style="width:110px;">
|
||||
<input type="text" name="username" placeholder="请选择员工" class="layui-input" readonly
|
||||
data-event="select" />
|
||||
<input type="text" name="uid" value="" style="display:none" />
|
||||
</div>
|
||||
<div class="layui-input-inline" style="width:220px;">
|
||||
<input type="text" name="keywords" placeholder="输入工作内容" class="layui-input" />
|
||||
</div>
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交搜索</button><button
|
||||
type="reset" class="gougu-clear" lay-filter="clear">清空</button>
|
||||
</form>
|
||||
</div>
|
||||
<table class="layui-hide" id="scheduleApi" lay-filter="schedule"></table>
|
||||
</div>
|
||||
<script>
|
||||
function pageInit() {
|
||||
var table = layui.table, form = layui.form, tool = layui.tool, employeepicker = layui.employeepicker, schedule = layui.gouguSchedule;
|
||||
|
||||
layui.scheduleTable = table.render({
|
||||
elem: '#scheduleApi',
|
||||
title: '工作记录列表',
|
||||
cellMinWidth: 200,
|
||||
url: "/api/schedule/index", //数据接口
|
||||
where: { 'tid': project_id },
|
||||
page: true, //开启分页
|
||||
limit: 20,
|
||||
cols: [[ //表头
|
||||
{ field: 'id', title: '序号', width: 80, align: 'center' }
|
||||
// , {
|
||||
// field: 'start_time', title: '工作时间范围', align: 'center', width: 186, templet: function (d) {
|
||||
// var html = d.start_time + '至' + d.end_time;
|
||||
// return html;
|
||||
// }
|
||||
// }
|
||||
// , { field: 'labor_time', title: '工时', style: 'color: #91CC75;', align: 'center', width: 60 }
|
||||
, { field: 'work_cate', title: '工作类型', align: 'center', width: 100 }
|
||||
, { field: 'title', title: '工作内容' }
|
||||
, { field: 'name', title: '执行员工', align: 'center', width: 80 }
|
||||
, { field: 'department', title: '所在部门', align: 'center', width: 100 }
|
||||
, { field: 'create_time', title: '记录时间', align: 'center', width: 150 }
|
||||
, {title: '操作',fixed:'right', align: 'center', width: 100, templet: function (d) {
|
||||
return '<div class="layui-btn-group"><span class="layui-btn layui-btn-xs" lay-event="edit">修改</span><span class="layui-btn layui-btn-normal layui-btn-xs" lay-event="view">详细</span></div>';
|
||||
}
|
||||
}
|
||||
]]
|
||||
});
|
||||
|
||||
// 选择员工
|
||||
$('.layui-form-bar').on('click', '[data-event="select"]', function () {
|
||||
var that = $(this);
|
||||
var names = that.val(), ids = $('[name="uid"]').val();
|
||||
employeepicker.init({
|
||||
ids: ids,
|
||||
names: names,
|
||||
type: 0,
|
||||
department_url: "/api/index/get_department_tree",
|
||||
employee_url: "/api/index/get_employee",
|
||||
callback: function (ids, names, dids, departments) {
|
||||
$('[name="uid"]').val(ids);
|
||||
that.val(names);
|
||||
$('[lay-filter="webform"]').click();
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
//监听搜索提交
|
||||
form.on('submit(webform)', function (data) {
|
||||
let f = data.field;
|
||||
layui.scheduleTable.reload({ where: { keywords: f.keywords, uid: f.uid, tid: project_id }, page: { curr: 1 } });
|
||||
return false;
|
||||
});
|
||||
$('#scheduleList').on('click', '[lay-filter="clear"]', function () {
|
||||
setTimeout(function () {
|
||||
$('[lay-filter="webform"]').click();
|
||||
}, 10)
|
||||
})
|
||||
//监听行工具事件
|
||||
table.on('tool(schedule)', function (obj) {
|
||||
if (obj.event === 'edit') {
|
||||
schedule.add(0, obj.data);
|
||||
}
|
||||
if (obj.event === 'view') {
|
||||
schedule.view(obj.data);
|
||||
}
|
||||
return false;
|
||||
})
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,141 @@
|
||||
<div class="table-content">
|
||||
<div class="layui-form-bar border-t border-x">
|
||||
<div class="project_task_btn">
|
||||
<form id="taskForm" class="layui-form">
|
||||
<button class="layui-btn layui-btn-sm add-new layui-bg-blue">+ 新建任务</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary layui-border-blue layui-btn-sm"
|
||||
lay-filter="clear">
|
||||
重置
|
||||
</button>
|
||||
<button type="reset" class="layui-btn layui-btn-sm" lay-filter="onlyme">只看我</button>
|
||||
<input id="loginusers" type="hidden" value="{$user_info.id}" />
|
||||
<input id="project_id" type="hidden" value="{$id}" />
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<table class="layui-hide" id="test" lay-filter="test"></table>
|
||||
</div>
|
||||
<script>
|
||||
function pageInit() {
|
||||
var project_id = document.getElementById('project_id').value;
|
||||
console.log('项目id:' + project_id);
|
||||
var table = layui.table, tool = layui.tool;
|
||||
layui.taskTable = table.render({
|
||||
elem: '#test',
|
||||
title: '任务列表',
|
||||
cellMinWidth: 200,
|
||||
url: "/task/index/index",
|
||||
where: { 'project_id': project_id },
|
||||
page: true, //开启分页
|
||||
limit: 20,
|
||||
cols: [[
|
||||
{ field: 'id', title: '任务编号', width: 80, align: 'center', fixed: 'left' }
|
||||
, {
|
||||
field: 'flow_name', title: '状态', align: 'center', width: 80, templet: function (d) {
|
||||
var html = '<span class="layui-badge bg-flow-' + d.flow_status + '">' + d.flow_name + '</span>';
|
||||
return html;
|
||||
}
|
||||
}
|
||||
, {
|
||||
field: 'type_name', title: '类型', width: 120, align: 'center', templet: function (d) {
|
||||
var html = '<span class="color-status-' + d.type + '">' + d.type_name + '</span>';
|
||||
return html;
|
||||
}
|
||||
}
|
||||
, {
|
||||
field: 'title', title: '任务主题', rowspan: 2, align: 'center', templet: function (d) {
|
||||
var html = '<div class="rwzt"><span class="layui-badge bg-priority-' + d.priority + '">' + d.priority_name + '</span> <a class="open-a" data-href="/task/index/view/id/' + d.id + '">' + d.title + '</a></div>';
|
||||
return html;
|
||||
}
|
||||
}
|
||||
, { field: 'director_name', title: '负责人', align: 'center', width: 80 }
|
||||
, { field: 'creater_name', title: '创建人', align: 'center', width: 80 }
|
||||
, {
|
||||
field: "flow_name",
|
||||
title: "完成进度",
|
||||
align: "center",
|
||||
width: 150,
|
||||
templet: function (d) {
|
||||
var progress =
|
||||
'<div class="layui-progress layui-progress-big" lay-showpercent="true">';
|
||||
if (d.flow_status == 1) {
|
||||
progress +=
|
||||
'<div class="layui-progress-bar layui-bg-red" lay-percent="0% style="width:0%;text-align:center;">0%</div>';
|
||||
} else if (d.flow_status == 2) {
|
||||
progress +=
|
||||
'<div class="layui-progress-bar layui-bg-orange" lay-percent="50%" style="width:50%;text-align:center;">50%</div>';
|
||||
} else if (d.flow_status == 3) {
|
||||
progress +=
|
||||
'<div class="layui-progress-bar layui-bg-green" lay-percent="100%" style="width:100%;text-align:center;">100%</div>';
|
||||
} else {
|
||||
progress +=
|
||||
'<div class="layui-progress-bar layui-bg-gray" lay-percent="0%" style="width:0%;text-align:center;">0%</div>';
|
||||
}
|
||||
progress += "</div>";
|
||||
return progress;
|
||||
},
|
||||
}
|
||||
, {
|
||||
field: 'end_time', title: '预计结束日期', align: 'center', width: 150, templet: function (d) {
|
||||
var html = d.end_time;
|
||||
if (d.delay > 0) {
|
||||
html += '<span class="color-status-0 ml-1" style="font-size:12px;">逾期' + d.delay + '天</span>';
|
||||
}
|
||||
return html;
|
||||
}
|
||||
}
|
||||
]]
|
||||
});
|
||||
|
||||
//监听搜索提交
|
||||
$("#taskForm").on("click", '[lay-filter="clear"]', function () {
|
||||
setTimeout(function () {
|
||||
tableReload();
|
||||
}, 10);
|
||||
});
|
||||
//只看我按钮代码
|
||||
$("#taskForm").on("click", '[lay-filter="onlyme"]', function () {
|
||||
let loginuser = $("#loginusers").val();
|
||||
let postData = {
|
||||
type: $("#taskForm").find('[name="type"]').val(),
|
||||
flow_status: $("#taskForm").find('[name="flow_status"]').val(),
|
||||
priority: $("#taskForm").find('[name="priority"]').val(),
|
||||
cate: $("#taskForm").find('[name="cate"]').val(),
|
||||
delay: $("#taskForm").find('[name="delay"]').val(),
|
||||
// director_uid: $("#taskForm").find('[name="director_uid"]').val(),
|
||||
project_id: $("#taskForm").find('[name="project_id"]').val(),
|
||||
keywords: $("#taskForm").find('[name="keywords"]').val(),
|
||||
belong_project: $("#taskForm").find('[name="belong_project"]').val(),
|
||||
creater_name: $("#taskForm").find('[name="creater_name"]').val(),
|
||||
admin_id: $("#taskForm").find('[name="admin_id"]').val(),
|
||||
director_uid: loginuser,
|
||||
};
|
||||
layui.taskTable.reload({ where: postData });
|
||||
});
|
||||
|
||||
//刷新表格
|
||||
function tableReload() {
|
||||
let project_id = $("#project_id").val();
|
||||
let postData = {
|
||||
type: $("#taskForm").find('[name="type"]').val(),
|
||||
flow_status: $("#taskForm").find('[name="flow_status"]').val(),
|
||||
priority: $("#taskForm").find('[name="priority"]').val(),
|
||||
cate: $("#taskForm").find('[name="cate"]').val(),
|
||||
delay: $("#taskForm").find('[name="delay"]').val(),
|
||||
director_uid: $("#taskForm").find('[name="director_uid"]').val(),
|
||||
project_id: project_id,
|
||||
keywords: $("#taskForm").find('[name="keywords"]').val(),
|
||||
belong_project: $("#taskForm").find('[name="belong_project"]').val(),
|
||||
creater_name: $("#taskForm").find('[name="creater_name"]').val(),
|
||||
admin_id: $("#taskForm").find('[name="creater_id"]').val(),
|
||||
};
|
||||
layui.taskTable.reload({ where: postData });
|
||||
}
|
||||
|
||||
//新增
|
||||
$('.add-new').on('click', function () {
|
||||
tool.open('/task/index/add?project_id=' + project_id);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,107 @@
|
||||
<div class="table-content" id="scheduleList">
|
||||
<div class="layui-form-bar border-t border-x">
|
||||
<button class="layui-btn layui-btn-sm add-user">+ 新增项目成员</button>
|
||||
</div>
|
||||
<table class="layui-hide" id="user" lay-filter="user"></table>
|
||||
</div>
|
||||
<script>
|
||||
function pageInit() {
|
||||
var project_id = '{$id}';
|
||||
var table = layui.table, tool = layui.tool, employeepicker = layui.employeepicker;
|
||||
|
||||
layui.userTable = table.render({
|
||||
elem: '#user',
|
||||
title: '项目成员列表',
|
||||
cellMinWidth: 120,
|
||||
url: "/api/project/user", //数据接口
|
||||
where: { 'tid': project_id },
|
||||
page: false, //开启分页
|
||||
limit: 20,
|
||||
cols: [[ //表头
|
||||
{ field: 'name', fixed: 'left', title: '成员姓名', width: 90, rowspan: 2 }
|
||||
, { field: 'create_time', title: '进入项目日期', width: 110, align: 'center', rowspan: 2 }
|
||||
, { field: 'role', title: '角色', align: 'center', width: 90, rowspan: 2, templet: function (d) {
|
||||
var html='<span style="color: #4285F4;">普通成员</span>';
|
||||
if(d.role==1){
|
||||
html='<span style="color: #EE6666;">项目创建人</span>';
|
||||
}
|
||||
if(d.role==2){
|
||||
html='<span style="color: #91CC75;">项目负责人</span>';
|
||||
}
|
||||
return html;
|
||||
}}
|
||||
, { field: 'position', title: '职位', align: 'center', width: 100, rowspan: 2 }
|
||||
, { field: 'department', title: '所在部门', align: 'center', width: 120, rowspan: 2 }
|
||||
, { field: 'mobile', title: '手机号码', align: 'center', width: 110, rowspan: 2 }
|
||||
, { field: 'email', title: '电子邮箱', align: 'center', rowspan: 2 }
|
||||
, { align: 'center', title: '工作记录', colspan: 2 }
|
||||
, { align: 'center', title: '项目任务', colspan: 3 }
|
||||
, { align: 'center', title: 'BUG缺陷', colspan: 3 }
|
||||
, { field: 'delete_time', title: '移除日期', align: 'center', width: 110, rowspan: 2 }
|
||||
, { field: 'status',fixed: 'right', title: '状态', align: 'center', width: 60, rowspan: 2, templet: function (d) {
|
||||
var html = '<span style="color:#EE6666">✘</span>';
|
||||
if(d.delete_time == 0)
|
||||
html = '<span style="color:#91CC75">✔</span>';
|
||||
return html;
|
||||
}}
|
||||
, {title: '操作',fixed: 'right', align: 'center', width: 60, rowspan: 2, templet: function (d) {
|
||||
var html = '<span class="layui-btn layui-btn-xs" lay-event="recover">恢复</span>';
|
||||
if(d.delete_time == 0)
|
||||
html = '<span class="layui-btn layui-btn-danger layui-btn-xs" lay-event="remove">移除</span>';
|
||||
return html;
|
||||
}
|
||||
}
|
||||
], [
|
||||
{ field: 'schedules', align: 'center', style: 'color: #91CC75;', width: 72, 'title': '记录' }
|
||||
, { field: 'labor_times', align: 'center', style: 'color: #4285F4;', width: 70, 'title': '工时' }
|
||||
, { field: 'tasks_a_unfinish', align: 'center', style: 'color: #91CC75;', width: 72, 'title': '进行中' }
|
||||
, { field: 'tasks_a_finish', align: 'center', style: 'color: #FAC858;', width: 70, 'title': '已完成' }
|
||||
, { field: 'tasks_a_pensent', align: 'center', style: 'color: #EE6666;', width: 72, 'title': '完成率' }
|
||||
, { field: 'tasks_b_unfinish', align: 'center', style: 'color: #91CC75;', width: 72, 'title': '进行中' }
|
||||
, { field: 'tasks_b_finish', align: 'center', style: 'color: #FAC858;', width: 72, 'title': '已完成' }
|
||||
, { field: 'tasks_b_pensent', align: 'center', style: 'color: #EE6666;', width: 72, 'title': '修复率' }
|
||||
]]
|
||||
});
|
||||
|
||||
// 选择员工
|
||||
$('.layui-form-bar').on('click', '.add-user', function () {
|
||||
employeepicker.init({
|
||||
type: 0,
|
||||
department_url: "/api/index/get_department_tree",
|
||||
employee_url: "/api/index/get_employee",
|
||||
callback: function (ids, names, dids, departments) {
|
||||
let callback = function (e) {
|
||||
layer.msg(e.msg);
|
||||
if(e.code == 0){
|
||||
tool.page('/api/project/view/id/'+project_id+'?page=user');
|
||||
}
|
||||
}
|
||||
tool.post("/api/project/add_user", {uid: ids,project_id: project_id}, callback);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
//监听行工具事件
|
||||
table.on('tool(user)', function (obj) {
|
||||
let postData = { "id": obj.data.id };
|
||||
let callback = function (e) {
|
||||
layer.closeAll();
|
||||
layer.msg(e.msg);
|
||||
if(e.code == 0){
|
||||
tool.page('/api/project/view/id/'+project_id+'?page=user');
|
||||
}
|
||||
}
|
||||
if (obj.event === 'remove') {
|
||||
layer.confirm('确定要移除该项目成员吗?', { icon: 3, title: '提示' }, function (index) {
|
||||
tool.delete("/api/project/remove_user", postData, callback);
|
||||
});
|
||||
}
|
||||
if (obj.event === 'recover') {
|
||||
layer.confirm('确定要恢复该项目成员吗?', { icon: 3, title: '提示' }, function (index) {
|
||||
tool.post("/api/project/recover_user", postData, callback);
|
||||
});
|
||||
}
|
||||
return;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user