12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?php
- namespace app\admin\controller;
- //流程节点
- use think\facade\Db;
- use think\facade\Validate;
- class ActionProcess extends Base
- {
- //获取流程节点列表
- public function getList()
- {
- $param = $this->request->filter('trim')->only(['order_type', 'page' => 1, 'size' => 15], 'post');
- $val = Validate::rule([
- 'order_type|所属流程编码' => 'require',
- 'page|页码' => 'require|number|gt:0',
- 'size|每页显示的页码' => 'require|number|gt:0',
- ]);
- if (!$val->check($param)) return error_show(1005, $val->getError());
- $where = [];
- if ($param['order_type'] != '') $where[] = ['order_type', '=', $param['order_type']];
- $count = Db::name('action_process')
- ->where($where)
- ->count('id');
- $list = Db::name('action_process')
- ->field('id,status_name,order_process,status,action_type,operation_type,next_action_ids,creater,addtime')
- ->where($where)
- ->order('id', 'desc')
- ->page($param['page'], $param['size'])
- ->select()
- ->toArray();
- $all_next_ids = implode(',', array_column($list, 'next_action_ids'));
- //处理下一个节点的名称
- $child = Db::name('action_process')
- ->whereIn('id', $all_next_ids)
- ->column('status_name', 'id');
- foreach ($list as &$item) {
- if ($item['next_action_ids']) {
- $next_action_ids = explode(',', $item['next_action_ids']);
- foreach ($next_action_ids as $next_action_id) {
- if (isset($child[$next_action_id])) $item['next_actions'][] = $child[$next_action_id];
- }
- } else $item['next_actions'] = [];
- }
- return app_show(0, '获取成功', ['count' => $count, 'list' => $list]);
- }
- //新增流程节点
- public function add(){
- $param = $this->request->filter('trim')->only(['','','',''],'post');
- $val=Validate::rule();
- if(!$val->check([])) return error_show(1005,$val->getError());
- $user = GetUserInfo($param['token']);
- $uid = isset($user['data']['id']) ? $user['data']['id'] : 0;
- $uname = isset($user['data']['nickname']) ? $user['data']['nickname'] : '';
- $date = date('Y-m-d H:i:s');
- }
- }
|