add clear

This commit is contained in:
2020-04-01 11:53:15 +08:00
parent 7eeaef4c3b
commit 9dd8ea2d0b
8 changed files with 31 additions and 5 deletions
+10
View File
@@ -50,6 +50,8 @@ class Account extends SmallProgram
$this->request->setMethod(HttpClient::GET);
$this->request->addHeader('Content-Type', 'text/xml');
$this->request->setErrorField('errcode');
$this->request->setErrorMsgField('errmsg');
return $this->request->get('sns/jscode2session', $param);
}
@@ -69,6 +71,8 @@ class Account extends SmallProgram
$this->request->setMethod(HttpClient::GET);
$this->request->setIsSSL(true);
$this->request->setErrorField('errcode');
$this->request->setErrorMsgField('errmsg');
return $this->request->get($this->publicInfo, $query);
}
@@ -114,6 +118,8 @@ class Account extends SmallProgram
$this->request->setMethod(HttpClient::POST);
$this->request->setCallback([$this, 'saveByPath']);
$this->request->setErrorField('errcode');
$this->request->setErrorMsgField('errmsg');
return $this->request->post($url, $sendBody);
}
@@ -142,6 +148,8 @@ class Account extends SmallProgram
$this->request->setMethod(HttpClient::POST);
$this->request->setCallback([$this, 'saveByPath']);
$this->request->setErrorField('errcode');
$this->request->setErrorMsgField('errmsg');
return $this->request->post($url, $sendBody);
}
@@ -169,6 +177,8 @@ class Account extends SmallProgram
$this->request->setMethod(HttpClient::POST);
$this->request->setCallback([$this, 'saveByPath']);
$this->request->setErrorField('errcode');
$this->request->setErrorMsgField('errmsg');
return $this->request->post($url, $sendBody);
}
+2
View File
@@ -300,6 +300,8 @@ class Message extends SmallProgram
$url = '/cgi-bin/message/custom/send?access_token=' . $this->getAccessToken();
$this->request->setMethod(HttpClient::POST);
$this->request->setErrorField('errcode');
$this->request->setErrorMsgField('errmsg');
/** @var Result $body */
$body = $this->request->post($url, $data);
+2 -1
View File
@@ -147,7 +147,8 @@ class PublicTemplate extends SmallProgram
$this->request->setIsSSL(true);
$this->request->addHeader('content-type', 'application/json');
$this->request->setErrorField('errcode');
$this->request->setErrorMsgField('errmsg');
$result = $this->request->post($url, $params);
$result->append('postBody', $params);
+2
View File
@@ -175,6 +175,8 @@ class Recharge extends SmallProgram
$this->request->setIsSSL(true);
$this->request->setMethod(HttpClient::POST);
$this->request->addHeader('Content-Type', 'text/xml');
$this->request->setErrorField('errcode');
$this->request->setErrorMsgField('errmsg');
return $this->request->send($url, $data);
}
}
+9 -3
View File
@@ -32,7 +32,9 @@ class SecCheck extends SmallProgram
return $this->sendError('文件不存在', 404);
}
$this->request->setUseSwoole(false);
$this->request->setHeader(['Content-Type' => 'multipart/form-data']);
$this->request->setHeader('Content-Type', 'multipart/form-data');
$this->request->setErrorField('errcode');
$this->request->setErrorMsgField('errmsg');
return $this->request->post($this->_url . $this->config->getAccessToken(), ['media' => new \CURLFile($path)]);
}
@@ -48,7 +50,9 @@ class SecCheck extends SmallProgram
if (!in_array($type, [self::MEDIA_IMAGE, self::MEDIA_VIDEO])) {
throw new \Exception('暂不支持的文件类型');
}
$this->request->setHeader(['Content-Type' => 'application/json']);
$this->request->setHeader('Content-Type', 'application/json');
$this->request->setErrorField('errcode');
$this->request->setErrorMsgField('errmsg');
$response = $this->request->post($this->_mediaCheckAsync . $this->config->getAccessToken(), [
'media_url' => $url,
'media_type' => $type
@@ -79,7 +83,9 @@ class SecCheck extends SmallProgram
if (empty($content)) {
return $this->sendError('文件不存在', 404);
}
$this->request->setHeader(['Content-Type' => 'application/json']);
$this->request->setHeader('Content-Type', 'application/json');
$this->request->setErrorField('errcode');
$this->request->setErrorMsgField('errmsg');
return $this->request->post($this->_msgUrl . $this->config->getAccessToken(), ['content' => $content]);
}
+2
View File
@@ -28,6 +28,8 @@ class SmallProgram extends Miniprogarampage
'appid' => $this->config->getAppid(),
'secret' => $this->config->getAppsecret()
];
$this->request->setErrorField('errcode');
$this->request->setErrorMsgField('errmsg');
$param = $this->request->get($this->url, $query);
if (!$param->isResultsOK()) {
throw new \Exception($param->getMessage());
+2
View File
@@ -125,6 +125,8 @@ class Subject extends SmallProgram
$this->request->setIsSSL(true);
$this->request->addHeader('content-type', 'application/json');
$this->request->setErrorField('errcode');
$this->request->setErrorMsgField('errmsg');
$result = $this->request->post($url, $params);
$result->append('postBody', $params);
+2 -1
View File
@@ -136,7 +136,8 @@ class Template extends SmallProgram
$this->request->setIsSSL(true);
$this->request->addHeader('content-type', 'application/json');
$this->request->setErrorField('errcode');
$this->request->setErrorMsgField('errmsg');
$result = $this->request->post($url, $params);
$result->append('postBody', $params);