2021-03-22 16:05:40 +08:00
|
|
|
|
using Assets.Scripts.Apis.Models;
|
2021-04-21 16:16:14 +08:00
|
|
|
|
using Newtonsoft.Json;
|
2021-04-06 15:30:36 +08:00
|
|
|
|
using Newtonsoft.Json.Linq;
|
2021-03-22 16:05:40 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Threading.Tasks;
|
2021-07-30 14:01:10 +08:00
|
|
|
|
using UnityEngine;
|
2021-03-22 16:05:40 +08:00
|
|
|
|
|
|
|
|
|
|
namespace Assets.Scripts.Apis
|
|
|
|
|
|
{
|
|
|
|
|
|
public class UserApi : ApiBase
|
|
|
|
|
|
{
|
|
|
|
|
|
public async Task<JsonResult<UserResultModel>> Login(string phone, string pwd, string countryCode)
|
|
|
|
|
|
{
|
|
|
|
|
|
var param = new
|
|
|
|
|
|
{
|
|
|
|
|
|
Phone = phone,
|
|
|
|
|
|
Pwd = pwd,
|
|
|
|
|
|
countryCode
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
JsonResult<UserResultModel> ret = null;
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
ret = await PostAsync<JsonResult<UserResultModel>>("NoAuth/v1/Login", param);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
return new JsonResult<UserResultModel> { result = false, errMsg = ex.Message };
|
|
|
|
|
|
}
|
|
|
|
|
|
//ApiBase.cookies = response.Cookies;
|
|
|
|
|
|
//var ret = response.DynamicBody;
|
|
|
|
|
|
if (ret.result)
|
|
|
|
|
|
{
|
|
|
|
|
|
//var str = Newtonsoft.Json.JsonConvert.SerializeObject(ret.data);
|
|
|
|
|
|
var user = new UserResultModel();
|
|
|
|
|
|
user.Id = ret.data.Id;
|
|
|
|
|
|
user.Nickname = ret.data.Nickname;
|
|
|
|
|
|
user.Phone = ((string)ret.data.Phone).Trim();
|
|
|
|
|
|
user.Country = ret.data.Country;
|
|
|
|
|
|
user.Province = ret.data.Province;
|
|
|
|
|
|
user.City = ret.data.City;
|
|
|
|
|
|
user.Area = ret.data.Area;
|
|
|
|
|
|
user.Pass = ret.data.Pass;
|
|
|
|
|
|
user.Sex = ret.data.Sex;
|
|
|
|
|
|
user.Unit = ret.data.Unit;
|
|
|
|
|
|
user.Weight = ret.data.Weight;
|
|
|
|
|
|
user.FTP = ret.data.FTP;
|
|
|
|
|
|
user.WheelDiameter = ret.data.WheelDiameter;
|
|
|
|
|
|
user.Email = user.Email ?? "";
|
|
|
|
|
|
user.Pass = user.Pass ?? "";
|
|
|
|
|
|
user.OtherPlatforms = user.OtherPlatforms ?? "";
|
|
|
|
|
|
user.WxHeadImg = ret.data.WxHeadImg ?? "";
|
|
|
|
|
|
//user.LoginTime = ret.data.LoginTime;
|
|
|
|
|
|
user.LastLoginTime = ret.data.LastLoginTime;
|
|
|
|
|
|
user.AutoPause = ret.data.AutoPause;
|
|
|
|
|
|
user.MaxHeartRate = ret.data.MaxHeartRate;
|
|
|
|
|
|
user.CanEditRoom = ret.data.CanEditRoom;
|
|
|
|
|
|
user.BicycleWeight = ret.data.BicycleWeight;
|
|
|
|
|
|
user.Contact = ret.data.Contact;
|
|
|
|
|
|
user.ContactPhone = ret.data.ContactPhone;
|
|
|
|
|
|
user.ContactAddress = ret.data.ContactAddress;
|
|
|
|
|
|
user.Sensitivity = ret.data.Sensitivity;
|
2021-05-12 10:42:26 +08:00
|
|
|
|
//if (ret.data.ConnectedToStrava != null)
|
2021-03-22 16:05:40 +08:00
|
|
|
|
{
|
|
|
|
|
|
user.ConnectedToStrava = ret.data.ConnectedToStrava;
|
|
|
|
|
|
}
|
2021-04-09 09:44:06 +08:00
|
|
|
|
user.Birthday = ret.data.Birthday;
|
2021-04-23 09:22:12 +08:00
|
|
|
|
user.LastUpdateFtpTime = ret.data.LastUpdateFtpTime;
|
|
|
|
|
|
user.LastUpdateWeightTime = ret.data.LastUpdateWeightTime;
|
|
|
|
|
|
user.LastUpdateBicycleWeightTime = ret.data.LastUpdateBicycleWeightTime;
|
2021-04-28 15:30:38 +08:00
|
|
|
|
user.Height = ret.data.Height;
|
2021-03-22 16:05:40 +08:00
|
|
|
|
//todo: check local database, insert new user
|
2021-07-27 09:18:34 +08:00
|
|
|
|
user.WebHost = ret.data.WebHost;
|
2021-07-30 14:01:10 +08:00
|
|
|
|
user.CanCreateRace = ret.data.CanCreateRace;
|
2021-03-22 16:05:40 +08:00
|
|
|
|
//PubCommData.CurrentUser = user;
|
2021-04-06 15:30:36 +08:00
|
|
|
|
user.cookie = cookies[0].Value;
|
2021-03-22 16:05:40 +08:00
|
|
|
|
return new JsonResult<UserResultModel>() { result = true, data = user };
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
return new JsonResult<UserResultModel>() { result = false, data = null, errMsg = ret.errMsg };
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-01-27 14:11:28 +08:00
|
|
|
|
|
|
|
|
|
|
public async Task<JsonResult<object>> AppleCompleteInfo(string phone, string Captcha, string pwd)
|
|
|
|
|
|
{
|
|
|
|
|
|
return await PostAsync<JsonResult<object>>("User/AppleCompleteInfo", new { phone, Captcha, pwd });
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-04-21 16:16:14 +08:00
|
|
|
|
public async Task<JsonResult<object>> LoginV1(string phone, string pwd, string countryCode)
|
|
|
|
|
|
{
|
|
|
|
|
|
var param = new
|
|
|
|
|
|
{
|
|
|
|
|
|
Phone = phone,
|
|
|
|
|
|
Pwd = pwd,
|
|
|
|
|
|
countryCode
|
|
|
|
|
|
};
|
2021-03-22 16:05:40 +08:00
|
|
|
|
|
2021-04-21 16:16:14 +08:00
|
|
|
|
JsonResult<object> ret = null;
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
ret = await PostAsync<JsonResult<object>>("NoAuth/v1/Login", param);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
return new JsonResult<object> { result = false, errMsg = ex.Message };
|
|
|
|
|
|
}
|
|
|
|
|
|
//ApiBase.cookies = response.Cookies;
|
|
|
|
|
|
//var ret = response.DynamicBody;
|
|
|
|
|
|
if (ret.result)
|
|
|
|
|
|
{
|
|
|
|
|
|
var user = JObject.FromObject(ret.data).ToObject<UserResultModel>();
|
|
|
|
|
|
user.cookie = cookies[0].Value;
|
|
|
|
|
|
return new JsonResult<object>() { result = true, data = user };
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
return new JsonResult<object>() { result = false, data = ret.data, errMsg = ret.errMsg };
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-03-22 16:05:40 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取个人中心的统计信息
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
2021-04-30 21:09:21 +08:00
|
|
|
|
public async Task<JsonResult<SummaryResultModel>> GetSummary()
|
2021-03-22 16:05:40 +08:00
|
|
|
|
{
|
2021-04-30 21:09:21 +08:00
|
|
|
|
var result = await GetAsync<JsonResult<SummaryResultModel>>("User/GetSummary");
|
2021-03-22 16:05:40 +08:00
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-05-08 11:09:03 +08:00
|
|
|
|
public async Task<DateTime> GetNow()
|
2021-03-22 16:05:40 +08:00
|
|
|
|
{
|
2021-05-08 11:09:03 +08:00
|
|
|
|
var result = await GetAsync("NoAuth/GetNow");
|
2021-06-18 18:26:25 +08:00
|
|
|
|
return DateTime.Parse(System.Text.Encoding.UTF8.GetString(result)).ToLocalTime();//将服务器UTC时间转换成当地时区的时间
|
2021-03-22 16:05:40 +08:00
|
|
|
|
}
|
2021-05-08 11:09:03 +08:00
|
|
|
|
|
2021-04-21 16:16:14 +08:00
|
|
|
|
public async Task<JsonResult<object>> Register(string Phone, string Pwd, string Captcha)
|
2021-04-06 15:30:36 +08:00
|
|
|
|
{
|
|
|
|
|
|
var param = new
|
|
|
|
|
|
{
|
|
|
|
|
|
Phone,
|
|
|
|
|
|
Pwd,
|
|
|
|
|
|
Captcha
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2021-04-21 16:16:14 +08:00
|
|
|
|
JsonResult<object> ret = null;
|
2021-04-06 15:30:36 +08:00
|
|
|
|
try
|
|
|
|
|
|
{
|
2021-04-21 16:16:14 +08:00
|
|
|
|
ret = await PostAsync<JsonResult<object>>("NoAuth/v1/Register", param);
|
|
|
|
|
|
if (ret.result)
|
|
|
|
|
|
{
|
|
|
|
|
|
var u = JObject.FromObject(ret.data).ToObject<UserResultModel>();
|
|
|
|
|
|
u.cookie = cookies[0].Value;
|
|
|
|
|
|
return new JsonResult<object> { result = true, data = u,errMsg = ret.errMsg};
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
return new JsonResult<object> { result = false,data = ret.data, errMsg = ret.errMsg };
|
|
|
|
|
|
}
|
2021-04-06 15:30:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
2021-04-21 16:16:14 +08:00
|
|
|
|
return new JsonResult<object> { result = false, errMsg = ex.Message };
|
2021-04-06 15:30:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-04-21 16:16:14 +08:00
|
|
|
|
public async Task<string> GetHeadImg(string phone)
|
|
|
|
|
|
{
|
|
|
|
|
|
return await GetStringAsync($"noauth/getheadimg?phone={phone}");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-04-09 15:57:50 +08:00
|
|
|
|
public async Task<JsonResult<JObject>> GetCaptcha(string phone)
|
2021-04-06 15:30:36 +08:00
|
|
|
|
{
|
2021-04-09 15:57:50 +08:00
|
|
|
|
return await PostAsync<JsonResult<JObject>>("NoAuth/v1/GetCaptcha",new {phone });
|
2021-04-06 15:30:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
public async Task<JsonResult<object>> UpdateUserInfo(UserResultModel user)
|
|
|
|
|
|
{
|
|
|
|
|
|
return await PostAsync<JsonResult<object>>("User/UpdateUserSetting", user);
|
|
|
|
|
|
}
|
|
|
|
|
|
public JsonResult<JObject> GetUserInfo()
|
|
|
|
|
|
{
|
|
|
|
|
|
return Get<JsonResult<JObject>>("User/GetCurrentUser");
|
|
|
|
|
|
}
|
2021-04-09 15:57:50 +08:00
|
|
|
|
public async Task<JsonResult<UserResultModel>> QuickLogin()
|
|
|
|
|
|
{
|
2021-04-16 17:49:11 +08:00
|
|
|
|
var r = await PostAsync<JsonResult<UserResultModel>>("NoAuth/QuickLogin", null);
|
2021-04-28 15:21:06 +08:00
|
|
|
|
if (r.result)
|
|
|
|
|
|
{
|
|
|
|
|
|
r.data.cookie = cookies[0].Value;
|
|
|
|
|
|
}
|
2021-04-16 17:49:11 +08:00
|
|
|
|
return r;
|
2021-04-09 15:57:50 +08:00
|
|
|
|
}
|
2021-06-07 13:51:13 +08:00
|
|
|
|
public async Task<JsonResult<object>> OnWebWxLoginCheckUnionIdByCode(string code,string state)
|
|
|
|
|
|
{
|
|
|
|
|
|
var r = await GetAsync<JsonResult<object>>($"NoAuth/v1/OnWebWxLogin?code={code}&state={state}");
|
2021-12-21 13:37:34 +08:00
|
|
|
|
return GetDataAfterSetCookie(r);
|
2021-06-07 13:51:13 +08:00
|
|
|
|
}
|
2021-04-06 15:30:36 +08:00
|
|
|
|
public async Task<JsonResult<object>> OnWebWxLoginCheckUnionId(string unionId, string openId)
|
|
|
|
|
|
{
|
2021-04-15 15:58:37 +08:00
|
|
|
|
var r = await PostAsync<JsonResult<object>>("NoAuth/OnWebWxLoginCheckUnionId", new { unionId, openId });
|
2021-12-21 13:37:34 +08:00
|
|
|
|
return GetDataAfterSetCookie(r);
|
2021-04-06 15:30:36 +08:00
|
|
|
|
}
|
2021-06-07 13:51:13 +08:00
|
|
|
|
public async Task<JsonResult<object>> OnWebWxLogin(string Phone, string Captcha,
|
|
|
|
|
|
string Password, string UnionId, string WxWebOpenId)
|
2021-04-06 15:30:36 +08:00
|
|
|
|
{
|
2021-06-07 13:51:13 +08:00
|
|
|
|
var r = await PostAsync<JsonResult<object>>("NoAuth/v1/OnWebWxLogin",
|
|
|
|
|
|
new { Phone, Captcha, UnionId, openId = WxWebOpenId, Pwd = Password });
|
2021-04-21 16:16:14 +08:00
|
|
|
|
if (r.result)
|
|
|
|
|
|
{
|
|
|
|
|
|
var u = JObject.FromObject(r.data);
|
|
|
|
|
|
u.Add("cookie", cookies[0].Value);
|
|
|
|
|
|
return new JsonResult<object> { result = true, data = u, errMsg = r.errMsg };
|
|
|
|
|
|
}
|
|
|
|
|
|
else return r;
|
2021-04-06 15:30:36 +08:00
|
|
|
|
}
|
2021-04-21 16:16:14 +08:00
|
|
|
|
public async Task<JsonResult<object>> AddFeedBack(string content, List<string> files)
|
|
|
|
|
|
{
|
|
|
|
|
|
var res = Upload("feedback/add", new { content } , files);
|
|
|
|
|
|
return Newtonsoft.Json.JsonConvert.DeserializeObject<JsonResult<object>>(res);
|
|
|
|
|
|
}
|
2021-07-28 14:59:21 +08:00
|
|
|
|
public async Task<JsonResult<AppDownloadModel>> GetAppVersion()
|
|
|
|
|
|
{
|
|
|
|
|
|
return await GetAsync<JsonResult<AppDownloadModel>>("home/getversions");
|
|
|
|
|
|
}
|
2021-07-30 14:01:10 +08:00
|
|
|
|
public JsonResult<object> Update(UserResultModel currUser, out string cookie, string filePath = "")
|
2021-04-09 09:44:06 +08:00
|
|
|
|
{
|
2021-07-30 20:44:45 +08:00
|
|
|
|
cookie = App.CurrentUser.cookie;
|
2021-04-09 09:44:06 +08:00
|
|
|
|
//return await PostAsync<JsonResult<dynamic>>("User/UpdateUserSetting", new {
|
|
|
|
|
|
// UID = currUser.Id,
|
|
|
|
|
|
// Sex = currUser.Sex,
|
|
|
|
|
|
// currUser.Unit,
|
|
|
|
|
|
// currUser.Weight,
|
|
|
|
|
|
// currUser.FTP,
|
|
|
|
|
|
// currUser.WheelDiameter,
|
|
|
|
|
|
// currUser.Nickname,
|
|
|
|
|
|
// currUser.Country,
|
|
|
|
|
|
// currUser.Province,
|
|
|
|
|
|
// currUser.City,
|
|
|
|
|
|
// currUser.Area,
|
|
|
|
|
|
// currUser.AutoPause,
|
|
|
|
|
|
// currUser.MaxHeartRate,
|
|
|
|
|
|
// currUser.BicycleWeight,
|
|
|
|
|
|
// currUser.Contact,
|
|
|
|
|
|
// currUser.ContactPhone,
|
|
|
|
|
|
// currUser.ContactAddress,
|
|
|
|
|
|
// currUser.Sensitivity,
|
|
|
|
|
|
// imgData = imgData
|
|
|
|
|
|
//});
|
|
|
|
|
|
var files = new List<string>();
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(filePath))
|
|
|
|
|
|
{
|
|
|
|
|
|
files.Add(filePath);
|
|
|
|
|
|
}
|
|
|
|
|
|
var res = Upload("v1/User/UpdateUserSetting", new
|
|
|
|
|
|
{
|
|
|
|
|
|
UID = currUser.Id,
|
|
|
|
|
|
Sex = currUser.Sex,
|
|
|
|
|
|
currUser.Unit,
|
2021-04-16 17:49:11 +08:00
|
|
|
|
currUser.Height,
|
2021-04-09 09:44:06 +08:00
|
|
|
|
currUser.Weight,
|
|
|
|
|
|
currUser.FTP,
|
|
|
|
|
|
currUser.WheelDiameter,
|
|
|
|
|
|
currUser.Nickname,
|
|
|
|
|
|
currUser.Country,
|
|
|
|
|
|
currUser.Province,
|
|
|
|
|
|
currUser.City,
|
|
|
|
|
|
currUser.Area,
|
|
|
|
|
|
currUser.AutoPause,
|
|
|
|
|
|
currUser.MaxHeartRate,
|
|
|
|
|
|
currUser.BicycleWeight,
|
|
|
|
|
|
currUser.Contact,
|
|
|
|
|
|
currUser.ContactPhone,
|
|
|
|
|
|
currUser.ContactAddress,
|
|
|
|
|
|
currUser.Sensitivity,
|
|
|
|
|
|
currUser.Birthday
|
|
|
|
|
|
//imgData = imgData
|
|
|
|
|
|
}, files);
|
2021-07-30 14:01:10 +08:00
|
|
|
|
Debug.Log(cookie);
|
2021-04-23 15:36:18 +08:00
|
|
|
|
return Newtonsoft.Json.JsonConvert.DeserializeObject<JsonResult<object>>(res);
|
2021-04-16 17:49:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
public async Task<JsonResult<JObject>> GetNotify()
|
|
|
|
|
|
{
|
|
|
|
|
|
return await GetAsync<JsonResult<JObject>>("/Home/GetNotify");
|
2021-04-09 09:44:06 +08:00
|
|
|
|
}
|
2021-10-12 20:07:13 +08:00
|
|
|
|
public async Task<JsonResult<JObject>> GetVersions()
|
|
|
|
|
|
{
|
|
|
|
|
|
return await GetAsync<JsonResult<JObject>>("/home/getversions");
|
|
|
|
|
|
}
|
2021-04-26 16:25:52 +08:00
|
|
|
|
public async Task<JsonResult<JObject>> ResetPassword(string phone, string captcha, string newPwd)
|
|
|
|
|
|
{
|
|
|
|
|
|
return await PostAsync<JsonResult<JObject>>("NoAuth/v1/ResetPassword", new {phone,captcha,newPwd });
|
|
|
|
|
|
}
|
2021-12-17 18:28:02 +08:00
|
|
|
|
|
2021-12-21 13:37:34 +08:00
|
|
|
|
public async Task<JsonResult<object>> OnAppleIdLoginCheck(string userId,string token)
|
2021-12-17 18:28:02 +08:00
|
|
|
|
{
|
2021-12-21 13:37:34 +08:00
|
|
|
|
var r = await PostAsync<JsonResult<object>>("NoAuth/v1/OnAppleIdLoginCheck", new { appleUserId = userId, token });
|
|
|
|
|
|
return GetDataAfterSetCookie(r);
|
2021-12-17 18:28:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public async Task<JsonResult<object>> OnAppleIdLogin(string appleUserId, string token, string phone, string pwd, string Captcha)
|
|
|
|
|
|
{
|
2021-12-21 13:37:34 +08:00
|
|
|
|
var r = await PostAsync<JsonResult<object>>("NoAuth/v1/OnAppleIdLogin", new { appleUserId, token, phone, pwd, Captcha });
|
|
|
|
|
|
return GetDataAfterSetCookie(r);
|
|
|
|
|
|
}
|
2021-12-24 13:58:14 +08:00
|
|
|
|
|
2022-01-27 14:11:28 +08:00
|
|
|
|
public async Task<JsonResult<object>> OnAppleQuickLogin(string userId, string token)
|
|
|
|
|
|
{
|
|
|
|
|
|
var r = await PostAsync<JsonResult<object>>("NoAuth/v1/OnAppleQuickLogin", new { appleUserId = userId, token });
|
|
|
|
|
|
return GetDataAfterSetCookie(r);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-12-24 13:58:14 +08:00
|
|
|
|
public async Task<JsonResult<object>> OnFacebookLoginCheck(string userId, string token)
|
|
|
|
|
|
{
|
|
|
|
|
|
var r = await PostAsync<JsonResult<object>>("NoAuth/v1/OnFacebookLoginCheck", new { faceBookUserId = userId, token });
|
|
|
|
|
|
return GetDataAfterSetCookie(r);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public async Task<JsonResult<object>> OnFacebookLogin(string faceBookUserId, string token, string phone, string pwd, string Captcha)
|
|
|
|
|
|
{
|
|
|
|
|
|
var r = await PostAsync<JsonResult<object>>("NoAuth/v1/OnFacebookLogin", new { faceBookUserId, token, phone, pwd, Captcha });
|
|
|
|
|
|
return GetDataAfterSetCookie(r);
|
|
|
|
|
|
}
|
2022-01-18 13:24:19 +08:00
|
|
|
|
|
|
|
|
|
|
public async Task<JsonResult<object>> OnGoogleIdLoginCheck(string googleUserId, string token)
|
|
|
|
|
|
{
|
|
|
|
|
|
var r = await PostAsync<JsonResult<object>>("NoAuth/v1/OnGoogleIdLoginCheck", new { googleUserId, token });
|
|
|
|
|
|
return GetDataAfterSetCookie(r);
|
|
|
|
|
|
}
|
|
|
|
|
|
public async Task<JsonResult<object>> OnGoogleIdLogin(string googleUserId, string token, string phone, string pwd, string Captcha)
|
|
|
|
|
|
{
|
|
|
|
|
|
var r = await PostAsync<JsonResult<object>>("NoAuth/v1/OnGoogleIdLogin", new { googleUserId, token, phone, pwd, Captcha });
|
|
|
|
|
|
return GetDataAfterSetCookie(r);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-12-21 13:37:34 +08:00
|
|
|
|
private JsonResult<object> GetDataAfterSetCookie(JsonResult<object> r)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (r.result)
|
|
|
|
|
|
{
|
|
|
|
|
|
var data = JObject.FromObject(r.data);
|
|
|
|
|
|
if (data.Value<string>("success") != null && data.Value<string>("success") == "False")
|
|
|
|
|
|
{
|
|
|
|
|
|
return r;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
var user = data.ToObject<UserResultModel>();
|
|
|
|
|
|
user.cookie = cookies[0].Value;
|
|
|
|
|
|
r.data = user;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return r;
|
2021-12-17 18:28:02 +08:00
|
|
|
|
}
|
2022-04-15 18:14:55 +08:00
|
|
|
|
//获取某是
|
|
|
|
|
|
public Task<JsonResult<List<EquitmentModel>>> GetEquitmentList(int? type =null)
|
|
|
|
|
|
{
|
|
|
|
|
|
var url = $"UserEquipment/GetList?type={ type }";
|
|
|
|
|
|
return GetAsync<JsonResult<List<EquitmentModel>>>(url);
|
|
|
|
|
|
}
|
2021-03-22 16:05:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|