|
|
@ -26,7 +26,7 @@ namespace _24Hour.Controllers |
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
|
/// 되쩌 |
|
|
|
/// 되쩌 |
|
|
|
/// </summary> |
|
|
|
/// </summary> |
|
|
|
[HiddenApi] |
|
|
|
// [HiddenApi] |
|
|
|
[ApiController] |
|
|
|
[ApiController] |
|
|
|
[Route("api/APP")] |
|
|
|
[Route("api/APP")] |
|
|
|
public class LoginController : ControllerBase |
|
|
|
public class LoginController : ControllerBase |
|
|
@ -301,7 +301,28 @@ namespace _24Hour.Controllers |
|
|
|
LogService.WriteLog(ex, "되쩌"); |
|
|
|
LogService.WriteLog(ex, "되쩌"); |
|
|
|
} |
|
|
|
} |
|
|
|
return ret; |
|
|
|
return ret; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// 微信Code 登陆 |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
/// <param name="code"></param> |
|
|
|
|
|
|
|
/// <returns></returns> |
|
|
|
|
|
|
|
[HttpGet] |
|
|
|
|
|
|
|
[Route("WeChatLoginCode")] |
|
|
|
|
|
|
|
public async Task<Result> WeChatLoginByCode(string code) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
var opendata = await GetOpenId(code); |
|
|
|
|
|
|
|
if (opendata.IsSucceed==true) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return WeChatLogin(opendata.result); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return opendata; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
|
/// 菓斤竿홈되쩌 |
|
|
|
/// 菓斤竿홈되쩌 |
|
|
@ -389,7 +410,8 @@ namespace _24Hour.Controllers |
|
|
|
{ |
|
|
|
{ |
|
|
|
try |
|
|
|
try |
|
|
|
{ |
|
|
|
{ |
|
|
|
var data = await _db.Queryable<App_Sys_UserModel>().Where(q => q.phone == UserModel.phone).FirstAsync(); |
|
|
|
|
|
|
|
|
|
|
|
var data = await _db.Queryable<App_Sys_UserModel>().Where(q => q.phone == UserModel.phone && q.IsDeleted == 0).FirstAsync(); |
|
|
|
if (UserModel.identity == "쪼可") |
|
|
|
if (UserModel.identity == "쪼可") |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (data != null && (data.identity != "쪼可" || data.audit == 0)) |
|
|
|
if (data != null && (data.identity != "쪼可" || data.audit == 0)) |
|
|
@ -582,6 +604,43 @@ namespace _24Hour.Controllers |
|
|
|
} |
|
|
|
} |
|
|
|
return ret; |
|
|
|
return ret; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// 小程序AppID |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
private const string appid = "wx48108a0c98a3dab0"; |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// 小程序secretID |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
private const string secid = "e752e4fba67526eca21313a18c96a58f"; |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// 获取微信openid |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
/// <param name="code"></param> |
|
|
|
|
|
|
|
/// <returns></returns> |
|
|
|
|
|
|
|
[HttpGet("getOpenid")] |
|
|
|
|
|
|
|
public async Task<Result> GetOpenId(string code) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
var opendata = HttpHelper.Get($"https://api.weixin.qq.com/sns/jscode2session?appid={appid}&secret={secid}&js_code={code}&grant_type=authorization_code"); |
|
|
|
|
|
|
|
var data = JsonConvert.DeserializeAnonymousType(opendata, new |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
openid=default(string), |
|
|
|
|
|
|
|
session_key = default(string), |
|
|
|
|
|
|
|
unionid = default(string), |
|
|
|
|
|
|
|
errcode = default(int), |
|
|
|
|
|
|
|
errmsg = default(string), |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
if (data.errcode==0) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ret.IsSucceed = true; |
|
|
|
|
|
|
|
ret.result = data.openid; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ret.IsSucceed = false; |
|
|
|
|
|
|
|
ret.Message = data.errmsg; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return ret; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|