diff --git a/app/Model/v3/User.php b/app/Model/v3/User.php index 9e7d670..b00f2d2 100644 --- a/app/Model/v3/User.php +++ b/app/Model/v3/User.php @@ -34,4 +34,9 @@ class User extends Model 'gender', 'language', ]; + + public function community() + { + return $this->hasOne(CsInfo::class, 'user_id', 'id'); + } } \ No newline at end of file diff --git a/app/Service/v3/Implementations/WxLoginService.php b/app/Service/v3/Implementations/WxLoginService.php index e41338c..7169e00 100644 --- a/app/Service/v3/Implementations/WxLoginService.php +++ b/app/Service/v3/Implementations/WxLoginService.php @@ -5,6 +5,7 @@ namespace App\Service\v3\Implementations; use App\Constants\v3\ErrorCode; use App\Constants\v3\SsdbKeys; use App\Exception\ErrorCodeException; +use App\Model\v3\CsInfo; use App\Model\v3\User; use App\TaskWorker\SSDBTask; use EasyWeChat\Factory; @@ -43,6 +44,9 @@ class WxLoginService implements \App\Service\v3\Interfaces\WxLoginServiceInterfa $ssdb->exec('setnx', $hashIds, 1); $ssdb->exec('expire', $hashIds, config('auth.user.expire_time')); + $sourceId = CsInfo::query()->where(['user_id' => $user['id']])->value('admin_user_id'); + $user['community_source_id'] = $sourceId ?: 0; + $return = array_merge($user, $result); $kvs = [];