文章目录
- 18小时前小编发现微信小程序用户:【花栗鼠🐭】提出了一个关于“调用百度翻译API总是返回错误代码54001(签名错误)?”的问题,在问题中开发者花栗鼠🐭对该问题做了如下阐述:
- API和组件:
- import md5 from ‘./md5.min.js’ const appid = ” const key = ” //百度翻译key const salt = ‘2222222222’ //随机数 const cuid = ‘APICUID’ const mac = ‘mac’ const version = ‘3’ const paste = ‘0’ const from = ‘en’ const to = ‘zh’ photoTranslation(image) { var image = this.data.pictemp;//pictemp是拍下来的照片 console.log(image); wx.uploadFile({ url: ‘https://fanyi-api.baidu.com/api/trans/sdk/picture’, filePath: image, name: ‘file’, formData: { from, to, appid, salt, cuid, mac, version, method: ‘GET’, contentType: ‘multipart/form-data’, dataType: ‘json’, // paste, //图片贴合类型:0关闭文字贴合 1返回整图贴合 2返回块区贴合 sign: md5(`${appid}${md5(image)}${salt}${cuid}${mac}${key}`) }, success: function (res) { console.log(res); } }) }, 我本来是用的是wx.request,但时也无法返回正确内容 看到社区有类似问题评论说用wx.uploadfile,我就试了,还是不行。 这里附上百度图片翻译的文档:http://api.fanyi.baidu.com/api/trans/product/desktop?req=photosdk 注:以上是微信小程序开发者:”花栗鼠🐭”对于本问题的一些阐述,这里做一个引用,我们将实时关注微信小程序助手对该问题提出的解决方案。
- 【3小时前】微信小程序技术运营专员对用户花栗鼠🐭提出的调用百度翻译API总是返回错误代码54001(签名错误)?给予如下回复 请移步百度翻译相关社区
- 微信官方小程序的优势是,其用户体验可以最大限度的接近Native App。因此,微信官方智能小程序也把用户体验作为一个核心进行了优化 如果您也在使用微信小程序,请关注我们,如果您有关于微信小程序的使用问题请关注我们,如果您要找百度小程序模板、微信小程序模板请关注小程序模板网或者去微信开放社区找官方人员给予解决,相信微信官方在小程序上的发力会是一个里程碑!
18小时前小编发现微信小程序用户:【花栗鼠🐭】提出了一个关于“调用百度翻译API总是返回错误代码54001(签名错误)?”的问题,在问题中开发者花栗鼠🐭对该问题做了如下阐述:
API和组件:
API和组件:
import md5 from ‘./md5.min.js’
const appid = ”
const key = ” //百度翻译key
const salt = ‘2222222222’ //随机数
const cuid = ‘APICUID’
const mac = ‘mac’
const version = ‘3’
const paste = ‘0’
const from = ‘en’
const to = ‘zh’
photoTranslation(image) {
var image = this.data.pictemp;//pictemp是拍下来的照片
console.log(image);
wx.uploadFile({
url: ‘https://fanyi-api.baidu.com/api/trans/sdk/picture’,
filePath: image,
name: ‘file’,
formData: {
from,
to,
appid,
salt,
cuid,
mac,
version,
method: ‘GET’,
contentType: ‘multipart/form-data’,
dataType: ‘json’,
// paste, //图片贴合类型:0关闭文字贴合 1返回整图贴合 2返回块区贴合
sign: md5(`${appid}${md5(image)}${salt}${cuid}${mac}${key}`)
},
success: function (res) {
console.log(res);
}
})
},
我本来是用的是wx.request,但时也无法返回正确内容
看到社区有类似问题评论说用wx.uploadfile,我就试了,还是不行。
这里附上百度图片翻译的文档:http://api.fanyi.baidu.com/api/trans/product/desktop?req=photosdk
import md5 from ‘./md5.min.js’
const appid = ”
const key = ” //百度翻译key
const salt = ‘2222222222’ //随机数
const cuid = ‘APICUID’
const mac = ‘mac’
const version = ‘3’
const paste = ‘0’
const from = ‘en’
const to = ‘zh’
photoTranslation(image) {
var image = this.data.pictemp;//pictemp是拍下来的照片
console.log(image);
wx.uploadFile({
url: ‘https://fanyi-api.baidu.com/api/trans/sdk/picture’,
filePath: image,
name: ‘file’,
formData: {
from,
to,
appid,
salt,
cuid,
mac,
version,
method: ‘GET’,
contentType: ‘multipart/form-data’,
dataType: ‘json’,
// paste, //图片贴合类型:0关闭文字贴合 1返回整图贴合 2返回块区贴合
sign: md5(`${appid}${md5(image)}${salt}${cuid}${mac}${key}`)
},
success: function (res) {
console.log(res);
}
})
},
我本来是用的是wx.request,但时也无法返回正确内容
看到社区有类似问题评论说用wx.uploadfile,我就试了,还是不行。
这里附上百度图片翻译的文档:http://api.fanyi.baidu.com/api/trans/product/desktop?req=photosdk
注:以上是微信小程序开发者:”花栗鼠🐭”对于本问题的一些阐述,这里做一个引用,我们将实时关注微信小程序助手对该问题提出的解决方案。
【3小时前】微信小程序技术运营专员对用户花栗鼠🐭提出的调用百度翻译API总是返回错误代码54001(签名错误)?给予如下回复
请移步百度翻译相关社区
微信官方小程序的优势是,其用户体验可以最大限度的接近Native App。因此,微信官方智能小程序也把用户体验作为一个核心进行了优化
如果您也在使用微信小程序,请关注我们,如果您有关于微信小程序的使用问题请关注我们,如果您要找百度小程序模板、微信小程序模板请关注小程序模板网或者去微信开放社区找官方人员给予解决,相信微信官方在小程序上的发力会是一个里程碑!