|
@@ -17,6 +17,7 @@ use Tymon\JWTAuth\Facades\JWTAuth;
|
|
|
use App\Transformers\LoginTransformer;
|
|
|
use League\Fractal\Manager;
|
|
|
use League\Fractal\Resource\Item;
|
|
|
+use Tymon\JWTAuth\Facades\JWTFactory;
|
|
|
|
|
|
class AuthController extends Controller {
|
|
|
public function __construct(JWTAuth $jwt)
|
|
@@ -63,6 +64,12 @@ class AuthController extends Controller {
|
|
|
return $this->jsonError('登陆失败');
|
|
|
}else{
|
|
|
$shopAccount = Auth::user();
|
|
|
+// $shopAccount->token = $token;
|
|
|
+// $shopAccount->token_ttl = config('jwt.ttl');
|
|
|
+ $factory = JWTFactory::customClaims(['shop'=>['shop_id'=>$shopAccount->id,'sign'=>md5($shopAccount->id)]]);
|
|
|
+ $payload = $factory->make();
|
|
|
+
|
|
|
+ $token = JWTAuth::encode($payload);
|
|
|
$shopAccount->token = $token;
|
|
|
$shopAccount->token_ttl = config('jwt.ttl');
|
|
|
//如果有绑定微信,显示微信open_id
|