2025-03-12 12:18:06 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace app\api\controller;
|
|
|
|
|
|
|
|
|
|
use think\Controller;
|
2025-03-17 10:09:27 +08:00
|
|
|
use think\facade\Env;
|
2025-04-09 14:45:27 +08:00
|
|
|
use app\common\service\AuthService;
|
2025-03-12 12:18:06 +08:00
|
|
|
|
|
|
|
|
class BaseController extends Controller {
|
|
|
|
|
|
2025-03-17 10:09:27 +08:00
|
|
|
|
2025-03-12 12:18:06 +08:00
|
|
|
/**
|
|
|
|
|
* 令牌
|
|
|
|
|
*
|
2025-03-17 10:09:27 +08:00
|
|
|
* @var string
|
2025-03-12 12:18:06 +08:00
|
|
|
*/
|
2025-03-17 10:09:27 +08:00
|
|
|
protected $token = '';
|
2025-03-12 12:18:06 +08:00
|
|
|
|
2025-03-17 10:09:27 +08:00
|
|
|
protected $baseUrl;
|
2025-03-12 12:18:06 +08:00
|
|
|
|
2025-04-09 14:45:27 +08:00
|
|
|
protected $authorization = '';
|
|
|
|
|
|
2025-03-17 10:09:27 +08:00
|
|
|
public function __construct() {
|
|
|
|
|
parent::__construct();
|
|
|
|
|
$this->baseUrl = Env::get('api.wechat_url');
|
2025-03-12 12:18:06 +08:00
|
|
|
// 允许跨域
|
|
|
|
|
header('Access-Control-Allow-Origin: *');
|
|
|
|
|
header('Access-Control-Allow-Methods: *');
|
|
|
|
|
header('Access-Control-Allow-Headers: *');
|
2025-04-09 14:45:27 +08:00
|
|
|
|
|
|
|
|
$this->authorization = AuthService::getSystemAuthorization();
|
|
|
|
|
|
|
|
|
|
|
2025-03-12 12:18:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-17 10:09:27 +08:00
|
|
|
}
|