all(),[ 'sys_group_id' => 'nullable|int', 'keyword' => 'nullable|string', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 3001); } $sysGroupId = $request->input('sys_group_id'); $keyword = $request->input('keyword'); $page = $request->input('page', 1); $pageSize = $request->input('page_size', 20); $isSelect = $request->input('is_select', 0); list($list, $total) = WarnService::groupList($sysGroupId, $keyword, $page, $pageSize, $isSelect); if(1 == $isSelect){ return self::returnValue($list); } else { return self::returnPageValue($list, $total, $pageSize, $page); } } /** * 预警用户组添加 * @param Request $request * @return array */ public function groupAdd(Request $request) { $validator = \Validator::make($request->all(),[ 'sys_group_id' => 'nullable|int', 'group_name' => 'required|string', 'user_list' => 'required|string', 'djuser_list' => 'nullable|string', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 3001); } $sysGroupId = $request->input('sys_group_id'); $groupName = $request->input('group_name'); $userList = $request->input('user_list'); $djuserList = $request->input('djuser_list'); list($res, $code) = WarnService::groupOperate($sysGroupId, $groupName, $userList, $djuserList); return self::returnValue($res, $code); } /** * 预警用户组数据详情 * @param Request $request * @return array */ public function groupDetail(Request $request) { $validator = \Validator::make($request->all(),[ 'sys_group_id' => 'nullable|int', 'group_id' => 'required|int', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 3001); } $sysGroupId = $request->input('sys_group_id'); $groupId = $request->input('group_id'); list($res, $code) = WarnService::groupDetail($sysGroupId, $groupId); return self::returnValue($res, $code); } /** * 预警用户组编辑 * @param Request $request * @return array */ public function groupEdit(Request $request) { $validator = \Validator::make($request->all(),[ 'sys_group_id' => 'nullable|int', 'group_name' => 'required|string', 'user_list' => 'required|string', 'djuser_list' => 'nullable|string', 'group_id' => 'required|int', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 3001); } $sysGroupId = $request->input('sys_group_id'); $groupName = $request->input('group_name'); $userList = $request->input('user_list'); $djuserList = $request->input('djuser_list'); $groupId = $request->input('group_id'); list($res, $code) = WarnService::groupOperate($sysGroupId, $groupName, $userList, $djuserList, $groupId); return self::returnValue($res, $code); } /** * 预警组开启和禁用 * @param Request $request * @return array */ public function groupEableOp(Request $request) { $validator = \Validator::make($request->all(),[ 'sys_group_id' => 'nullable|int', 'group_id' => 'required|int', 'enable' => ['required',Rule::in([0, 1])], ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 3001); } $sysGroupId = $request->input('sys_group_id'); $groupId = $request->input('group_id'); $enable = $request->input('enable'); list($res, $code) = WarnService::groupEableOp($sysGroupId, $groupId, $enable); return self::returnValue($res, $code); } /** * 预警规则配置列表 * @param Request $request * @return array */ public function ruleConfList(Request $request) { $validator = \Validator::make($request->all(),[ 'sys_group_id' => 'nullable|int', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 3001); } $sysGroupId = $request->input('sys_group_id'); $res = WarnService::ruleConfList($sysGroupId); return self::returnValue($res); } /** * 预警规则配置操作 * @param Request $request * @return array */ public function ruleConfOperate(Request $request) { $validator = \Validator::make($request->all(),[ 'sys_group_id' => 'nullable|int', 'rule_id' => 'required|string', 'set_val' => 'nullable|int', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 3001); } $sysGroupId = $request->input('sys_group_id'); $ruleId = $request->input('rule_id'); $setVal = $request->input('set_val'); list($res, $code) = WarnService::ruleConfOperate($sysGroupId, $ruleId, $setVal); return self::returnValue($res, $code); } /** * 预警人员列表 * @param Request $request * @return array */ public function userList(Request $request) { $validator = \Validator::make($request->all(),[ 'sys_group_id' => 'nullable|int', 'keyword' => 'nullable|string', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 3001); } $sysGroupId = $request->input('sys_group_id'); $keyword = $request->input('keyword'); $page = $request->input('page', 1); $pageSize = $request->input('page_size', 20); list($list, $total) = WarnService::userList($sysGroupId, $keyword, $page, $pageSize); return self::returnPageValue($list, $total, $pageSize, $page); } /** * 预警人员操作 * @param Request $request * @return array */ public function userOperate(Request $request) { $validator = \Validator::make($request->all(),[ 'sys_group_id' => 'nullable|int', 'name' => 'required|string', 'phone' => 'required|string', 'enable' => ['required',Rule::in([0, 1])], 'user_id' => 'nullable|int' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 3001); } $sysGroupId = $request->input('sys_group_id'); $name = $request->input('name'); $phone = $request->input('phone'); $enable = $request->input('enable'); $userId = $request->input('user_id'); list($res, $code) = WarnService::userOperate($sysGroupId, $name, $phone, $enable, $userId); return self::returnValue($res, $code); } /** * 预警客服列表 * @param Request $request * @return array */ public function djuserList(Request $request) { $validator = \Validator::make($request->all(),[ 'sys_group_id' => 'nullable|int' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 3001); } $sysGroupId = $request->input('sys_group_id'); $isActive = $request->input('is_active'); $res = WarnService::djuserList($sysGroupId, $isActive); return self::returnValue($res); } /** * 企微用户规模预警 阈值列表(没有用到) * @return array */ public function corpUserScaleWarnThresholdList() { $list = CorpUserScaleWarningConf::THRESHOLD_LIST; return self::returnValue($list); } /** * 企微用户规模预警规则设置(废弃) * @param Request $request */ public function setCorpUserScaleWarnConf(Request $request) { $validator = \Validator::make($request->all(),[ 'sys_group_id' => 'required|int', 'conf_list' => 'required|string', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 3001); } $sysGroupId = $request->input('sys_group_id'); $confList = $request->input('conf_list'); $isSystemAdmin = $request->input("is_system_admin"); //是否是系统管理员,中间件赋值 $adminId = $request->input('admin_id'); list($res, $code) = WarnService::setCorpUserScaleWarnConf($sysGroupId, $adminId, $confList, $isSystemAdmin); return self::returnValue($res, $code); } /** * 企微用户规模预警规则展示 * @param Request $request */ public function getCorpUserScaleWarnConf(Request $request) { $validator = \Validator::make($request->all(),[ 'sys_group_id' => 'required|int' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 3001); } $sysGroupId = $request->input('sys_group_id'); $adminId = $request->input('admin_id'); $isSystemAdmin = $request->input("is_system_admin"); //是否是系统管理员,中间件赋值 $data = WarnService::getCorpUserScaleWarnConf($sysGroupId, $adminId, $isSystemAdmin); return self::returnValue($data); } /** * 企微用户规模预警规则设置(单条设置) * @param Request $request */ public static function setCorpUserScaleWarnConfNew(Request $request) { $validator = \Validator::make($request->all(),[ 'sys_group_id' => 'required|int', 'threshold' => 'required|in:4700,4800,9700,9800,14700,14800,19700,19800', 'corp_list' => 'nullable|array', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 3001); } $sysGroupId = $request->input('sys_group_id'); $threshold = $request->input('threshold'); $corpList = $request->input('corp_list'); $isSystemAdmin = $request->input("is_system_admin"); //是否是系统管理员,中间件赋值 $adminId = $request->input('admin_id'); list($res, $code) = WarnService::setCorpUserScaleWarnConfNew($sysGroupId, $adminId, $isSystemAdmin, $threshold, $corpList); return self::returnValue($res, $code); } }