收藏
回答

文本内容安全检查接口,内部报错。什么原因啊?之前用着没事,突然就不行了

上面是问题截图.

function contentCheck(content){

        console.log("contentCheck-----",content)

        var d = Date.now()

        return new Promise((resolve,reject)=>{

            wx.serviceMarket.invokeService({

                service: 'wxee446d7507c68b11',

                api: 'msgSecCheck',

                data: {

                  "Action": "TextApproval",

                  "Text": content

                },

              }).then(res => {          

                var type = Object.prototype.toString.call(res.data).slice(8,-1)

                var response = ''

                if(type=='Object'){

                    response = res.data

                }else{

                    response =JSON.parse(res.data)

                }

                console.log("JSON",response)

                var List = response.Response.EvilTokens

                var arr = []

                var i = 0;

                List.forEach(e => {

                    e.EvilKeywords.forEach(item=>{

                        arr[i=item

                        i++

                    })

                });

                arr =[...new Set(arr)]

                resolve(arr)

              }).catch(err=>{

                  console.log("--err",err)

                  reject(err)

              })

        })

}


回答关注问题邀请回答
收藏

2 个回答

登录 后发表内容
问题标签