@RequestMapping("saveUnionid")
@ResponseBody
public Integer saveUnionid(HttpServletRequest request,HttpServletResponse response){
//查询数据库是否有匹配记录
String openid = request.getParameter("openid");
String Phone = request.getParameter("Phone");
List
list = userRepository.getListByPhone(Phone);
if(list.size() >0){
userRepository.updateUseropenid(openid,Phone);
}
return list.size();
}
//前端js
function approvalSaveBtn() {
var Phone = document.getElementById("Phone").value;
var openid = document.getElementById("openid").value;
$.ajax({
url : "${CtxPath}/storeadmin/biz/ou/user/saveUnionid.do",
type : "POST",
data : {
Phone : Phone,
openid : openid
},
//dataType:"json",
success : function(result) {
alert(result);
if (result == 0) {
//alert(1);
alert("请核对手机号码");
} else {
alert("绑定成功");
WeixinJSBridge.call('closeWindow');
}
}
})
}
为什么手机端回调函数的result是html 文档,pc正常?求大神解答。
微信小程序开发问题解答
微信小程序开发者回答:
看样子是未登录后台接口重定向了
本文网址:http://www.91bianli.com/weixinxiaochengxu/18831.html