问题
使用腾讯接口进行短信验证码发送, 返回该错误
{“Code”:“InvalidParameterValue.TemplateParameterFormatError”
详细问题
2022-09-04 18:45:58.650 14899-15228/com.example.electronicmall I/System.out: {"RequestId":"f2e1bf2c-91c0-44d7-908a-a746912da27f","SendStatusSet":[{"Code":"InvalidParameterValue.TemplateParameterFormatError","Fee":0,"IsoCode":"","Message":"Verification code template parameter format error","PhoneNumber":"+8612345678910","SerialNo":"","SessionContext":""}]}
解决
定位该段代码
String[] templateParamSet = {SendSms.num, String.valueOf("半")};
req.setTemplateParamSet(templateParamSet);
改为
String[] templateParamSet = {SendSms.num, String.valueOf(0.5)};
req.setTemplateParamSet(templateParamSet);
原因
对于模板指定位置, 只支持数字
原创不易
转载请标明出处
如果对你有所帮助 别忘啦点赞支持哈