You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
738 B

  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Controller;
  4. use App\Model\UserRelationBind;
  5. use App\Request\CommunityBindRequest;
  6. use App\Service\UserRelationBindServiceInterface;
  7. use Hyperf\Di\Annotation\Inject;
  8. class CommunityController extends BaseController
  9. {
  10. /**
  11. * @Inject
  12. * @var UserRelationBindServiceInterface
  13. */
  14. protected $userCommunityService;
  15. public function bind(CommunityBindRequest $request)
  16. {
  17. $data = $request->validated();
  18. $jsonData = $data['json_data'] ?? json_encode([]);
  19. $res = $this->userCommunityService->bind(UserRelationBind::BIND_TYPE_COMMUNITY, $data['source_id'], $data['user_id'], $jsonData);
  20. return $this->success(['id' => $res->id]);
  21. }
  22. }