新增阿里云oss上传文件

This commit is contained in:
2023-03-02 16:51:47 +08:00
parent d51d5355a0
commit 186f92c4ea
11 changed files with 188 additions and 159 deletions
+40
View File
@@ -217,4 +217,44 @@ class Wechat
throw new BusinessException($e->getMessage(), HttpEnumCode::SERVER_ERROR);
}
}
// 获取分享二维码
/**
* @throws NotFoundExceptionInterface
* @throws RedirectionExceptionInterface
* @throws ContainerExceptionInterface
* @throws DecodingExceptionInterface
* @throws ClientExceptionInterface
* @throws TransportExceptionInterface
* @throws ServerExceptionInterface
*/
public function getUnlimitedQRCode(array $options){
try {
$this->createApp($this->config['app_id'], $this->config['secret']);
$client = $this->createClient($this->config['app_id'], $this->config['secret']);
$response = $client->postJson('wxa/getwxacodeunlimit', $options);
if ($response->isFailed()) {
// 出错了,处理异常
$result = $response->toArray();
if(empty($result)){
// 返回值为空
return [];
}
if (isset($result['errcode'])){
throw new BusinessException();
}
return [];
}
return $response->getContent(true);
} catch (\Exception $e) {
throw new BusinessException($e->getMessage(), HttpEnumCode::SERVER_ERROR);
}
}
}