Commit 30b071f3 authored by shajiaiming's avatar shajiaiming

fix

parent 327de006
......@@ -9,10 +9,6 @@ use api\base\BaseController;
class OssController extends BaseController
{
protected $accessKeyId = "LTAI5tMEAZrqSPSUuUcHEuR1";
protected $accessKeySecret = "dGtX1Sh8jatB1nFh6kOWYDIIeljcin";
protected $endpoint = "http://oss-cn-shanghai.aliyuncs.com";
protected $bucket = "bqbwallet";
public function actionUpload()
{
......@@ -25,8 +21,8 @@ class OssController extends BaseController
}
$object = md5(date('Y-m-d H:i:s') . $uploaded_file->tempName) . '.' . $uploaded_file->extension;
$filePath = $uploaded_file->tempName;
$ossClient = new OssClient($this->accessKeyId, $this->accessKeySecret, $this->endpoint);
$result = $ossClient->uploadFile($this->bucket, 'upload/' . (empty($type) ? '' : $type . '/') . $object, $filePath);
$ossClient = new OssClient(Yii::$app->params['Oss']['AccessKeyId'], Yii::$app->params['Oss']['AccessKeySecret'], Yii::$app->params['Oss']['Endpoint']);
$result = $ossClient->uploadFile(Yii::$app->params['Bucket'], 'upload/' . (empty($type) ? '' : $type . '/') . $object, $filePath);
if (!isset($result["info"]['url'])) {
$this->msg = '上传失败';
$this->code = -1;
......
......@@ -10,10 +10,6 @@ use yii\validators\ImageValidator;
class OssController extends BaseController
{
protected $accessKeyId = "LTAI5tMEAZrqSPSUuUcHEuR1";
protected $accessKeySecret = "dGtX1Sh8jatB1nFh6kOWYDIIeljcin";
protected $endpoint = "http://oss-cn-shanghai.aliyuncs.com";
protected $bucket = "bqbwallet";
public function actionUpload()
{
......@@ -22,8 +18,8 @@ class OssController extends BaseController
$uploaded_file = UploadedFile::getInstanceByName('file');
$object = md5(date('Y-m-d H:i:s') . $uploaded_file->tempName) . '.' . $uploaded_file->extension;
$filePath = $uploaded_file->tempName;
$ossClient = new OssClient($this->accessKeyId, $this->accessKeySecret, $this->endpoint);
$result = $ossClient->uploadFile($this->bucket, 'upload/' . (empty($type) ? '' : $type . '/') . $object, $filePath);
$ossClient = new OssClient(Yii::$app->params['Oss']['AccessKeyId'], Yii::$app->params['Oss']['AccessKeySecret'], Yii::$app->params['Oss']['Endpoint']);
$result = $ossClient->uploadFile(Yii::$app->params['Bucket'], 'upload/' . (empty($type) ? '' : $type . '/') . $object, $filePath);
if (!isset($result["info"]['url'])) {
return ['code' => 1, 'msg' => '上传失败'];
}
......
......@@ -178,7 +178,7 @@ class Admin extends \common\modelsgii\Admin implements IdentityInterface
public static function verfication($accessToken)
{
$key = 'bwallet'; //key要和签发的时候一样
$key = Yii::$app->params['Jwt']['Key'];//key要和签发的时候一样
try {
JWT::$leeway = 60;//当前时间减去60,把时间留点余地
$decoded = JWT::decode($accessToken, $key, ['HS256']); //HS256方式,这里要和签发的时候对应
......
......@@ -9,10 +9,6 @@ use wallet\base\BaseController;
class OssController extends BaseController
{
protected $accessKeyId = "LTAI5tMEAZrqSPSUuUcHEuR1";
protected $accessKeySecret = "dGtX1Sh8jatB1nFh6kOWYDIIeljcin";
protected $endpoint = "http://oss-cn-shanghai.aliyuncs.com";
protected $bucket = "bqbwallet";
public function actionUpload()
{
......@@ -26,8 +22,8 @@ class OssController extends BaseController
}
$object = md5(date('Y-m-d H:i:s') . $uploaded_file->tempName) . '.' . $uploaded_file->extension;
$filePath = $uploaded_file->tempName;
$ossClient = new OssClient($this->accessKeyId, $this->accessKeySecret, $this->endpoint);
$result = $ossClient->uploadFile($this->bucket, 'upload/' . (empty($type) ? '' : $type . '/') . $object, $filePath);
$ossClient = new OssClient(Yii::$app->params['Oss']['AccessKeyId'], Yii::$app->params['Oss']['AccessKeySecret'], Yii::$app->params['Oss']['Endpoint']);
$result = $ossClient->uploadFile(Yii::$app->params['Bucket'], 'upload/' . (empty($type) ? '' : $type . '/') . $object, $filePath);
if (!isset($result["info"]['url'])) {
$msg = '上传失败';
$code = -1;
......
......@@ -41,8 +41,8 @@ class UserController extends BaseController
goto doEnd;
}
$token = [
'iss' => 'https://www.bitfeel.cn', //签发者 可选
'aud' => 'https://www.bitfeel.cn', //接收该JWT的一方,可选
'iss' => Yii::$app->params['Jwt']['Iss'], //签发者 可选
'aud' => Yii::$app->params['Jwt']['Aud'], //接收该JWT的一方,可选
'iat' => time(), //签发时间
'nbf' => $time, //(Not Before):某个时间点后才能访问,比如设置time+30,表示当前时间30秒后才能使用
'exp' => $time + 7200, //过期时间,这里设置2个小时
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment