Skip to content
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

腾讯的接口1004错误 #141

Open
Quinndark opened this issue Oct 7, 2017 · 10 comments
Open

腾讯的接口1004错误 #141

Quinndark opened this issue Oct 7, 2017 · 10 comments

Comments

@Quinndark
Copy link

出现1004错误
[{"driver":"Qcloud","time":{"started_at":"0.33102900 1507352277","finished_at":"0.60767200 1507352277"},"success":false,"result":{"info":"{\"result\":1004,\"errmsg\":\"package format errorcannot get \/tel\/mobile\"}","code":1004}}]

@ahu
Copy link

ahu commented Jan 17, 2018

我也是...我去,折腾了一天了

@youngerrainbow
Copy link

@ahu 你是怎么修复的?

@ahu
Copy link

ahu commented Jan 18, 2018

@youngerrainbow 未及修复...先绕开了

@youngerrainbow
Copy link

@ahu 好像官方有兼容,是不是哪里调用不对?

@ahu
Copy link

ahu commented Jan 18, 2018

@youngerrainbow 只能等回头细看了:)

@youngerrainbow
Copy link

@ahu post 格式不对,给成 json 数组用 数字key 就可以了,我测试ok了

@fengerwoo
Copy link

@youngerrainbow 具体怎么改?

@ahu
Copy link

ahu commented Jan 22, 2018

@DreamboyA @youngerrainbow 我是直接修改了 QcloudAgent.php 把所有 'tel'=>$to 改为了 'tel' => ['nationcode' => '86', 'mobile' => $to] 解决的。另外需要注意的是template date 里定义的参数一定要跟你申请的模板一致

@dm521
Copy link

dm521 commented Nov 12, 2018

@ahu 多谢你的分享。这个问题,还需要把format_mobile 方法注释掉。

@leemem
Copy link

leemem commented Jul 1, 2019

@dm521 @ahu 多谢分享,我修改QcloudAgent.php 中的formatMobile,可以正常发送

public function formatMobile(array $list)
{
    $list = array_map(function ($value) {
        return [
            'nationcode'    => $value['nation'],
            'mobile'        => $value['number'],
        ];
    }, array_filter($list, function ($value) {
        return is_array($value);
    }));
    return count($list) === 1 ? array_pop($list) : array_values($list);
}

修改为:

public function formatMobile(array $list)
{
    $list = array_map(function ($value) {
        return [
            'nationcode'    => is_string($value) ? '86' : $value['nation'],
            'mobile'        => is_string($value) ? $value : $value['number'],
        ];
    }, array_filter($list, function ($value) {
        return is_array($value) || is_string($value);
    }));
    return count($list) === 1 ? array_pop($list) : array_values($list);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants