Browse Source

用户社区绑定

master
weigang 6 years ago
parent
commit
e7caeaf4bd
  1. 2
      app/Middleware/Auth/ApiMiddleware.php
  2. 4
      app/Model/UserRelationBind.php
  3. 6
      app/Service/CommunityService.php

2
app/Middleware/Auth/ApiMiddleware.php

@ -39,7 +39,7 @@ class ApiMiddleware implements MiddlewareInterface
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
if (env('APP_ENV') == 'dev') {
if (env('APP_ENV') == 'dev' || env('APP_ENV') == 'local') {
return $handler->handle($request);
}

4
app/Model/ActivityBind.php → app/Model/UserRelationBind.php

@ -5,14 +5,14 @@ namespace App\Model;
/**
*/
class ActivityBind extends Model
class UserRelationBind extends Model
{
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'lanzu_activity_bind';
protected $table = 'lanzu_user_relation_bind';
/**
* The attributes that are mass assignable.
*

6
app/Service/CommunityService.php

@ -4,7 +4,7 @@
namespace App\Service;
use App\Model\ActivityBind;
use App\Model\UserRelationBind;
class CommunityService implements CommunityServiceInterface
{
@ -14,7 +14,7 @@ class CommunityService implements CommunityServiceInterface
if ($res = $this->isBinded($data['bind_type'], $data['source_id'], $data['user_id'])) {
return $res;
}
return ActivityBind::query()->updateOrCreate(
return UserRelationBind::query()->updateOrCreate(
['bind_type' => $data['bind_type'], 'source_id' => $data['source_id'], 'user_id' => $data['user_id']],
['json_data' => $data['json_data']]
);
@ -22,7 +22,7 @@ class CommunityService implements CommunityServiceInterface
public function isBinded($bind_type, $source_id, $user_id)
{
return ActivityBind::query()
return UserRelationBind::query()
->select('id')
->where(['bind_type' => $bind_type, 'source_id' => $source_id, 'user_id' => $user_id])
->first();

Loading…
Cancel
Save