修改添加签章配置重复问题
This commit is contained in:
@@ -342,4 +342,80 @@ class Wechat
|
||||
throw new BusinessException($e->getMessage(), HttpEnumCode::SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成UrlScheme
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws RedirectionExceptionInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws DecodingExceptionInterface
|
||||
* @throws ClientExceptionInterface
|
||||
* @throws TransportExceptionInterface
|
||||
* @throws ServerExceptionInterface
|
||||
*/
|
||||
public function createUrlScheme(array $options): array|string
|
||||
{
|
||||
try {
|
||||
$this->createApp($this->config['app_id'], $this->config['secret']);
|
||||
|
||||
$client = $this->createClient($this->config['app_id'], $this->config['secret']);
|
||||
|
||||
$response = $client->postJson('wxa/generatescheme', $options);
|
||||
|
||||
if ($response->isFailed()) {
|
||||
// 出错了,处理异常
|
||||
$result = $response->toArray();
|
||||
if(empty($result)){
|
||||
// 返回值为空
|
||||
throw new BusinessException("返回值为空");
|
||||
}
|
||||
if (isset($result['errcode'])){
|
||||
throw new BusinessException($result['errmsg']);
|
||||
}
|
||||
throw new BusinessException();
|
||||
}
|
||||
|
||||
return $response->toArray();
|
||||
} catch (\Exception $e) {
|
||||
throw new BusinessException($e->getMessage(), HttpEnumCode::SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取UrlScheme
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws RedirectionExceptionInterface
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws DecodingExceptionInterface
|
||||
* @throws ClientExceptionInterface
|
||||
* @throws TransportExceptionInterface
|
||||
* @throws ServerExceptionInterface
|
||||
*/
|
||||
public function getUrlScheme(array $options): array|string
|
||||
{
|
||||
try {
|
||||
$this->createApp($this->config['app_id'], $this->config['secret']);
|
||||
|
||||
$client = $this->createClient($this->config['app_id'], $this->config['secret']);
|
||||
|
||||
$response = $client->postJson('/wxa/queryscheme', $options);
|
||||
|
||||
if ($response->isFailed()) {
|
||||
// 出错了,处理异常
|
||||
$result = $response->toArray();
|
||||
if(empty($result)){
|
||||
// 返回值为空
|
||||
throw new BusinessException("返回值为空");
|
||||
}
|
||||
if (isset($result['errcode'])){
|
||||
throw new BusinessException($result['errmsg']);
|
||||
}
|
||||
throw new BusinessException();
|
||||
}
|
||||
|
||||
return $response->toArray();
|
||||
} catch (\Exception $e) {
|
||||
throw new BusinessException($e->getMessage(), HttpEnumCode::SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user