<?php

namespace App\Model;
const OSS_ROLE_RAN = "acs:ram::1325723521662517:role/oss-client-mam";
const OSS_ROLE_SESSION_NAME = "client-001";
class AliOssModel
{
    public static function getAilOssToken($request){
        $ali_base_url = getenv("oss_ali")??"http://ofc-store-svr-svr";
        $url = $ali_base_url ."/api/v1/assumeRole?role_arn=".OSS_ROLE_RAN."&role_session_name=".OSS_ROLE_SESSION_NAME;
        $res = http_request_code($url);
        LogModel::addlog(["获取阿里OSS临时token"=>$res,"请求URL"=>$url]);
        return json_decode($res,true);
    }
}