GetController.php 755 B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace app\frontend\modules\refreshToken\controllers;
  3. use app\common\components\BaseController;
  4. use app\common\exceptions\ShopException;
  5. use app\common\modules\tripartiteApi\AppSecret;
  6. use app\frontend\modules\refreshToken\PreApiRefreshToken;
  7. class GetController extends BaseController
  8. {
  9. public function index()
  10. {
  11. $this->validate([
  12. 'app_secret' => 'required'
  13. ]);
  14. if(AppSecret::get() != request()->input('app_secret')){
  15. throw new ShopException('app_secret无效');
  16. }
  17. $refreshToken = new PreApiRefreshToken();
  18. $refreshToken->save();
  19. return $this->successJson('成功', array_only($refreshToken->toArray(),['expires_at','uniacid','refresh_token']));
  20. }
  21. }