12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <?php
- namespace App\Http\Controllers\Api;
- use App\Http\Controllers\Controller;
- use App\Service\AccountConfService;
- use Illuminate\Http\Request;
- class AccountConfController extends Controller
- {
- // 绑定推广ID
- public function bindPid(Request $request) {
- $validator = \Validator::make($request->all(),[
- 'account_id' => 'required|string',
- 'pid' => 'required',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $sysGroupId = $request->input('sys_group_id');
- $accountId = $request->input('account_id');
- $pid = $request->input('pid');
- $note = $request->input('note');
- $isConfirm = $request->input('is_confirm', 0);
- list($res, $code) = AccountConfService::bindPid($sysGroupId, $accountId, $pid, $note, $isConfirm);
- return self::returnValue($res, $code);
- }
- # 已绑定关系列表
- public function bindPidList(Request $request) {
- $validator = \Validator::make($request->all(),[
- 'account_id' => 'required|string',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $sysGroupId = $request->input('sys_group_id');
- $accountId = $request->input('account_id');
- $note = $request->input('note');
- $page = $request->input('page', 1);
- $pageSize = $request->input('page_size', 20);
- list($data, $count) = AccountConfService::bindPidList($sysGroupId, $accountId, $note, $page, $pageSize);
- return self::returnPageValue($data, $count, $pageSize, $page);
- }
- # 修改开启关闭状态
- public function editStatus(Request $request) {
- $validator = \Validator::make($request->all(),[
- 'id' => 'required|string',
- 'status' => 'required|in:1,0'
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $id = $request->input('id');
- $status = $request->input('status');
- list($res, $code) = AccountConfService::editStatus($id, $status);
- return self::returnValue($res, $code);
- }
- # 检测已绑定的投放类型(企微投放还是直投)
- public function checkBindType(Request $request) {
- $validator = \Validator::make($request->all(),[
- 'account_id' => 'required',
- 'type' => 'required|in:1,2'
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $accountId = $request->input('account_id');
- $type = $request->input('type');
- $sysGroupId = $request->input('sys_group_id');
- $data = AccountConfService::checkBindType($sysGroupId, $accountId, $type);
- return self::returnValue($data);
- }
- }
|