企微短剧业务系统

AccountConfController.php 2.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. namespace App\Http\Controllers\Api;
  3. use App\Http\Controllers\Controller;
  4. use App\Service\AccountConfService;
  5. use Illuminate\Http\Request;
  6. class AccountConfController extends Controller
  7. {
  8. // 绑定推广ID
  9. public function bindPid(Request $request) {
  10. $validator = \Validator::make($request->all(),[
  11. 'account_id' => 'required|string',
  12. 'pid' => 'required',
  13. ]);
  14. if ($validator->fails()) {
  15. return self::returnValue($validator->getMessageBag(), 1102);
  16. }
  17. $sysGroupId = $request->input('sys_group_id');
  18. $accountId = $request->input('account_id');
  19. $pid = $request->input('pid');
  20. $note = $request->input('note');
  21. $isConfirm = $request->input('is_confirm', 0);
  22. list($res, $code) = AccountConfService::bindPid($sysGroupId, $accountId, $pid, $note, $isConfirm);
  23. return self::returnValue($res, $code);
  24. }
  25. # 已绑定关系列表
  26. public function bindPidList(Request $request) {
  27. $validator = \Validator::make($request->all(),[
  28. 'account_id' => 'required|string',
  29. ]);
  30. if ($validator->fails()) {
  31. return self::returnValue($validator->getMessageBag(), 1102);
  32. }
  33. $sysGroupId = $request->input('sys_group_id');
  34. $accountId = $request->input('account_id');
  35. $note = $request->input('note');
  36. $page = $request->input('page', 1);
  37. $pageSize = $request->input('page_size', 20);
  38. list($data, $count) = AccountConfService::bindPidList($sysGroupId, $accountId, $note, $page, $pageSize);
  39. return self::returnPageValue($data, $count, $pageSize, $page);
  40. }
  41. # 修改开启关闭状态
  42. public function editStatus(Request $request) {
  43. $validator = \Validator::make($request->all(),[
  44. 'id' => 'required|string',
  45. 'status' => 'required|in:1,0'
  46. ]);
  47. if ($validator->fails()) {
  48. return self::returnValue($validator->getMessageBag(), 1102);
  49. }
  50. $id = $request->input('id');
  51. $status = $request->input('status');
  52. list($res, $code) = AccountConfService::editStatus($id, $status);
  53. return self::returnValue($res, $code);
  54. }
  55. # 检测已绑定的投放类型(企微投放还是直投)
  56. public function checkBindType(Request $request) {
  57. $validator = \Validator::make($request->all(),[
  58. 'account_id' => 'required',
  59. 'type' => 'required|in:1,2'
  60. ]);
  61. if ($validator->fails()) {
  62. return self::returnValue($validator->getMessageBag(), 1102);
  63. }
  64. $accountId = $request->input('account_id');
  65. $type = $request->input('type');
  66. $sysGroupId = $request->input('sys_group_id');
  67. $data = AccountConfService::checkBindType($sysGroupId, $accountId, $type);
  68. return self::returnValue($data);
  69. }
  70. }