123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <?php
- namespace App\Http\Controllers\Api;
- use App\Service\OperationGroupService;
- use Illuminate\Http\Request;
- use App\Http\Controllers\Controller;
- use Illuminate\Validation\Rule;
- class OperationGroupController extends Controller
- {
- /**
- * 运营组信息设置
- * */
- public function setConfig(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'group_name' => 'required|string',
- 'operator_id' => 'required|int',
- 'corp_user_list' => 'required',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $groupId = $request->input('group_id');
- $groupName = $request->input('group_name');
- $operatorId = $request->input('operator_id');
- $corpUserList = $request->input('corp_user_list');
- $sysGroupId = $request->input('sys_group_id');
- $adminId = $request->input('admin_id');
- # 配置运营组信息
- $errno = OperationGroupService::setConfig($groupId, $groupName, $operatorId, $corpUserList, $sysGroupId, $adminId);
- return self::returnValue([], $errno);
- }
- /**
- * 运营组列表
- * */
- public function groupList(Request $request)
- {
- $sysGroupId = $request->input('sys_group_id');
- $adminId = $request->input('admin_id');
- $operatorId = $request->input('operator_id');
- $page = $request->input('page', 1);
- $pageSize = $request->input('page_size', 20);
- # 获取运营组列表
- list($list, $count) = OperationGroupService::groupList($sysGroupId, $adminId, $operatorId, $page, $pageSize);
- return self::returnPageValue($list, $count, $pageSize, $page);
- }
- /**
- * 运营组详情
- * */
- public function groupDetail(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'group_id' => 'required|int',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $sysGroupId = $request->input('sys_group_id');
- $groupId = $request->input('group_id');
- # 获取运营组详情数据
- $errno = 0;
- $data = OperationGroupService::groupDetail($groupId, $sysGroupId, $errno);
- return self::returnValue($data, $errno);
- }
- /**
- * 运营组 开启/禁用
- * */
- public function groupStatusChange(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'group_id' => 'required|int',
- 'status' => ['required',Rule::in([0, 1])],
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $sysGroupId = $request->input('sys_group_id');
- $groupId = $request->input('group_id');
- $status = $request->input('status');
- # 修改运营组状态
- $errno = OperationGroupService::changeStatus($sysGroupId, $groupId, $status);
- return self::returnValue([], $errno);
- }
- }
|