修复
This commit is contained in:
parent
4880420620
commit
8c2cb05cff
@ -1,11 +1,15 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2021 勾股工作室
|
||||
* @license https://opensource.org/licenses/GPL-3.0
|
||||
* @link https://www.gougucms.com
|
||||
*/
|
||||
declare (strict_types = 1);
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\project\model\ProjectTask as TaskList;
|
||||
use app\api\BaseController;
|
||||
use think\facade\Db;
|
||||
@ -20,18 +24,16 @@ class Index extends BaseController
|
||||
$param = get_params();
|
||||
//var_dump($param);exit;
|
||||
$sourse = 'file';
|
||||
if(isset($param['sourse'])){
|
||||
if (isset($param['sourse'])) {
|
||||
$sourse = $param['sourse'];
|
||||
}
|
||||
if($sourse == 'file' || $sourse == 'tinymce'){
|
||||
if(request()->file('file')){
|
||||
if ($sourse == 'file' || $sourse == 'tinymce') {
|
||||
if (request()->file('file')) {
|
||||
$file = request()->file('file');
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
return to_assign(1, '没有选择上传文件');
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
if (request()->file('editormd-image-file')) {
|
||||
$file = request()->file('editormd-image-file');
|
||||
} else {
|
||||
@ -99,16 +101,14 @@ class Index extends BaseController
|
||||
$res['filename'] = $data['filename'];
|
||||
$res['filesize'] = $data['filesize'];
|
||||
$res['fileext'] = $data['fileext'];
|
||||
add_log('upload', $data['user_id'], $data,'文件');
|
||||
if($sourse == 'editormd'){
|
||||
add_log('upload', $data['user_id'], $data, '文件');
|
||||
if ($sourse == 'editormd') {
|
||||
//editormd编辑器上传返回
|
||||
return json(['success'=>1,'message'=>'上传成功','url'=>$data['filepath']]);
|
||||
}
|
||||
else if($sourse == 'tinymce'){
|
||||
return json(['success' => 1, 'message' => '上传成功', 'url' => $data['filepath']]);
|
||||
} else if ($sourse == 'tinymce') {
|
||||
//tinymce编辑器上传返回
|
||||
return json(['success'=>1,'message'=>'上传成功','location'=>$data['filepath']]);
|
||||
}
|
||||
else{
|
||||
return json(['success' => 1, 'message' => '上传成功', 'location' => $data['filepath']]);
|
||||
} else {
|
||||
//普通上传返回
|
||||
return to_assign(0, '上传成功', $res);
|
||||
}
|
||||
@ -169,22 +169,21 @@ class Index extends BaseController
|
||||
{
|
||||
$keyword = get_params('keyword');
|
||||
$selected = [];
|
||||
if(!empty($keyword)){
|
||||
$selected = explode(",",$keyword);
|
||||
if (!empty($keyword)) {
|
||||
$selected = explode(",", $keyword);
|
||||
}
|
||||
$department = get_department();
|
||||
$list = get_select_tree($department, 0,0,$selected);
|
||||
return to_assign(0, '',$list);
|
||||
$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){
|
||||
if ($did == 1) {
|
||||
$department = $did;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$department = get_department_son($did);
|
||||
}
|
||||
$employee = Db::name('admin')
|
||||
@ -207,7 +206,7 @@ class Index extends BaseController
|
||||
if (!empty($param['keywords'])) {
|
||||
$where[] = ['a.name', 'like', '%' . $param['keywords'] . '%'];
|
||||
}
|
||||
if(!empty($param['ids'])){
|
||||
if (!empty($param['ids'])) {
|
||||
$where[] = ['a.id', 'notin', $param['ids']];
|
||||
}
|
||||
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
||||
@ -226,17 +225,17 @@ class Index extends BaseController
|
||||
{
|
||||
$keyword = get_params('keyword');
|
||||
$selected = [];
|
||||
if(!empty($keyword)){
|
||||
$selected = explode(",",$keyword);
|
||||
if (!empty($keyword)) {
|
||||
$selected = explode(",", $keyword);
|
||||
}
|
||||
$employee = Db::name('admin')
|
||||
->field('id as value,name')
|
||||
->where(['status' => 1])
|
||||
->select()->toArray();
|
||||
|
||||
foreach($employee as $k => &$v){
|
||||
foreach ($employee as $k => &$v) {
|
||||
$v['selected'] = '';
|
||||
if(in_array($v['value'],$selected)){
|
||||
if (in_array($v['value'], $selected)) {
|
||||
$v['selected'] = 'selected';
|
||||
}
|
||||
}
|
||||
@ -251,24 +250,24 @@ class Index extends BaseController
|
||||
}
|
||||
|
||||
//获取审核类型
|
||||
public function get_flow_cate($type=0)
|
||||
public function get_flow_cate($type = 0)
|
||||
{
|
||||
$flows = Db::name('FlowType')->where(['type'=>$type,'status'=>1])->select()->toArray();
|
||||
$flows = Db::name('FlowType')->where(['type' => $type, 'status' => 1])->select()->toArray();
|
||||
return to_assign(0, '', $flows);
|
||||
}
|
||||
//获取审核步骤人员
|
||||
public function get_flow_users($id=0)
|
||||
public function get_flow_users($id = 0)
|
||||
{
|
||||
$flow = Db::name('Flow')->where(['id' => $id])->find();
|
||||
$flowData = unserialize($flow['flow_list']);
|
||||
if(!empty($flowData)){
|
||||
if (!empty($flowData)) {
|
||||
foreach ($flowData as $key => &$val) {
|
||||
$val['user_id_info'] = Db::name('Admin')->field('id,name,thumb')->where('id','in',$val['flow_uids'])->select()->toArray();
|
||||
$val['user_id_info'] = Db::name('Admin')->field('id,name,thumb')->where('id', 'in', $val['flow_uids'])->select()->toArray();
|
||||
}
|
||||
}
|
||||
$data['copy_uids'] = $flow['copy_uids'];
|
||||
$data['copy_unames'] ='';
|
||||
if($flow['copy_uids']!=''){
|
||||
$data['copy_unames'] = '';
|
||||
if ($flow['copy_uids'] != '') {
|
||||
$copy_unames = Db::name('Admin')->where('id', 'in', $flow['copy_uids'])->column('name');
|
||||
$data['copy_unames'] = implode(',', $copy_unames);
|
||||
}
|
||||
@ -277,17 +276,17 @@ class Index extends BaseController
|
||||
}
|
||||
|
||||
//获取审核流程节点
|
||||
public function get_flow_nodes($id=0,$type=1)
|
||||
public function get_flow_nodes($id = 0, $type = 1)
|
||||
{
|
||||
$flows = Db::name('FlowStep')->where(['action_id'=>$id,'type'=>$type,'delete_time'=>0])->order('sort asc')->select()->toArray();
|
||||
$flows = Db::name('FlowStep')->where(['action_id' => $id, 'type' => $type, 'delete_time' => 0])->order('sort asc')->select()->toArray();
|
||||
foreach ($flows as $key => &$val) {
|
||||
$user_id_info = Db::name('Admin')->field('id,name,thumb')->where('id','in',$val['flow_uids'])->select()->toArray();
|
||||
$user_id_info = Db::name('Admin')->field('id,name,thumb')->where('id', 'in', $val['flow_uids'])->select()->toArray();
|
||||
foreach ($user_id_info as $k => &$v) {
|
||||
$v['check_time'] = 0;
|
||||
$v['content'] = '';
|
||||
$v['status'] = 0;
|
||||
$check_array = Db::name('FlowRecord')->where(['check_user_id' => $v['id'],'step_id' => $val['id']])->order('check_time desc')->select()->toArray();
|
||||
if(!empty($check_array)){
|
||||
$check_array = Db::name('FlowRecord')->where(['check_user_id' => $v['id'], 'step_id' => $val['id']])->order('check_time desc')->select()->toArray();
|
||||
if (!empty($check_array)) {
|
||||
$checked = $check_array[0];
|
||||
$v['check_time'] = date('Y-m-d H:i', $checked['check_time']);
|
||||
$v['content'] = $checked['content'];
|
||||
@ -311,13 +310,13 @@ class Index extends BaseController
|
||||
}
|
||||
|
||||
//获取审核流程节点
|
||||
public function get_flow_record($id=0,$type=1)
|
||||
public function get_flow_record($id = 0, $type = 1)
|
||||
{
|
||||
$check_list = Db::name('FlowRecord')
|
||||
->field('f.*,a.name,a.thumb')
|
||||
->alias('f')
|
||||
->join('Admin a', 'a.id = f.check_user_id', 'left')
|
||||
->where(['f.action_id'=>$id,'f.type'=>$type])
|
||||
->where(['f.action_id' => $id, 'f.type' => $type])
|
||||
->order('check_time asc')
|
||||
->select()->toArray();
|
||||
foreach ($check_list as $kk => &$vv) {
|
||||
@ -334,80 +333,72 @@ class Index extends BaseController
|
||||
$type = $param['type'];
|
||||
$detail = [];
|
||||
$subject = '一个审批';
|
||||
if($type==1){
|
||||
if ($type == 1) {
|
||||
//日常审核
|
||||
$detail = Db::name('Approve')->where(['id' => $id])->find();
|
||||
$subject = '一个日常审批';
|
||||
$msg_title_type = $detail['type'];
|
||||
}
|
||||
else if($type==2){
|
||||
} else if ($type == 2) {
|
||||
//报销审核
|
||||
$detail = Db::name('Expense')->where(['id' => $id])->find();
|
||||
$subject = '一个报销审批';
|
||||
$msg_title_type = 22;
|
||||
}
|
||||
else if($type==3){
|
||||
} else if ($type == 3) {
|
||||
//发票审核
|
||||
$detail = Db::name('Invoice')->where(['id' => $id])->find();
|
||||
$subject = '一个发票审批';
|
||||
$msg_title_type = 23;
|
||||
}
|
||||
else if($type==4){
|
||||
} else if ($type == 4) {
|
||||
//合同审核
|
||||
$detail = Db::name('Contract')->where(['id' => $id])->find();
|
||||
$subject = '一个合同审批';
|
||||
$msg_title_type = 24;
|
||||
}
|
||||
if (empty($detail)){
|
||||
return to_assign(1,'审批数据错误');
|
||||
if (empty($detail)) {
|
||||
return to_assign(1, '审批数据错误');
|
||||
}
|
||||
//当前审核节点详情
|
||||
$step = Db::name('FlowStep')->where(['action_id'=>$id,'type'=>$type,'sort'=>$detail['check_step_sort'],'delete_time'=>0])->find();
|
||||
$step = Db::name('FlowStep')->where(['action_id' => $id, 'type' => $type, 'sort' => $detail['check_step_sort'], 'delete_time' => 0])->find();
|
||||
|
||||
//审核通过
|
||||
if($param['check'] == 1){
|
||||
if ($param['check'] == 1) {
|
||||
$check_admin_ids = explode(",", strval($detail['check_admin_ids']));
|
||||
if (!in_array($this->uid, $check_admin_ids)){
|
||||
return to_assign(1,'您没权限审核该审批');
|
||||
if (!in_array($this->uid, $check_admin_ids)) {
|
||||
return to_assign(1, '您没权限审核该审批');
|
||||
}
|
||||
|
||||
//多人会签审批
|
||||
if($step['flow_type'] == 4){
|
||||
if ($step['flow_type'] == 4) {
|
||||
//查询当前会签记录数
|
||||
$check_count = Db::name('FlowRecord')->where(['action_id'=>$id,'type'=>$type,'step_id'=>$step['id']])->count();
|
||||
$check_count = Db::name('FlowRecord')->where(['action_id' => $id, 'type' => $type, 'step_id' => $step['id']])->count();
|
||||
//当前会签记应有记录数
|
||||
$flow_count = explode(',', $step['flow_uids']);
|
||||
if(($check_count+1) >=count($flow_count)){
|
||||
$next_step = Db::name('FlowStep')->where(['action_id'=>$id,'type'=>$type,'sort'=>($detail['check_step_sort']+1),'delete_time'=>0])->find();
|
||||
if($next_step){
|
||||
if (($check_count + 1) >= count($flow_count)) {
|
||||
$next_step = Db::name('FlowStep')->where(['action_id' => $id, 'type' => $type, 'sort' => ($detail['check_step_sort'] + 1), 'delete_time' => 0])->find();
|
||||
if ($next_step) {
|
||||
//存在下一步审核
|
||||
if($next_step['flow_type'] == 1){
|
||||
if ($next_step['flow_type'] == 1) {
|
||||
$param['check_admin_ids'] = get_department_leader($detail['admin_id']);
|
||||
}
|
||||
else if($next_step['flow_type'] == 2){
|
||||
$param['check_admin_ids'] = get_department_leader($detail['admin_id'],1);
|
||||
}
|
||||
else{
|
||||
} else if ($next_step['flow_type'] == 2) {
|
||||
$param['check_admin_ids'] = get_department_leader($detail['admin_id'], 1);
|
||||
} else {
|
||||
$param['check_admin_ids'] = $next_step['flow_uids'];
|
||||
}
|
||||
$param['check_step_sort'] = $detail['check_step_sort']+1;
|
||||
$param['check_step_sort'] = $detail['check_step_sort'] + 1;
|
||||
$param['check_status'] = 1;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
//不存在下一步审核,审核结束
|
||||
$param['check_status'] = 2;
|
||||
$param['check_admin_ids'] ='';
|
||||
$param['check_admin_ids'] = '';
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$param['check_status'] = 1;
|
||||
$param['check_admin_ids'] = $step['flow_uids'];
|
||||
}
|
||||
}
|
||||
else if($step['flow_type'] == 0){
|
||||
} else if ($step['flow_type'] == 0) {
|
||||
//自由人审批
|
||||
if($param['check_node'] == 2){
|
||||
$next_step = $detail['check_step_sort']+1;
|
||||
if ($param['check_node'] == 2) {
|
||||
$next_step = $detail['check_step_sort'] + 1;
|
||||
$flow_step = array(
|
||||
'action_id' => $id,
|
||||
'sort' => $next_step,
|
||||
@ -420,61 +411,53 @@ class Index extends BaseController
|
||||
$param['check_admin_ids'] = $param['check_admin_ids'];
|
||||
$param['check_step_sort'] = $next_step;
|
||||
$param['check_status'] = 1;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
//不存在下一步审核,审核结束
|
||||
$param['check_status'] = 2;
|
||||
$param['check_admin_ids'] ='';
|
||||
$param['check_admin_ids'] = '';
|
||||
}
|
||||
}
|
||||
else{
|
||||
$next_step = Db::name('FlowStep')->where(['action_id'=>$id,'type'=>$type,'sort'=>($detail['check_step_sort']+1),'delete_time'=>0])->find();
|
||||
if($next_step){
|
||||
} else {
|
||||
$next_step = Db::name('FlowStep')->where(['action_id' => $id, 'type' => $type, 'sort' => ($detail['check_step_sort'] + 1), 'delete_time' => 0])->find();
|
||||
if ($next_step) {
|
||||
//存在下一步审核
|
||||
if($next_step['flow_type'] == 1){
|
||||
if ($next_step['flow_type'] == 1) {
|
||||
$param['check_admin_ids'] = get_department_leader($detail['admin_id']);
|
||||
}
|
||||
else if($next_step['flow_type'] == 2){
|
||||
$param['check_admin_ids'] = get_department_leader($detail['admin_id'],1);
|
||||
}
|
||||
else{
|
||||
} else if ($next_step['flow_type'] == 2) {
|
||||
$param['check_admin_ids'] = get_department_leader($detail['admin_id'], 1);
|
||||
} else {
|
||||
$param['check_admin_ids'] = $next_step['flow_uids'];
|
||||
}
|
||||
$param['check_step_sort'] = $detail['check_step_sort']+1;
|
||||
$param['check_step_sort'] = $detail['check_step_sort'] + 1;
|
||||
$param['check_status'] = 1;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
//不存在下一步审核,审核结束
|
||||
$param['check_status'] = 2;
|
||||
$param['check_admin_ids'] ='';
|
||||
$param['check_admin_ids'] = '';
|
||||
}
|
||||
}
|
||||
if($param['check_status'] == 1 && empty($param['check_admin_ids'])){
|
||||
return to_assign(1,'找不到下一步的审批人,该审批流程设置有问题,请联系HR或者管理员');
|
||||
if ($param['check_status'] == 1 && empty($param['check_admin_ids'])) {
|
||||
return to_assign(1, '找不到下一步的审批人,该审批流程设置有问题,请联系HR或者管理员');
|
||||
}
|
||||
//审核通过数据操作
|
||||
$param['last_admin_id'] = $this->uid;
|
||||
$param['flow_admin_ids'] = $detail['flow_admin_ids'].$this->uid.',';
|
||||
$param['flow_admin_ids'] = $detail['flow_admin_ids'] . $this->uid . ',';
|
||||
|
||||
if($type==1){
|
||||
if ($type == 1) {
|
||||
//日常审核
|
||||
$res = Db::name('Approve')->strict(false)->field('check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($param);
|
||||
}
|
||||
else if($type==2){
|
||||
} else if ($type == 2) {
|
||||
//报销审核
|
||||
$res = Db::name('Expense')->strict(false)->field('check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($param);
|
||||
}
|
||||
else if($type==3){
|
||||
} else if ($type == 3) {
|
||||
//发票审核
|
||||
$res = Db::name('Invoice')->strict(false)->field('check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($param);
|
||||
}
|
||||
else if($type==4){
|
||||
} else if ($type == 4) {
|
||||
//合同审核
|
||||
$res = Db::name('Contract')->strict(false)->field('check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($param);
|
||||
}
|
||||
|
||||
if($res!==false){
|
||||
$checkData=array(
|
||||
if ($res !== false) {
|
||||
$checkData = array(
|
||||
'action_id' => $id,
|
||||
'step_id' => $step['id'],
|
||||
'check_user_id' => $this->uid,
|
||||
@ -485,72 +468,66 @@ class Index extends BaseController
|
||||
'create_time' => time()
|
||||
);
|
||||
$aid = Db::name('FlowRecord')->strict(false)->field(true)->insertGetId($checkData);
|
||||
add_log('check', $param['id'], $param,$subject);
|
||||
add_log('check', $param['id'], $param, $subject);
|
||||
//发送消息通知
|
||||
$msg=[
|
||||
'create_time'=>date('Y-m-d H:i:s',$detail['create_time']),
|
||||
'action_id'=>$id,
|
||||
'title' => Db::name('FlowType')->where('id',$msg_title_type)->value('title'),
|
||||
'from_uid'=>$detail['admin_id']
|
||||
$msg = [
|
||||
'create_time' => date('Y-m-d H:i:s', $detail['create_time']),
|
||||
'action_id' => $id,
|
||||
'title' => Db::name('FlowType')->where('id', $msg_title_type)->value('title'),
|
||||
'from_uid' => $detail['admin_id']
|
||||
];
|
||||
if($param['check_status'] == 1){
|
||||
if ($param['check_status'] == 1) {
|
||||
$users = $param['check_admin_ids'];
|
||||
sendMessage($users,($type*10+11),$msg);
|
||||
sendMessage($users, ($type * 10 + 11), $msg);
|
||||
}
|
||||
if($param['check_status'] == 2){
|
||||
if ($param['check_status'] == 2) {
|
||||
$users = $detail['admin_id'];
|
||||
sendMessage($users,($type*10+12),$msg);
|
||||
sendMessage($users, ($type * 10 + 12), $msg);
|
||||
}
|
||||
return to_assign();
|
||||
} else {
|
||||
return to_assign(1, '操作失败');
|
||||
}
|
||||
else{
|
||||
return to_assign(1,'操作失败');
|
||||
}
|
||||
}
|
||||
else if($param['check'] == 2){
|
||||
} else if ($param['check'] == 2) {
|
||||
$check_admin_ids = explode(",", strval($detail['check_admin_ids']));
|
||||
if (!in_array($this->uid, $check_admin_ids)){
|
||||
return to_assign(1,'您没权限审核该审批');
|
||||
if (!in_array($this->uid, $check_admin_ids)) {
|
||||
return to_assign(1, '您没权限审核该审批');
|
||||
}
|
||||
//拒绝审核,数据操作
|
||||
$param['check_status'] = 3;
|
||||
$param['last_admin_id'] = $this->uid;
|
||||
$param['flow_admin_ids'] = $detail['flow_admin_ids'].$this->uid.',';
|
||||
$param['check_admin_ids'] ='';
|
||||
if($step['flow_type'] == 5){
|
||||
$param['flow_admin_ids'] = $detail['flow_admin_ids'] . $this->uid . ',';
|
||||
$param['check_admin_ids'] = '';
|
||||
if ($step['flow_type'] == 5) {
|
||||
//获取上一步的审核信息
|
||||
$prev_step = Db::name('FlowStep')->where(['action_id'=>$id,'type'=>$type,'sort'=>($detail['check_step_sort']-1),'delete_time'=>0])->find();
|
||||
if($prev_step){
|
||||
$prev_step = Db::name('FlowStep')->where(['action_id' => $id, 'type' => $type, 'sort' => ($detail['check_step_sort'] - 1), 'delete_time' => 0])->find();
|
||||
if ($prev_step) {
|
||||
//存在上一步审核
|
||||
$param['check_step_sort'] = $prev_step['sort'];
|
||||
$param['check_admin_ids'] = $prev_step['flow_uids'];
|
||||
$param['check_status'] = 1;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
//不存在上一步审核,审核初始化步骤
|
||||
$param['check_step_sort'] = 0;
|
||||
$param['check_admin_ids'] = '';
|
||||
$param['check_status'] = 0;
|
||||
}
|
||||
}
|
||||
if($type==1){
|
||||
if ($type == 1) {
|
||||
//日常审核
|
||||
$res = Db::name('Approve')->strict(false)->field('check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($param);
|
||||
}
|
||||
else if($type==2){
|
||||
} else if ($type == 2) {
|
||||
//报销审核
|
||||
$res = Db::name('Expense')->strict(false)->field('check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($param);
|
||||
}
|
||||
else if($type==3){
|
||||
} else if ($type == 3) {
|
||||
//发票审核
|
||||
$res = Db::name('Invoice')->strict(false)->field('check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($param);
|
||||
}
|
||||
else if($type==4){
|
||||
} else if ($type == 4) {
|
||||
//合同审核
|
||||
$res = Db::name('Contract')->strict(false)->field('check_step_sort,check_status,last_admin_id,flow_admin_ids,check_admin_ids')->update($param);
|
||||
}
|
||||
if($res!==false){
|
||||
$checkData=array(
|
||||
if ($res !== false) {
|
||||
$checkData = array(
|
||||
'action_id' => $id,
|
||||
'step_id' => $step['id'],
|
||||
'check_user_id' => $this->uid,
|
||||
@ -561,48 +538,43 @@ class Index extends BaseController
|
||||
'create_time' => time()
|
||||
);
|
||||
$aid = Db::name('FlowRecord')->strict(false)->field(true)->insertGetId($checkData);
|
||||
add_log('refue', $param['id'], $param,$subject);
|
||||
add_log('refue', $param['id'], $param, $subject);
|
||||
//发送消息通知
|
||||
$msg=[
|
||||
'create_time'=>date('Y-m-d H:i:s',$detail['create_time']),
|
||||
'action_id'=>$detail['id'],
|
||||
'title' => Db::name('FlowType')->where('id',$msg_title_type)->value('title'),
|
||||
'from_uid'=>$detail['admin_id']
|
||||
$msg = [
|
||||
'create_time' => date('Y-m-d H:i:s', $detail['create_time']),
|
||||
'action_id' => $detail['id'],
|
||||
'title' => Db::name('FlowType')->where('id', $msg_title_type)->value('title'),
|
||||
'from_uid' => $detail['admin_id']
|
||||
];
|
||||
$users = $detail['admin_id'];
|
||||
sendMessage($users,($type*10+13),$msg);
|
||||
sendMessage($users, ($type * 10 + 13), $msg);
|
||||
return to_assign();
|
||||
} else {
|
||||
return to_assign(1, '操作失败');
|
||||
}
|
||||
else{
|
||||
return to_assign(1,'操作失败');
|
||||
}
|
||||
}
|
||||
else if($param['check'] == 3){
|
||||
if($detail['admin_id'] != $this->uid){
|
||||
return to_assign(1,'你没权限操作');
|
||||
} else if ($param['check'] == 3) {
|
||||
if ($detail['admin_id'] != $this->uid) {
|
||||
return to_assign(1, '你没权限操作');
|
||||
}
|
||||
//撤销审核,数据操作
|
||||
$param['check_status'] = 4;
|
||||
$param['check_admin_ids'] ='';
|
||||
$param['check_step_sort'] =0;
|
||||
if($type==1){
|
||||
$param['check_admin_ids'] = '';
|
||||
$param['check_step_sort'] = 0;
|
||||
if ($type == 1) {
|
||||
//日常审核
|
||||
$res = Db::name('Approve')->strict(false)->field('check_step_sort,check_status,check_admin_ids')->update($param);
|
||||
}
|
||||
else if($type==2){
|
||||
} else if ($type == 2) {
|
||||
//报销审核
|
||||
$res = Db::name('Expense')->strict(false)->field('check_step_sort,check_status,check_admin_ids')->update($param);
|
||||
}
|
||||
else if($type==3){
|
||||
} else if ($type == 3) {
|
||||
//发票审核
|
||||
$res = Db::name('Invoice')->strict(false)->field('check_step_sort,check_status,check_admin_ids')->update($param);
|
||||
}
|
||||
else if($type==4){
|
||||
} else if ($type == 4) {
|
||||
//合同审核
|
||||
$res = Db::name('Contract')->strict(false)->field('check_step_sort,check_status,check_admin_ids')->update($param);
|
||||
}
|
||||
if($res!==false){
|
||||
$checkData=array(
|
||||
if ($res !== false) {
|
||||
$checkData = array(
|
||||
'action_id' => $id,
|
||||
'step_id' => 0,
|
||||
'check_user_id' => $this->uid,
|
||||
@ -613,10 +585,10 @@ class Index extends BaseController
|
||||
'create_time' => time()
|
||||
);
|
||||
$aid = Db::name('FlowRecord')->strict(false)->field(true)->insertGetId($checkData);
|
||||
add_log('back', $param['id'], $param,$subject);
|
||||
add_log('back', $param['id'], $param, $subject);
|
||||
return to_assign();
|
||||
}else{
|
||||
return to_assign(1,'操作失败');
|
||||
} else {
|
||||
return to_assign(1, '操作失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -692,45 +664,7 @@ class Index extends BaseController
|
||||
if (isset($param['end_time'])) {
|
||||
$param['end_time'] = strtotime(urldecode($param['end_time']));
|
||||
}
|
||||
if (!empty($param['id']) && $param['id'] > 0) {
|
||||
$task = (new TaskList())->detail($param['id']);
|
||||
try {
|
||||
validate(TaskCheck::class)->scene('edit')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return to_assign(1, $e->getError());
|
||||
}
|
||||
if (isset($param['flow_status'])) {
|
||||
if ($param['flow_status'] == 3) {
|
||||
$param['over_time'] = time();
|
||||
$param['done_ratio'] = 100;
|
||||
if($task['before_task']>0){
|
||||
$flow_status = Db::name('ProjectTask')->where(['id' => $task['before_task']])->value('flow_status');
|
||||
if($flow_status !=3){
|
||||
return to_assign(1, '前置任务未完成,不能设置已完成');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$param['over_time'] = 0;
|
||||
$param['done_ratio'] = 0;
|
||||
}
|
||||
}
|
||||
if(isset($param['before_task'])){
|
||||
$after_task_array = admin_after_task_son($param['id']);
|
||||
//包括自己在内
|
||||
$after_task_array[] = $param['id'];
|
||||
if (in_array($param['before_task'], $after_task_array)) {
|
||||
return to_assign(1, '前置任务不能是该任务本身或其后置任务');
|
||||
}
|
||||
}
|
||||
$param['update_time'] = time();
|
||||
$res = TaskList::where('id', $param['id'])->strict(false)->save($param);
|
||||
if ($res) {
|
||||
add_log('edit', $param['id'], $param);
|
||||
add_project_log(1,'task',$param, $task);
|
||||
}
|
||||
return to_assign();
|
||||
} else {
|
||||
|
||||
try {
|
||||
validate(TaskCheck::class)->scene('add')->check($param);
|
||||
} catch (ValidateException $e) {
|
||||
@ -739,6 +673,12 @@ class Index extends BaseController
|
||||
}
|
||||
$param['create_time'] = time();
|
||||
$param['admin_id'] = 1;
|
||||
if(!empty($param['md5']) &&strlen($param['md5'])>2){
|
||||
$id = TaskList::where('md5',$param['md5'])->value('id');
|
||||
if($id){
|
||||
return to_assign(1,'已存在');
|
||||
}
|
||||
}
|
||||
$sid = TaskList::strict(false)->field(true)->insertGetId($param);
|
||||
if ($sid) {
|
||||
add_log('add', $sid, $param);
|
||||
@ -759,6 +699,4 @@ class Index extends BaseController
|
||||
return to_assign();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user