Browse Source

添加用户绑定openid

develop-lawyerExampaper
胡超1 2 years ago
parent
commit
e9b6972018
  1. 17
      24Hour/Controllers/system/SystemControllerController.cs

17
24Hour/Controllers/system/SystemControllerController.cs

@ -329,6 +329,23 @@ namespace _24Hour.Controllers.system
result.Message = "当前微信已与其他账号绑定"; result.Message = "当前微信已与其他账号绑定";
return result; return result;
} }
var model = await _db.Queryable<App_Sys_UserModel>().Where(x => x.Id == _userdata.Id && x.IsDeleted == 0).FirstAsync();
if (model != null)
{
model.wechatId = getopenid.result;
}
_db.BeginTran();
var num = await _db.Updateable(model).UpdateColumns(it => new { it.wechatId }).ExecuteCommandAsync();
//var num = await _db.Updateable(UserModel).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
_db.CommitTran();
if (num > 0)
{
result.IsSucceed = true;
result.result = getopenid.result;
}
}
catch (System.Exception ex) catch (System.Exception ex)
{ {
_db.RollbackTran(); _db.RollbackTran();

Loading…
Cancel
Save