-
Notifications
You must be signed in to change notification settings - Fork 426
Add cloud SMS interface #300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/Qiniu/Sms/sms.php
Outdated
$params['pics'] = $this->imgToBase64($pics); | ||
} | ||
$body = json_encode($params); | ||
$url =$this->baseURL."signature"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
使用单引号
src/Qiniu/Http/Client.php
Outdated
@@ -119,7 +126,13 @@ public static function sendRequest($request) | |||
curl_close($ch); | |||
return $r; | |||
} | |||
$curl_info = curl_getinfo($ch); | |||
$header_size = $curl_info["header_size"]; | |||
$body = substr($result, $header_size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这块逻辑下面有了
src/Qiniu/Http/Client.php
Outdated
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE); | ||
if ($code != 200) { | ||
throw new \Exception("\nhttpcode:".$code."\nmessage".$body); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
php 这边没引入 Exception, 还是使用error 处理吧。
src/Qiniu/Sms/sms.php
Outdated
trade_name 商标名的全称或简称, | ||
* pics: 本地的图片路径 string 类型,可选 | ||
*/ | ||
public function createSignature($signature, $source, $pics = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
函数参数 指定好类型
src/Qiniu/Sms/sms.php
Outdated
* audit_status: 审核状态 string 类型,可选, | ||
取值范围为: "passed"(通过), "rejected"(未通过), "reviewing"(审核中) | ||
* page:页码 int 类型, | ||
* maxUsers:人数限制 ,可选,默认为 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个函数里没有提现
src/Qiniu/Sms/sms.php
Outdated
$params['signature_id'] = $signture_id; | ||
|
||
$body = json_encode($params); | ||
var_dump($body); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
测试代码删除
src/Qiniu/Sms/sms.php
Outdated
|
||
$body = json_encode($params); | ||
var_dump($body); | ||
$url =$this->baseURL."template"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
单引号
取值范围为: notification (通知类短信), verification (验证码短信), marketing (营销类短信) | ||
* description: 申请理由简述 string 类型,必填 | ||
* signature_id: 已经审核通过的签名 string 类型,必填 | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
返回值最好加上注释
取值范围为: passed (通过), rejected (未通过), reviewing (审核中) | ||
* page: 页码 int 类型,可选,默认为 1 | ||
* page_size: 分页大小 int 类型,可选,默认为 20 | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
返回值的数据结构加上注释
src/Qiniu/Sms/sms.php
Outdated
if ($fp) { | ||
$filesize = filesize($app_img_file); | ||
if ($filesize > 5*1024*1024) { | ||
new Error("pic size < 5M !"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
返回错误?
return array($ret->json(), null); | ||
} | ||
|
||
private function post($url, $body, $contentType = 'application/json') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@方兴看下这个是否要重构下, 不能每个class 都要封装一次 post/get 。。 等方法
No description provided.