|
@@ -5,6 +5,7 @@ namespace app\admin\controller;
|
|
|
//流程节点
|
|
|
use think\facade\Db;
|
|
|
use think\facade\Validate;
|
|
|
+use app\admin\model\ActionProcess as ActionProcessModel;
|
|
|
|
|
|
class ActionProcess extends Base
|
|
|
{
|
|
@@ -59,13 +60,22 @@ class ActionProcess extends Base
|
|
|
}
|
|
|
|
|
|
//新增流程节点
|
|
|
- public function add(){
|
|
|
+ public function add()
|
|
|
+ {
|
|
|
|
|
|
- $param = $this->request->filter('trim')->only(['','','',''],'post');
|
|
|
+ $param = $this->request->filter('trim')->only(['token', 'order_type', 'order_name', 'action_type', 'operation_type', 'status_name', 'order_process', 'next_action_ids' => '', 'remark' => ''], 'post');
|
|
|
|
|
|
- $val=Validate::rule();
|
|
|
+ $val = Validate::rule([
|
|
|
+ 'token' => 'require',
|
|
|
+ 'order_type|所属流程编码' => 'require|max:255',
|
|
|
+ 'order_name|所属流程名称' => 'require|max:255',
|
|
|
+ 'action_type|节点类型' => 'require|number|between:1,4',
|
|
|
+ 'operation_type|操作类型' => 'require|number|in:1,2',
|
|
|
+ 'status_name|节点名称' => 'require|max:255',
|
|
|
+ 'order_process|节点值' => 'require|number|gt:0',
|
|
|
+ ]);
|
|
|
|
|
|
- if(!$val->check([])) return error_show(1005,$val->getError());
|
|
|
+ if (!$val->check($param)) return error_show(1005, $val->getError());
|
|
|
|
|
|
$user = GetUserInfo($param['token']);
|
|
|
|
|
@@ -73,6 +83,19 @@ class ActionProcess extends Base
|
|
|
$uname = isset($user['data']['nickname']) ? $user['data']['nickname'] : '';
|
|
|
$date = date('Y-m-d H:i:s');
|
|
|
|
|
|
+ return ActionProcessModel::create(array_merge($param, [
|
|
|
+ 'status' => ActionProcessModel::$status_normal,
|
|
|
+ 'is_del' => ActionProcessModel::$is_del_normal,
|
|
|
+ 'createrid' => $uid,
|
|
|
+ 'creater' => $uname,
|
|
|
+ 'addtime' => $date,
|
|
|
+ 'updaterid' => $uid,
|
|
|
+ 'updater' => $uname,
|
|
|
+ 'updatetime' => $date,
|
|
|
+ 'remark' => $param['remark']
|
|
|
+ ]))->save() ? app_show(0, '新增流程节点成功') : error_show(1005, '新增流程节点失败');
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|