【前端】接入内容安全检测接口 Test_content_security.php
后台 PHP 文件 路径
域名/addons/yl_welore/web/static/uploads/Test_content_security.php
前端代码标签
搜索 “检测到新版本” 或者 彭于晏
app.js 的 315行 添加以下代码 (最后 });前添加)
改后+昵称文本检测 index.js 69行添加
- app.testContentsecurityText(s.autograph+s.nick_name+'1',3,fun)
复制代码
改后+昵称文本检测完整app.js- testContentsecurityText(text='1',scene=3,fun){//检查文本内容安全
- var openid=wx.getStorageSync('userinfoqtz').value.openid
- wx.request({
- url:baseUrl+'Test_content_security.php',
- data:{
- type:"text",
- openid:openid,
- content:text,
- },
- method:"GET",
- success(res){
- var label=res.data.errcode
- if(label==87014){
- return wx.showToast({
- title: '你发布的内容存在违规行为,请修改后再发布',
- icon:"none"
- })
- }
- fun()
- }
- })
-
-
- },
- testContentsecurityImage(imgurl="",scene=3,type=2,fun){//检查图片内容安全
- var code=wx.getStorageSync('code')
- var openid=wx.getStorageSync('userinfoqtz').value.openid
- console.log(imgurl)
- var imgurl=imgurl.substring(imgurl.lastIndexOf('/')+1)
- wx.request({
- url:baseUrl+'Test_content_security.php',
- data:{
- type:"image",
- code:code,
- media_url:imgurl,
- openid:openid
- },
- success(res){
- if(res.data.errcode==87014){
- return wx.showModal({
- title:"提示",
- content:"图片含有违规内容"
- })
- }else if(res.data.errcode==0){
- fun()
- console.log('图片正常')
- }else{
- console.log('图片检查出错')
- }
-
-
-
- }
- })
-
-
- }
复制代码
|
|