Commit bab60577 by 蒋勇

d

parent b9838446
...@@ -269,6 +269,22 @@ class AccessAuthAPI extends APIBase { ...@@ -269,6 +269,22 @@ class AccessAuthAPI extends APIBase {
await this.cacheManager["OpenCodeCache"].cache(opencode, ruser, 120); await this.cacheManager["OpenCodeCache"].cache(opencode, ruser, 120);
return system.getResultSuccess({ auth_url: authUrl, opencode: opencode }); return system.getResultSuccess({ auth_url: authUrl, opencode: opencode });
} }
//unWxBind
async unWxBind(pobj, qobj, req) {
var appkey = req.app.appkey;
if (!pobj.mobile) {
return system.getResult(null, "电话号码不能为空.");
}
var param = {
app_id: req.app.id,
mobile: pobj.mobile,
}
var ruser = await this.userSve.unWxBind(param);
if(!ruser){
return system.getResultFail(-1,"查无此账户",-129);
}
return system.getResult(ruser);
}
//wxbind //wxbind
async wxBind(pobj, qobj, req) { async wxBind(pobj, qobj, req) {
var appkey = req.app.appkey; var appkey = req.app.appkey;
...@@ -309,6 +325,8 @@ class AccessAuthAPI extends APIBase { ...@@ -309,6 +325,8 @@ class AccessAuthAPI extends APIBase {
return system.getResultSuccess({ auth_url: authUrl, opencode: opencode }); return system.getResultSuccess({ auth_url: authUrl, opencode: opencode });
} }
//wxbind //wxbind
async wxBindWithoutVCode(pobj, qobj, req) { async wxBindWithoutVCode(pobj, qobj, req) {
var appkey = req.app.appkey; var appkey = req.app.appkey;
if (!pobj.mobile) { if (!pobj.mobile) {
...@@ -802,6 +820,20 @@ class AccessAuthAPI extends APIBase { ...@@ -802,6 +820,20 @@ class AccessAuthAPI extends APIBase {
rtnType: "成功:{status:0,data:{auth_url: xxxxx/auth?opencode=xxxxx,opencode:yyyy})" rtnType: "成功:{status:0,data:{auth_url: xxxxx/auth?opencode=xxxxx,opencode:yyyy})"
}, },
{ {
methodDesc: "按照手机号,解除微信绑定,访问地址:http://......../api/auth/accessAuth/unWxBind,访问token需要放置到后续API方法调用的请求头中",
methodName: "wxBind",
paramdescs: [
{
paramDesc: "手机号",
paramName: "mobile",
paramType: "string",
defaultValue: "",
},
],
rtnTypeDesc: "返回绑定后用户",
rtnType: "成功:{status:0....});失败:{status:-1,....data:-129}),表示不存在账号;"
},
{
methodDesc: "按照微信ID进行登录,访问地址:http://......../api/auth/accessAuth/loginByOpenId,访问token需要放置到后续API方法调用的请求头中", methodDesc: "按照微信ID进行登录,访问地址:http://......../api/auth/accessAuth/loginByOpenId,访问token需要放置到后续API方法调用的请求头中",
methodName: "loginByOpenId", methodName: "loginByOpenId",
paramdescs: [ paramdescs: [
......
...@@ -349,6 +349,19 @@ class UserService extends ServiceBase { ...@@ -349,6 +349,19 @@ class UserService extends ServiceBase {
} }
return user; return user;
} }
async unWxBind(u){
var self=this;
return this.db.transaction(async function (t) {
var user = await self.dao.model.findOne({where: { mobile: u.mobile,app_id: u.app_id }});
if(!user){
return null;
}else{
user.wxopenid=null;
await user.save();
return user;
}
});
}
async checkWxBind(u){ async checkWxBind(u){
var user = await this.dao.model.findOne({where: {wxopenid: u.openid, app_id: u.app_id}}); var user = await this.dao.model.findOne({where: {wxopenid: u.openid, app_id: u.app_id}});
return user; return user;
...@@ -417,8 +430,7 @@ module.exports = UserService; ...@@ -417,8 +430,7 @@ module.exports = UserService;
// (async ()=>{ // (async ()=>{
// var us=new UserService(); // var us=new UserService();
// var u= await us.findUserByMobilePwd(2,'123456789','123'); // var u= await us.findUserByMobilePwd(2,'123456789','123');
// console.log(u.userName); // var x=await us.unWxBind({mobile:'987456',app_id:2});
// var x=await us.updateUserMobile(u,'987456');
// if(!x){ // if(!x){
// console.log("exit..."); // console.log("exit...");
// } // }
......
...@@ -10,8 +10,8 @@ var settings = { ...@@ -10,8 +10,8 @@ var settings = {
user: "root", user: "root",
password: "123456", password: "123456",
config: { config: {
host: '43.247.184.35', host: '192.168.4.119',
port: 8899, port: 3306,
dialect: 'mysql', dialect: 'mysql',
operatorsAliases: false, operatorsAliases: false,
pool: { pool: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment