| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- namespace app\v1\controller\advert;
- use app\v1\logic\advert\MediaListLogic;
- use app\v1\validate\advert\MediaListValidate;
- use plugin\saiadmin\basic\BaseController;
- use support\Request;
- use support\Response;
- /**
- * 媒体开发者账号-应用授权回调地址
- */
- class MediaOAuthController extends BaseController
- {
- /**
- * 构造函数
- */
- public function __construct()
- {
- $this->logic = new MediaListLogic();
- parent::__construct();
- }
- /**
- * https://api.com/MediaOAuth/callback/{channel}
- */
- public function callback(Request $request, string $channel): Response
- {
- $callback = $request->get();
- $channel = ucfirst($channel); // 如 "toutiao" → "Toutiao""
- $channelClass = "app\\adapter\\{$channel}Adapter"; // 适配器类名
- $oathInfo = (new $channelClass)->OAuth($callback);
- // 写授权结果
- // 获取广告账户列表
- return $this->success();
- }
- }
|