public Task InvokeAsync(HttpContext context) { //可选参数始终不为null string findPath = _filterApis.FirstOrDefault(x => x == context.Request.Path); if (!string.IsNullOrEmpty(findPath)) { return(_next(context)); } var token = context.Request.Headers["Token"]; if (string.IsNullOrEmpty(token)) { return(context.Response.WriteAsync(JsonConvert.SerializeObject( new MiddleResponse(ResponseStatus.TokenError, null)))); ; } var status = TokenTool.ParseToken(token, out var id); if (status != ResponseStatus.Success) { return(context.Response.WriteAsync(JsonConvert.SerializeObject( new MiddleResponse(status, null)))); } context.Request.Headers["id"] = id.ToString(); return(_next(context)); }
public Package <string> Login(string account, string password, string appName) { try { //验证是否有权访问 if (!authHeader.ValideUser(authHeader.UserName, authHeader.PassWord)) { return(new Package <string>(false, "没有访问权限!", null)); } //手机登录&&会员名登录(只有Iport用户名首次登陆才会在sph用户表插入用户信息) if (TokenTool.VerifyMobile(account) == "ture") { return(GetInfoByMobileLogin(account, password)); }//手机号登陆 else { return(GetInfoByUserNameLogin(account, password)); } } catch (Exception ex) { return(new Package <string>(false, string.Format("{0}:获取数据发生异常。{1}", ex.Source, ex.Message), null)); } }
protected void Page_Load(object sender, EventArgs e) { var account = Request.Params["Account"]; var password = Request.Params["Password"]; Dictionary <string, string> info = new Dictionary <string, string>(); try { if (account == null || password == null) { info.Add("参数Account,Password不能为空!举例", "http://218.92.115.55/M_Sph/Login.aspx?Account=18000000000&Password=123456"); Json = JsonConvert.SerializeObject(info); return; } //手机登录&&会员名登录(只有Iport用户名首次登陆才会在sph用户表插入用户信息) if (TokenTool.VerifyMobile(account) == "ture") { Json = GetInfoByMobileLogin(account, password); }//手机号登陆 else { Json = GetInfoByUserNameLogin(account, password); } } catch (Exception ex) { info.Add("IsLogin", "No"); info.Add("Message", string.Format("{0}:获取数据发生异常。{1}", ex.Source, ex.Message)); Json = JsonConvert.SerializeObject(info); } }
/// <summary> /// 校验手机号 /// </summary> /// <param name="strMobile"></param> /// <returns></returns> private string VerifyMobile(string strMobile) { string strJson = string.Empty; //判断是否已注册 string sql = string.Format("select * from TB_SYS_USERINFO where mobile='{0}'", strMobile); var dt = new Leo.Oracle.DataAccess(RegistryKey.KeyPathIport).ExecuteTable(sql); if (dt.Rows.Count != 0) { strJson = JsonConvert.SerializeObject(new DicPackage(false, null, "手机号已注册!").DicInfo()); log.LogCatalogFailure("手机号已注册!"); return(strJson); } //手机号验证 string strMessage = TokenTool.VerifyMobile(strMobile); if (strMessage != "ture") { strJson = JsonConvert.SerializeObject(new DicPackage(false, null, strMessage).DicInfo()); log.LogCatalogFailure(strMessage); return(strJson); } return(strJson); }
public KeyValuePair <bool, long> TokenValidation(string token) { var status = TokenTool.ParseToken(token, out var id); if (status != ResponseStatus.Success) { return(new KeyValuePair <bool, long>(false, id)); } return(new KeyValuePair <bool, long>(true, id)); }
protected void Page_Load(object sender, EventArgs e) { //身份校验 if (!InterfaceTool.IdentityVerifyForSys(Request)) { Json = JsonConvert.SerializeObject(new DicPackage(false, null, "身份认证错误!").DicInfo()); return; } //账号(手机号或Iport账号) string strAccount = Request.Form["Account"]; //密码 string strPassword = Request.Form["Password"]; ////账号(手机号或Iport账号) //string strAccount = Request.Params["Account"]; ////密码 //string strPassword = Request.Params["Password"]; SysLog log = new SysLog(Request); log.strAccount = strAccount; log.strBehavior = "用户登陆"; log.strBehaviorURL = "/Entrance/Sys/Login.aspx"; try { if (strAccount == null || strPassword == null) { Json = JsonConvert.SerializeObject(new DicPackage(false, null, "参数错误,登陆失败!").DicInfo()); return; } ILogin2 iLogin = new ILogin2(log); //手机号登录&&Iport账号登录 if (TokenTool.VerifyMobile(strAccount) == "ture") { Json = iLogin.GetInfoByMobileLogin(strAccount, strPassword); }//手机号登陆 else { Json = iLogin.GetInfoByUserNameLogin(strAccount, strPassword); }//Iport账号登录 } catch (Exception ex) { Json = JsonConvert.SerializeObject(new DicPackage(false, null, string.Format("{0}:用户登陆数据发生异常。{1}", ex.Source, ex.Message)).DicInfo()); log.LogCatalogFailure(string.Format("{0}:用户登陆数据发生异常。{1}", ex.Source, ex.Message)); } }
public async Task <IActionResult> Index([FromServices] KyubeyContext db, [FromServices] ITokenRepository _tokenRepository) { var tokenInfoList = _tokenRepository.GetAll().ToList(); var dbIncubations = await db.Tokens.Where(x => x.HasIncubation && x.Status == TokenStatus.Active).ToListAsync(); var tokens = dbIncubations.OrderByDescending(x => x.Priority).Select(x => new TokenHandlerListViewModel() { Id = x.Id, BannerSrc = TokenTool.GetTokenIncubatorBannerUri(x.Id, _tokenRepository.GetTokenIncubationBannerPaths(x.Id, currentCulture).FirstOrDefault()), CurrentRaised = Convert.ToDecimal(db.RaiseLogs.Where(y => y.TokenId == x.Id && y.Account.Length == 12).Select(y => y.Amount).Sum()), Introduction = _tokenRepository.GetTokenIncubationDescription(x.Id, currentCulture), ShowGoExchange = true, TargetCredits = tokenInfoList.FirstOrDefault(s => s.Id == x.Id)?.Incubation?.Goal ?? 0 }).ToList(); return(View(tokens)); }
protected void Page_Load(object sender, EventArgs e) { //身份校验 if (!InterfaceTool.IdentityVerify(Request)) { Json = JsonConvert.SerializeObject(new DicPackage(false, null, "身份认证错误!").DicInfo()); return; } //账号(手机号或Iport账号) string strAccount = Request.Form["Account"]; //密码 string strPassword = Request.Form["Password"]; ////账号(手机号或Iport账号) //string strAccount = Request.Params["Account"]; ////密码 //string strPassword = Request.Params["Password"]; try { if (strAccount == null || strPassword == null) { Json = JsonConvert.SerializeObject(new DicPackage(false, null, "参数错误,登陆失败!").DicInfo()); return; } //手机号登录&&Iport账号登录 if (TokenTool.VerifyMobile(strAccount) == "ture") { Json = GetInfoByMobileLogin(strAccount, strPassword); }//手机号登陆 else { Json = GetInfoByUserNameLogin(strAccount, strPassword); }//Iport账号登录 } catch (Exception ex) { Json = JsonConvert.SerializeObject(new DicPackage(false, null, string.Format("{0}:用户登陆数据发生异常。{1}", ex.Source, ex.Message)).DicInfo()); } }
public async Task <IActionResult> Index([FromServices] KyubeyContext db, [FromServices] ITokenRepository _tokenRepository) { var tokenInfoList = _tokenRepository.GetAll().Where(x => x?.Incubation != null).ToList(); var dbIncubations = await db.Tokens.Where(x => x.HasIncubation && tokenInfoList.FirstOrDefault(t => x.Id == t.Id).Incubation != null && x.Status == TokenStatus.Active).ToListAsync(); tokenInfoList.ForEach(x => x.Incubation.Begin_Time = x.Incubation.Begin_Time ?? DateTimeOffset.MinValue); var tokens = dbIncubations.OrderByDescending(x => x.Priority).Select(x => new TokenHandlerListViewModel() { Id = x.Id, BannerSrc = TokenTool.GetTokenIncubatorBannerUri(x.Id, _tokenRepository.GetTokenIncubationBannerPaths(x.Id, currentCulture).FirstOrDefault()), CurrentRaised = Convert.ToDecimal(db.RaiseLogs.Where(y => (y.Timestamp > tokenInfoList.FirstOrDefault(t => t.Id == y.TokenId).Incubation.Begin_Time && y.Timestamp < tokenInfoList.FirstOrDefault(t => t.Id == y.TokenId).Incubation.DeadLine) && y.TokenId == x.Id && !y.Account.StartsWith("eosio.")).Select(y => y.Amount).Sum()), Introduction = _tokenRepository.GetTokenIncubationDescription(x.Id, currentCulture), ShowGoExchange = true, TargetCredits = tokenInfoList.FirstOrDefault(s => s.Id == x.Id)?.Incubation?.Goal ?? 0 }).ToList(); return(View(tokens)); }
public async Task <IActionResult> Index([FromServices] KyubeyContext db, [FromServices] ITokenRepository _tokenRepository) { var tokenInfoList = _tokenRepository.GetAll().Where(x => x?.Incubation != null).ToList(); var dbIncubations = await db.Tokens.Where(x => x.HasIncubation && tokenInfoList.FirstOrDefault(t => x.Id == t.Id).Incubation != null && x.Status == TokenStatus.Active).ToListAsync(); tokenInfoList.ForEach(x => x.Incubation.Begin_Time = x.Incubation.Begin_Time ?? DateTime.MinValue); var tokens = dbIncubations.OrderByDescending(x => x.Priority).Select(x => new TokenHandlerListViewModel() { Id = x.Id, BannerSrc = TokenTool.GetTokenIncubatorBannerUri(x.Id, _tokenRepository.GetTokenIncubationBannerPaths(x.Id, currentCulture).FirstOrDefault()), CurrentRaised = x.Raised, Introduction = _tokenRepository.GetTokenIncubationDescription(x.Id, currentCulture), ShowGoExchange = true, TargetCredits = tokenInfoList.FirstOrDefault(s => s.Id == x.Id)?.Incubation?.Goal ?? 0, BeginTime = tokenInfoList.FirstOrDefault(s => s.Id == x.Id)?.Incubation?.Begin_Time }).ToList(); return(View(tokens)); }
protected void Page_Load(object sender, EventArgs e) { //用户编码 var codeUser = Request.Params["CodeUser"]; //真实姓名 var userName = Request.Params["UserName"]; //身份证号 var identityCard = Request.Params["IdentityCard"]; //车牌号 var vehicleNum = Request.Params["VehicleNum"]; //车长 var vehicleLen = Request.Params["VehicleLen"]; //车型 var vehicleType = Request.Params["VehicleType"]; //载重吨 var tons = Request.Params["Tons"]; Dictionary <string, string> info = new Dictionary <string, string>(); try { if (codeUser == null || userName == null || identityCard == null || vehicleNum == null || vehicleLen == null || vehicleType == null || tons == null) { info.Add("参数CodeUser,UserName,IdentityCard,VehicleNum,VehicleLen,VehicleType,Tons不能为空!举例", "http://218.92.115.55/M_Sph/Auth/AuthForDriver.aspx?CodeUser=1DA60DDD8025725AE053A864016A725A&UserName=张三&IdentityCard=111111111111111111&VehicleNum=&VehicleLen=&VehicleType=&Tons="); Json = JsonConvert.SerializeObject(info); return; } //身份证验证 if (!TokenTool.CheckIDCard(identityCard)) { info.Add("IsAuth", "No"); info.Add("Message", "身份证号码错误!"); Json = JsonConvert.SerializeObject(info); return; } string sql = string.Format("select * from TB_SPH_USER_AUTH where code_user='******' and roletype='{1}'", codeUser, "1"); //验证此会员是否已认证 var dt = new Leo.Oracle.DataAccess(Leo.RegistryKey.KeyPathWlxgx).ExecuteTable(sql); if (dt.Rows.Count == 0) { //添加认证数据 sql = string.Format("insert into TB_SPH_USER_AUTH (code_user,username,identity_card,roletype,authstate,vehiclenum,vehiclelen,vehicletype,tons) values('{0}','{1}','{2}','{3}','{4}','{5}',{6},'{7}',{8})", codeUser, userName, identityCard, "1", "0", vehicleNum, Convert.ToDecimal(vehicleLen), vehicleType, Convert.ToDecimal(tons)); } else { //更新认证数据 sql = string.Format("update TB_SPH_USER_AUTH set username='******',identity_card='{1}',authstate='{2}',operatetime=to_date('{3}','YYYY-MM-DD HH24:MI:SS'),vehiclenum='{4}',vehiclelen={5},vehicletype='{6}',tons={7} where code_user='******' and roletype='{9}'", userName, identityCard, "0", DateTime.Now, vehicleNum, Convert.ToDecimal(vehicleLen), vehicleType, Convert.ToDecimal(tons), codeUser, "1"); } dt = new Leo.Oracle.DataAccess(RegistryKey.KeyPathWlxgx).ExecuteTable(sql); //检查数据是否插入成功 sql = string.Format("select * from TB_SPH_USER_AUTH where code_user='******' and roletype='{1}'", codeUser, "1"); dt = new Leo.Oracle.DataAccess(Leo.RegistryKey.KeyPathWlxgx).ExecuteTable(sql); if (dt.Rows.Count == 0) { info.Add("IsAuth", "No"); info.Add("Message", "网络错误,请稍后再试!"); Json = JsonConvert.SerializeObject(info); return; } ////添加初始账户资金信息(在首次认证时添加会员初始化账户资金信息) //sql = // string.Format("select * from TB_YGPH_FUND where account='{0}' and roletype='{1}'", account, "1"); ////验证此会员是否已初始化账户信息 //dt = new Leo.Oracle.DataAccess(Leo.RegistryKey.KeyPathHmw).ExecuteTable(sql); //if (dt.Rows.Count == 0) //{ // sql = // string.Format("insert into TB_YGPH_FUND (account,roletype,income,balance,content,dealtime) values('{0}','{1}','{2}','{3}','{4}',to_date('{5}','YYYY-MM-DD HH24:MI:SS'))", account, "1", "0", "0", "开户", DateTime.Now); // dt = new Leo.Oracle.DataAccess(Leo.RegistryKey.KeyPathHmw).ExecuteTable(sql); //} //sql = // string.Format("select * from TB_YGPH_FUND where account='{0}' and roletype='{1}'", account, "1"); //dt = new Leo.Oracle.DataAccess(Leo.RegistryKey.KeyPathHmw).ExecuteTable(sql); //if (dt.Rows.Count == 0) //{ // info.Add("IsAuth", "No"); // info.Add("Message", "网络错误,请稍后再试!"); // Json = JsonConvert.SerializeObject(info); // return; //} info.Add("IsAuth", "Yes"); info.Add("Message", "审核中,请耐心等待!"); Json = JsonConvert.SerializeObject(info); } catch (Exception ex) { info.Add("IsAuth", "No"); info.Add("Message", string.Format("{0}:获取数据发生异常。{1}", ex.Source, ex.Message)); Json = JsonConvert.SerializeObject(info); } }
protected void Page_Load(object sender, EventArgs e) { //手机号码 var mobile = Request.Params["Mobile"]; Dictionary <string, string> info = new Dictionary <string, string>(); try { if (mobile == null) { info.Add("IsAuth", "No"); info.Add("参数Mobile不能为null!", "举例:http://218.92.115.55/M_Sph/Auth/IdentityAuthForDriver.aspx?Mobile=18000000000"); Json = JsonConvert.SerializeObject(info); return; } //手机号码验证 string message = TokenTool.VerifyMobile(mobile); if (message != "ture") { info.Add("IsAuth", "No"); info.Add("Message", message); Json = JsonConvert.SerializeObject(info); return; } string sql = string.Format(@"select b.username,b.identity_card,b.vehiclenum,b.vehiclelen,b.vehicletype,b.tons,b.auditmark_identity,b.auditmark_driving,b.auditmark_vehicle,a.code_user from IPORT.TB_SYS_USERINFO a, TB_SPH_USER_AUTH b where a.code_user=b.code_user and b.roletype='1' and a.mobile='{0}' " , mobile); //验证此会员是否已认证 var dt = new Leo.Oracle.DataAccess(Leo.RegistryKey.KeyPathWlxgx).ExecuteTable(sql); if (dt.Rows.Count == 0) { info.Add("IsInfo", "No"); info.Add("Message", "用户未认证!"); Json = JsonConvert.SerializeObject(info); return; } info.Add("IsAuth", "Yes"); info.Add("UserName", dt.Rows[0]["username"].ToString()); info.Add("IdentityCard", TokenTool.HideIDCard(dt.Rows[0]["identity_card"].ToString())); info.Add("VehicleNum", dt.Rows[0]["vehiclenum"].ToString()); info.Add("VehicleLen", dt.Rows[0]["vehiclelen"].ToString()); info.Add("VehicleType", dt.Rows[0]["vehicletype"].ToString()); info.Add("Tons", dt.Rows[0]["tons"].ToString()); info.Add("AuditMarkIdentity", dt.Rows[0]["auditmark_identity"].ToString()); info.Add("AuditMarkDriving", dt.Rows[0]["auditmark_driving"].ToString()); info.Add("AuditMarkVehicle", dt.Rows[0]["auditmark_vehicle"].ToString()); info.Add("CodeUser", dt.Rows[0]["code_user"].ToString()); Json = JsonConvert.SerializeObject(info); } catch (Exception ex) { info.Add("IsInfo", "No"); info.Add("Message", string.Format("{0}:获取数据发生异常。{1}", ex.Source, ex.Message)); Json = JsonConvert.SerializeObject(info); } }
public String PushByCodeUser(string token, string ReceiverId, string SenderId, string appName, string Message) { try { if (!TokenTool.VerifyToken(token)) { return(new Leo.Xml.Message("Token未通过校验。").FalseXml()); } //mobile = "18026600293"; SenderId = (SenderId == "" ? "0" : SenderId); string sql = string.Format("select * from tb_app_device where code_user='******' and appname='{1}'", ReceiverId, appName); var dt = new Leo.Oracle.DataAccess(Leo.RegistryKey.KeyPathMa).ExecuteTable(sql); if (dt.Rows.Count == 0) { return(new Leo.Xml.Message("无此用户设备信息!").FalseXml()); } var devicetoken = dt.Rows[0]["devicetoken"].ToString(); var devicetype = dt.Rows[0]["devicetype"].ToString(); switch (devicetype) { case "iOS": { //IOS测试devicetoken 7a6f8056710252ff8561ed1611b1b82bc398eab45b8882c12fdb143a7fb15e46 string URL = "http://168.100.1.218/test.php"; System.Collections.Specialized.NameValueCollection PostVars = new System.Collections.Specialized.NameValueCollection(); //参数类 Message = HttpUtility.UrlEncode(Message); //中文UTF8编码转化 PostVars.Add("devicetoken", devicetoken); //参数USERid PostVars.Add("message", Message); //参数msg System.Net.WebClient wb = new System.Net.WebClient(); byte[] byRemoteInfo = wb.UploadValues(URL, "POST", PostVars); //HTTP地址,POST请求,参数类 string sRemoteInfo = System.Text.Encoding.Default.GetString(byRemoteInfo); //获取返回值 if (sRemoteInfo == "Connected to APNS\r\nMessage successfully delivered\r\n") { break; } else { return(new Leo.Xml.Message("推送失败!").FalseXml()); } } case "Android": { // 推送服务器地址 const String url = "http://127.0.0.1:8080/androidpn/notification.do?action=send"; // androidpn推送工具 AndroidPn androidPush = new AndroidPn(url); // 单用户推送 androidPush.PushToSingle(devicetoken, null, Message); break; } default: return(new Leo.Xml.Message("暂不支持iOS,Android以外设备推送!").FalseXml()); } //插入推送数据库 //sql = string.Format("insert into tb_hmw_messagepush (userid,message) values ('{0}','{1}')", UserId, Message); //new Leo.Oracle.DataAccess(Leo.RegistryKey.KeyPathMa).ExecuteTable(sql); return(new Leo.Xml.Message("推送成功!").TrueXml()); } catch (Exception ex) { LogTool.WriteLog(typeof(ServiceMobile), ex); return(new Leo.Xml.Message(string.Format("获取数据异常。{0}", ex.Message)).FalseXml()); } }
protected void Page_Load(object sender, EventArgs e) { var mobile = Request.Params["Mobile"]; var password1 = Request.Params["Password1"]; var password2 = Request.Params["Password2"]; Dictionary <string, string> info = new Dictionary <string, string>(); try { if (mobile == null || password1 == null || password2 == null) { info.Add("参数Mobile,Password1,Password2不能为空!举例", "http://218.92.115.55/M_Sph/Register.aspx?Mobile=18000000000&Password1=123456&Password2=123456"); Json = JsonConvert.SerializeObject(info); return; } //判断是否已注册 string sql = string.Format("select * from TB_SPH_USER where account='{0}'", mobile); var dt = new Leo.Oracle.DataAccess(RegistryKey.KeyPathMa).ExecuteTable(sql); if (dt.Rows.Count != 0) { info.Add("IsReg", "No"); info.Add("Message", "手机号已注册!"); Json = JsonConvert.SerializeObject(info); return; } //手机号码验证 string message = TokenTool.VerifyMobile(mobile); if (message != "ture") { info.Add("IsReg", "No"); info.Add("Message", message); Json = JsonConvert.SerializeObject(info); return; } //判断密码是的合理 if (password1 != password2) { info.Add("IsReg", "No"); info.Add("Message", "密码不一致"); Json = JsonConvert.SerializeObject(info); return; } //App使用截止时间 string timeType = "MONTH"; int timeInterval = 3; DateTime endTime; switch (timeType) { case "DAY": endTime = DateTime.Now.AddDays(timeInterval); break; case "MONTH": endTime = DateTime.Now.AddMonths(timeInterval); break; case "YEAR": endTime = DateTime.Now.AddYears(timeInterval); break; default: throw new Exception("错误的对象索引"); } //注册 sql = string.Format(@"insert into TB_SPH_USER (account, password, endtime) values ('{0}', '{1}', to_date('{2}','YYYY-MM-DD HH24:MI:SS'))" , mobile, password1, endTime); dt = new Leo.Oracle.DataAccess(RegistryKey.KeyPathWlxgx).ExecuteTable(sql); //检查是否已插入 sql = string.Format(@"select * from TB_SPH_USER where account='{0}' and password='******' and endtime=to_date('{2}','YYYY-MM-DD HH24:MI:SS')" , mobile, password1, endTime); dt = new Leo.Oracle.DataAccess(RegistryKey.KeyPathWlxgx).ExecuteTable(sql); if (dt.Rows.Count == 0) { info.Add("IsReg", "No"); info.Add("Message", "网络错误,请稍后再试!"); } else { if (Convert.ToString(dt.Rows[0]["account"]) != mobile || Convert.ToString(dt.Rows[0]["password"]) != password1 || Convert.ToString(dt.Rows[0]["endtime"]) != endTime.ToString()) { info.Add("IsReg", "No"); info.Add("Message", "网络错误,请稍后再试!"); } else { info.Add("IsReg", "Yes"); info.Add("Message", "注册成功!"); } } Json = JsonConvert.SerializeObject(info); } catch (Exception ex) { info.Add("IsReg", "No"); info.Add("Message", string.Format("{0}:提交数据发生异常。{1}", ex.Source, ex.Message)); Json = JsonConvert.SerializeObject(info); } }
protected void Page_Load(object sender, EventArgs e) { //用户编码 var codeUser = Request.Params["CodeUser"]; //真实姓名 var userName = Request.Params["UserName"]; //身份证号 var identityCard = Request.Params["IdentityCard"]; try { if (codeUser == null || userName == null || identityCard == null) { string warning = string.Format("参数CodeUser,UserName,IdentityCard不能为nul!举例:http://218.92.115.55/M_Sph/Auth/AuthForConsignor.aspx?CodeUser=1DA60DDD8025725AE053A864016A725A&UserName=张三&IdentityCard=111111111111111111"); Json = JsonConvert.SerializeObject(new DicPackage(warning).FalseDic()); return; } //身份证验证 if (!TokenTool.CheckIDCard(identityCard)) { Json = JsonConvert.SerializeObject(new DicPackage("身份证号码错误!").FalseDic()); return; } string strSql = string.Format("select authstate from TB_SPH_USER_AUTH where code_user='******' and roletype='{1}'", codeUser, 2); //验证此会员是否已认证 var dt = new Leo.Oracle.DataAccess(Leo.RegistryKey.KeyPathWlxgx).ExecuteTable(strSql); if (dt.Rows.Count <= 0) { //添加认证数据 strSql = string.Format("insert into TB_SPH_USER_AUTH (code_user,username,identity_card,roletype,authstate) values('{0}','{1}','{2}','{3}','{4}')", codeUser, userName, identityCard, "2", "0"); } else { //更新认证数据 strSql = string.Format("update TB_SPH_USER_AUTH set username='******',identity_card='{1}',authstate='{2}',operatetime=to_date('{3}','YYYY-MM-DD HH24:MI:SS') where code_user='******' and roletype={5}", userName, identityCard, "1", DateTime.Now, codeUser, 2); } dt = new Leo.Oracle.DataAccess(RegistryKey.KeyPathWlxgx).ExecuteTable(strSql); //检查数据是否插入/更新成功 strSql = string.Format("select * from TB_SPH_USER_AUTH where code_user='******' and roletype='{1}'", codeUser, "2"); dt = new Leo.Oracle.DataAccess(Leo.RegistryKey.KeyPathWlxgx).ExecuteTable(strSql); if (dt.Rows.Count <= 0) { Json = JsonConvert.SerializeObject(new DicPackage("认证失败,请稍后重试!").FalseDic()); } else { Json = JsonConvert.SerializeObject(new DicPackage("审核中,请耐心等待!").TrueDic()); } } catch (Exception ex) { Json = JsonConvert.SerializeObject(new DicPackage(string.Format("{0}:认证数据发生异常。{1}", ex.Source, ex.Message)).FalseDic()); } }
protected void Page_Load(object sender, EventArgs e) { //身份校验 if (!InterfaceTool.IdentityVerify(Request)) { Json = JsonConvert.SerializeObject(new DicPackage(false, null, "身份认证错误").DicInfo()); return; } //账户 string strAccount = Request.Params["Account"]; //反馈类型 string strFeedbackType = Request.Params["FeedbackType"]; //反馈对象编码 string strCodeFeedbackObject = Request.Params["CodeFeedbackObject"]; //公司名称编码 string strCodeCompany = Request.Params["CodeCompany"]; //反馈标题 string strFeedBackTitle = Request.Params["FeedBackTitle"]; //反馈说明 string strFeedBackExplain = Request.Params["FeedBackExplain"]; //电话号码 string strPhoneNum = Request.Params["PhoneNum"]; //匿名标志 string strAnonymous = Request.Params["Anonymous"]; AppLog log = new AppLog(Request); log.strBehavior = "提交投诉"; log.strBehaviorURL = "/Service/Complain/SubmitComplain.aspx"; log.strAccount = strAccount; try { if (strAccount == null || strFeedbackType == null || strCodeFeedbackObject == null || strCodeCompany == null || strFeedBackTitle == null || strFeedBackExplain == null || strPhoneNum == null || strAnonymous == null) { Json = JsonConvert.SerializeObject(new DicPackage(false, null, "参数错误,提交投诉失败").DicInfo()); return; } //手机号验证 if (!TokenTool.VerifyMobile(strPhoneNum) && !string.IsNullOrWhiteSpace(strPhoneNum)) { Json = JsonConvert.SerializeObject(new DicPackage(false, null, "手机号错误").DicInfo()); log.LogCatalogFailure("手机号错误"); return; } //部门 string strCodeDepartment = string.Empty; //车号 string strVehicle = string.Empty; //匿名,手机号和车号加密 if (strAnonymous.Equals("1")) { } //默认公司编码 //公路港——2 if (strCodeFeedbackObject.Equals("1")) { strCodeCompany = "2"; } //港区卡口——21 if (strCodeFeedbackObject.Equals("3")) { strCodeCompany = "21"; } //提交投诉 string strSql = string.Format(@"insert into SER_COMPLAIN (type_mark,code_complain_org,code_company_org,vehicle,driverphone,anonymous_mark,title,detail,account) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}')", strFeedbackType, strCodeFeedbackObject, strCodeCompany, strVehicle, strPhoneNum, strAnonymous, strFeedBackTitle, strFeedBackExplain, strAccount); new Leo.Oracle.DataAccess(RegistryKey.KeyPathCGate).ExecuteNonQuery(strSql); Json = JsonConvert.SerializeObject(new DicPackage(true, null, "提交成功").DicInfo()); log.LogCatalogSuccess(); } catch (Exception ex) { Json = JsonConvert.SerializeObject(new DicPackage(false, null, string.Format("{0}:提交投诉发生异常。{1}", ex.Source, ex.Message)).DicInfo()); log.LogCatalogFailure(string.Format("{0}:提交投诉发生异常。{1}", ex.Source, ex.Message)); } }
protected void Page_Load(object sender, EventArgs e) { //用户编码 var codeUser = Request.Params["CodeUser"]; //始发地省,市,区县 var SFDProvince = Request.Params["SFDProvince"]; var SFDCity = Request.Params["SFDCity"]; var SFDCounty = Request.Params["SFDCounty"]; //目的地区省,市,区县 var MDDProvince = Request.Params["MDDProvince"]; var MDDCity = Request.Params["MDDCity"]; var MDDCounty = Request.Params["MDDCounty"]; //货物类型 var goods = Request.Params["Goods"]; //重量 var weight = Request.Params["Weight"]; //体积(方) var volume = Request.Params["Volume"]; //车长 var vehicleLen = Request.Params["VehicleLen"]; //车型 var vehicleType = Request.Params["VehicleType"]; //手机 var mobile = Request.Params["Mobile"]; //电话 var phone = Request.Params["Phone"]; //联系人 var contact = Request.Params["Contact"]; //距离 var distance = Request.Params["Distance"]; Dictionary <string, string> info = new Dictionary <string, string>(); try { if (codeUser == null || SFDProvince == null || SFDCity == null || SFDCounty == null || MDDProvince == null || MDDCity == null || MDDCounty == null || goods == null || weight == null || volume == null || vehicleLen == null || vehicleType == null || mobile == null || phone == null || contact == null || distance == null) { info.Add("参数CodeUser,SFDProvince,SFDCity,SFDCounty,MDDProvince,MDDCity,MDDCounty,Goods,Weight,Volume,VehicleLen,VehicleType,Mobile,Phone,Contact,Distance不能为null!举例", "http://218.92.115.55/M_Sph/Goods/ReleaseGoods.aspx?CodeUser=1DA60DDD8025725AE053A864016A725A&SFDProvince=北京&SFDCity=&SFDCounty=&MDDProvince=江苏省&MDDCity=&MDDCounty=&Goods=煤炭&Weight=&Volume=&VehicleLen=&VehicleType=&Mobile=18000000000&Phone=&Contact=&Distance="); Json = JsonConvert.SerializeObject(info); return; } //判断账号、始发省、目的省、货物类型、手机是否为空 if (codeUser == "" || SFDProvince == "" || MDDProvince == "" || goods == "" || mobile == "") { info.Add("参数CodeUser,SFDProvince,MDDProvince,Goods,Mobile必须填数据!举例", "CodeUser=1DA60DDD8025725AE053A864016A725A&SFDProvince=北京&MDDProvince=江苏省&Goods=煤炭&Mobile=18000000000"); Json = JsonConvert.SerializeObject(info); return; } //手机号码验证 string message = TokenTool.VerifyMobile(mobile); if (message != "ture") { info.Add("IsRelease", "No"); info.Add("Message", message); Json = JsonConvert.SerializeObject(info); return; } //获取用户信息 string sql = string.Format(@"select a.usertype, a.code_company, a.iport_code_user, b.username, b.authstate from tb_sph_user a, tb_sph_user_auth b where a.code_user=b.code_user and a.code_user='******' and b.roletype='{1}'" , codeUser, "2"); var dt = new Leo.Oracle.DataAccess(Leo.RegistryKey.KeyPathWlxgx).ExecuteTable(sql); if (dt.Rows.Count == 0 || Convert.ToString(dt.Rows[0]["authstate"]) != "1") { info.Add("IsRelease", "No"); info.Add("Message", "用户未认证!"); Json = JsonConvert.SerializeObject(info); return; } //判断是否为Iport用户 if ((Convert.ToString(dt.Rows[0]["usertype"]) == "1") && (Convert.ToString(dt.Rows[0]["code_company"]) != "null")) { codeUser = Convert.ToString(dt.Rows[0]["iport_code_user"]); } //发布货源 sql = string.Format(@"insert into TB_DMT_CARGO (sfd_province,sfd_city,sfd_county,mdd_province,mdd_city,mdd_county,cargoname,weight,volume,vehicleLen,vehicleType,mobile,phone,diatance,code_user,code_client,opeartor,contact_man,style) values ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}', '{11}', '{12}', '{13}', '{14}', '{15}', '{16}', '{17}', '{18}')" , SFDProvince, SFDCity, SFDCounty, MDDProvince, MDDCity, MDDCounty, goods, weight, volume, vehicleLen, vehicleType, mobile, phone, distance, codeUser, Convert.ToString(dt.Rows[0]["code_company"]), Convert.ToString(dt.Rows[0]["username"]), contact, "1"); dt = new Leo.Oracle.DataAccess(Leo.RegistryKey.KeyPathWlxgx).ExecuteTable(sql); info.Add("IsRelease", "Yes"); info.Add("Message", "发布成功!"); Json = JsonConvert.SerializeObject(info); } catch (Exception ex) { info.Add("IsRelease", "No"); info.Add("Message", string.Format("{0}:获取数据发生异常。{1}", ex.Source, ex.Message)); Json = JsonConvert.SerializeObject(info); } }
protected void Page_Load(object sender, EventArgs e) { //用户编码 var codeUser = Request.Params["CodeUser"]; Dictionary <string, string> info = new Dictionary <string, string>(); try { if (codeUser == null) { info.Add("IsInfo", "No"); info.Add("参数CodeUser不能为null!", "举例:http://218.92.115.55/M_Sph/UserInfo/InfoForDriver.aspx?CodeUser=1DBAB54785BDB214E053A864016AB214"); Json = JsonConvert.SerializeObject(info); return; } string sql = string.Format("select * from TB_SPH_USER_AUTH where code_user='******' and roletype='{1}'", codeUser, "1"); //验证此会员是否已认证 var dt = new Leo.Oracle.DataAccess(Leo.RegistryKey.KeyPathWlxgx).ExecuteTable(sql); if (dt.Rows.Count == 0) { info.Add("IsInfo", "No"); info.Add("Message", "用户未认证!"); Json = JsonConvert.SerializeObject(info); return; } //查询司机信息 // sql = // string.Format(@"select b.username,b.identity_card,b.vehiclenum,b.vehiclelen,b.vehicletype,b.tons,b.auditmark_identity,b.auditmark_driving,b.auditmark_vehicle,a.account,a.logogram // from tb_sph_user a, tb_sph_user_auth b // where a.code_user=b.code_user and a.code_user='******' and b.roletype='{1}'" // , codeUser, "1"); sql = string.Format(@"select b.username,b.identity_card,b.vehiclenum,b.vehiclelen,b.vehicletype,b.tons,b.auditmark_identity,b.auditmark_driving,b.auditmark_vehicle from tb_sph_user_auth b where code_user='******' and roletype='{1}'" , codeUser, "1"); dt = new Leo.Oracle.DataAccess(Leo.RegistryKey.KeyPathWlxgx).ExecuteTable(sql); if (dt.Rows.Count == 0) { info.Add("IsInfo", "No"); info.Add("Message", "网络错误,请稍后再试!"); } else { info.Add("IsInfo", "Yes"); info.Add("UserName", dt.Rows[0]["username"].ToString()); info.Add("IdentityCard", TokenTool.HideIDCard(dt.Rows[0]["identity_card"].ToString())); info.Add("VehicleNum", dt.Rows[0]["vehiclenum"].ToString()); info.Add("VehicleLen", dt.Rows[0]["vehiclelen"].ToString()); info.Add("VehicleType", dt.Rows[0]["vehicletype"].ToString()); info.Add("Tons", dt.Rows[0]["tons"].ToString()); info.Add("AuditMarkIdentity", dt.Rows[0]["auditmark_identity"].ToString()); info.Add("AuditMarkDriving", dt.Rows[0]["auditmark_driving"].ToString()); info.Add("AuditMarkVehicle", dt.Rows[0]["auditmark_vehicle"].ToString()); info.Add("Mobile", string.Empty); info.Add("Logogram", string.Empty); } Json = JsonConvert.SerializeObject(info); } catch (Exception ex) { info.Add("IsInfo", "No"); info.Add("Message", string.Format("{0}:获取数据发生异常。{1}", ex.Source, ex.Message)); Json = JsonConvert.SerializeObject(info); } }
protected void Page_Load(object sender, EventArgs e) { //用户编码 var codeUser = Request.Params["CodeUser"]; Dictionary <string, string> info = new Dictionary <string, string>(); try { if (codeUser == null) { info.Add("IsInfo", "No"); info.Add("参数Account不能为空!举例", "http://218.92.115.55/M_Sph/UserInfo/InfoForConsignor.aspx?CodeUser=1DBAB54785BDB214E053A864016AB214"); Json = JsonConvert.SerializeObject(info); return; } string sql = string.Format("select * from TB_SPH_USER_AUTH where code_user='******' and roletype='{1}'", codeUser, "2"); //验证此会员是否已认证 var dt = new Leo.Oracle.DataAccess(Leo.RegistryKey.KeyPathWlxgx).ExecuteTable(sql); if (dt.Rows.Count == 0) { info.Add("IsInfo", "No"); info.Add("Message", "用户未认证!"); Json = JsonConvert.SerializeObject(info); return; } //查询货主信息 sql = string.Format(@"select username,identity_card,auditmark_identity,auditmark_postcard from tb_sph_user_auth where code_user='******' and roletype='{1}'" , codeUser, "2"); dt = new Leo.Oracle.DataAccess(Leo.RegistryKey.KeyPathWlxgx).ExecuteTable(sql); if (dt.Rows.Count == 0) { info.Add("IsInfo", "No"); info.Add("Message", "网络错误,请稍后再试!"); } else { info.Add("IsInfo", "Yes"); info.Add("UserName", dt.Rows[0]["username"].ToString()); info.Add("IdentityCard", TokenTool.HideIDCard(dt.Rows[0]["identity_card"].ToString())); info.Add("AuditMarkIdentity", dt.Rows[0]["auditmark_identity"].ToString()); info.Add("AuditMarkPostcard", dt.Rows[0]["auditmark_postcard"].ToString()); info.Add("Mobile", string.Empty); info.Add("Logogram", string.Empty); } Json = JsonConvert.SerializeObject(info); } catch (Exception ex) { info.Add("IsInfo", "No"); info.Add("Message", string.Format("{0}:获取数据发生异常。{1}", ex.Source, ex.Message)); Json = JsonConvert.SerializeObject(info); } }
/// <summary> /// 保存班组 /// </summary> /// <param name="strGbno">TallyBillE对象</param> /// <returns></returns> private string SaveWorkTeam(TallyBillE tb) { string strJson = string.Empty; if (tb.TeamWorkData != string.Empty) { List <TeamWork> listTeamWork = JsonConvert.DeserializeObject <List <TeamWork> >(tb.TeamWorkData); for (int iList = 0; iList < listTeamWork.Count; iList++) { Nullable <int> amount = null; Nullable <decimal> weight = null; Nullable <decimal> count = null; TeamWork tw = listTeamWork[iList]; /* *判断班组是否被选中, * 1选中:判断是否已经存在;存在,更新;不存在,插入; * 2未选中:判断是否已经存在;存在,删除;不存在,不用管; */ string strFilter = string.Format(" where tbno='{0}' and pmno='{1}' and code_workteam='{2}' and workno='{3}'", tb.Tbno, tb.Pmno, tw.code_workteam, tw.workno); string strSql = string.Format("select * from TB_TALLY_WORKER{0}", strFilter); var dt = new Leo.Oracle.DataAccess(RegistryKey.KeyPathZCHarbor).ExecuteTable(strSql); if (tw.select == "1") { if (string.IsNullOrWhiteSpace(tw.begintime) || string.IsNullOrWhiteSpace(tw.endtime)) { strJson = JsonConvert.SerializeObject(new DicPackage(false, null, "班组起、至时间不能为空!").DicInfo()); return(strJson); } if (!TokenTool.VerifyHoursAndMinute(tw.begintime) || !TokenTool.VerifyHoursAndMinute(tw.endtime)) { strJson = JsonConvert.SerializeObject(new DicPackage(false, null, "班组起、至时间格式不正确!").DicInfo()); return(strJson); } strJson = VerifyAndSetQuantityData(tw.amount, tw.weight, tw.count, ref amount, ref weight, ref count); if (!string.IsNullOrWhiteSpace(strJson)) { return(strJson); } Nullable <decimal> strWeightConfirm = tb.Mark_finish == '1' ? count : null; if (dt.Rows.Count > 0)//已存在,更新 { strSql = string.Format(@"update TB_TALLY_WORKER set start_time='{0}',end_time='{1}',amount='{2}',weight='{3}',worknum='{4}',weight_confirm='{5}',modifytime=to_date('{6}','yyyy-mm-dd hh24:mi:ss'),modifier='{7}',modifiername='{8}'", tw.begintime.Remove(2, 1), tw.endtime.Remove(2, 1), amount, weight, count, strWeightConfirm, tb.AuditTime, tb.Creator, tb.Creatorname); } else//不存在,插入 { strSql = string.Format(@"insert into TB_TALLY_WORKER(pmno,tbno,code_workteam,workno,start_time,end_time,amount,weight,worknum,code_department,weight_confirm,createtime,creator,creatorname) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}',to_date('{11}','yyyy-mm-dd hh24:mi:ss'),'{12}','{13}')", tb.Pmno, tb.Tbno, tw.code_workteam, tw.workno, tw.begintime.Remove(2, 1), tw.endtime.Remove(2, 1), amount, weight, count, tb.Code_Department, strWeightConfirm, tb.AuditTime, tb.Creator, tb.Creatorname); } } else { if (dt.Rows.Count > 0)//已存在,删除 { strSql = string.Format("delete from TB_TALLY_WORKER{0}", strFilter); } } da.ExecuteNonQuery(strSql); } } return(strJson); }
public Package <string> Register(string mobile, string password1, string password2, string appName) { try { //验证是否有权访问 //if (!authHeader.ValideUser(authHeader.UserName, authHeader.PassWord)) //{ // return new Package<string>(true, "没有访问权限!", null); //} //判断是否已注册 string sql = string.Format("select * from TB_SPH_USER where account='{0}'", mobile); var dt = new Leo.Oracle.DataAccess(Leo.RegistryKey.KeyPathWlxgx).ExecuteTable(sql); if (dt.Rows.Count != 0) { return(new Package <string>(false, "手机号已注册!", null)); } //手机号码验证 string message = TokenTool.VerifyMobile(mobile); if (message != "ture") { return(new Package <string>(false, message, null)); } //判断密码是的合理 if (password1 != password2) { return(new Package <string>(false, "密码不一致!", null)); } //App使用截止时间 string timeType = "MONTH"; int timeInterval = 3; DateTime endTime; switch (timeType) { case "DAY": endTime = DateTime.Now.AddDays(timeInterval); break; case "MONTH": endTime = DateTime.Now.AddMonths(timeInterval); break; case "YEAR": endTime = DateTime.Now.AddYears(timeInterval); break; default: throw new Exception("错误的对象索引"); } //注册 sql = string.Format(@"insert into TB_SPH_USER (account, password, endtime) values ('{0}', '{1}', to_date('{2}','YYYY-MM-DD HH24:MI:SS'))" , mobile, password1, endTime); dt = new Leo.Oracle.DataAccess(Leo.RegistryKey.KeyPathWlxgx).ExecuteTable(sql); //检查是否已插入 sql = string.Format(@"select * from TB_SPH_USER where account='{0}' and password='******' and endtime=to_date('{2}','YYYY-MM-DD HH24:MI:SS')" , mobile, password1, endTime); dt = new Leo.Oracle.DataAccess(Leo.RegistryKey.KeyPathWlxgx).ExecuteTable(sql); if (dt.Rows.Count == 0) { return(new Package <string>(false, "网络错误,请稍后再试!", null)); } else { if (Convert.ToString(dt.Rows[0]["account"]) != mobile || Convert.ToString(dt.Rows[0]["password"]) != password1 || Convert.ToString(dt.Rows[0]["endtime"]) != endTime.ToString()) { return(new Package <string>(false, "网络错误,请稍后再试!", null)); } else { return(new Package <string>(true, "注册成功!", null)); } } } catch (Exception ex) { return(new Package <string>(false, string.Format("{0}:获取数据发生异常。{1}", ex.Source, ex.Message), null)); } }
public async Task <IActionResult> Index([FromServices] KyubeyContext db, [FromServices] ITokenRepository _tokenRepository, string id, CancellationToken cancellationToken) { var token = await db.Tokens .Include(x => x.Curve) .SingleOrDefaultAsync(x => x.Id == id && x.Status == TokenStatus.Active, cancellationToken); if (token == null) { return(Prompt(x => { x.Title = SR["Token not found"]; x.Details = SR["The token {0} is not found", id]; x.StatusCode = 404; })); } ViewBag.Otc = await db.Otcs.SingleOrDefaultAsync(x => x.Id == id, cancellationToken); ViewBag.Bancor = await db.Bancors.SingleOrDefaultAsync(x => x.Id == id, cancellationToken); ViewBag.Curve = token.Curve; ViewBag.Token = token; var tokenInfo = _tokenRepository.GetOne(id); ViewBag.TokenInfo = tokenInfo; ViewBag.TokenDescription = _tokenRepository.GetTokenIncubationDescription(id, currentCulture); if (!token.HasIncubation) { return(View("IndexOld", token)); } ViewBag.Flex = false; var comments = db.TokenComments .Include(x => x.User) .Include(x => x.ReplyUserId) .Where(x => x.TokenId == id && x.IsDelete == false) .Select(x => new TokenComment() { Id = x.Id, ReplyUserId = x.ReplyUserId, UserId = x.UserId, User = x.User, Content = x.Content, CreateTime = x.CreateTime, DeleteTime = x.DeleteTime, IsDelete = x.IsDelete, ParentCommentId = x.ParentCommentId, ReplyUser = db.Users.FirstOrDefault(u => u.Id == x.ReplyUserId), TokenId = x.TokenId }) .ToList(); var commentPraises = await(from p in db.TokenCommentPraises join c in db.TokenComments on p.CommentId equals c.Id where c.IsDelete == false && c.TokenId == id select p).ToListAsync(cancellationToken); var commentsVM = comments.Where(x => x.ReplyUserId == null).OrderByDescending(x => x.CreateTime).Select(x => new TokenCommentViewModel() { Content = x.Content, CreateTime = x.CreateTime.ToLocalTime().ToString("d", System.Globalization.CultureInfo.InvariantCulture), PraiseCount = commentPraises.Count(p => p.CommentId == x.Id), UserId = x.UserId, UserName = x.User.UserName, ChildComments = comments.Where(cc => cc.ParentCommentId == x.Id).OrderByDescending(c => c.CreateTime).Select(c => new TokenCommentViewModel() { Content = c.Content, CreateTime = c.CreateTime.ToLocalTime().ToString("d", System.Globalization.CultureInfo.InvariantCulture), PraiseCount = commentPraises.Count(p => p.CommentId == x.Id), ReplyUserId = c.ReplyUserId, UserId = c.UserId, UserName = c.User.UserName, ReplyUserName = c.ReplyUser?.UserName }).ToList() }).ToList(); var handlerVM = new TokenHandlerViewModel() { TokenInfo = await db.Tokens.SingleAsync(x => x.Id == id && x.Status == TokenStatus.Active, cancellationToken), HandlerInfo = new HandlerInfo() { Detail = _tokenRepository.GetTokenIncubationDetail(id, currentCulture), Introduction = _tokenRepository.GetTokenIncubationDescription(id, currentCulture), RemainingDay = tokenInfo?.Incubation?.DeadLine == null ? -999 : (tokenInfo.Incubation.DeadLine - DateTime.Now).Days, TargetCredits = tokenInfo?.Incubation?.Goal ?? 0, CurrentRaised = Convert.ToDecimal(await db.RaiseLogs.Where(x => x.TokenId == token.Id && x.Account.Length == 12).Select(x => x.Amount).SumAsync()), CurrentRaisedCount = await db.RaiseLogs.Where(x => x.TokenId == token.Id && x.Account.Length == 12).CountAsync() }, IncubatorBannerUrls = TokenTool.GetTokenIncubatorBannerUris(id, _tokenRepository.GetTokenIncubationBannerPaths(id, currentCulture)), Comments = commentsVM, RecentUpdate = _tokenRepository.GetTokenIncubatorUpdates(id, currentCulture)?.Select(x => new RecentUpdateViewModel() { Content = x.Content, Time = x.Time, Title = x.Title }).ToList() }; ViewBag.HandlerView = handlerVM; return(View(token)); }
protected void Page_Load(object sender, EventArgs e) { //ID var id = Request.Params["ID"]; //始发地省,市,区县 var SFDProvince = Request.Params["SFDProvince"]; var SFDCity = Request.Params["SFDCity"]; var SFDCounty = Request.Params["SFDCounty"]; //目的地区省,市,区县 var MDDProvince = Request.Params["MDDProvince"]; var MDDCity = Request.Params["MDDCity"]; var MDDCounty = Request.Params["MDDCounty"]; //货物类型 var goods = Request.Params["Goods"]; //重量 var weight = Request.Params["Weight"]; //体积(方) var volume = Request.Params["Volume"]; //车长 var vehicleLen = Request.Params["VehicleLen"]; //车型 var vehicleType = Request.Params["VehicleType"]; //手机 var mobile = Request.Params["Mobile"]; //电话 var phone = Request.Params["Phone"]; //联系人 var contact = Request.Params["Contact"]; //距离 var distance = Request.Params["Distance"]; Dictionary <string, string> info = new Dictionary <string, string>(); try { if (id == null || SFDProvince == null || SFDCity == null || SFDCounty == null || MDDProvince == null || MDDCity == null || MDDCounty == null || goods == null || weight == null || volume == null || vehicleLen == null || vehicleType == null || mobile == null || phone == null) { info.Add("参数ID,SFDProvince,SFDCity,SFDCounty,MDDProvince,MDDCity,MDDCounty,Goods,Weight,Volume,VehicleLen,VehicleType,Mobile,Phone,Contact,Distance不能为null!举例", "http://218.92.115.55/M_Sph/Goods/ModifyGoods.aspx?ID=1951A407932F9040E053A86401699040&SFDProvince=北京&SFDCity=&SFDCounty=&MDDProvince=江苏省&MDDCity=&MDDCounty=&Goods=煤炭&Weight=&Volume=&VehicleLen=&VehicleType=&Mobile=18000000000&Phone=&Contact=&Distance="); Json = JsonConvert.SerializeObject(info); return; } //判断ID、始发省、目的省、货物类型、手机是否为空 if (id == "" || SFDProvince == "" || MDDProvince == "" || goods == "" || mobile == "") { info.Add("参数ID,SFDProvince,MDDProvince,Goods,Mobile必须填数据!举例", "ID=1951A407932F9040E053A86401699040&SFDProvince=北京&MDDProvince=江苏省&Goods=煤炭&Mobile=18000000000"); Json = JsonConvert.SerializeObject(info); return; } //手机号码验证 string message = TokenTool.VerifyMobile(mobile); if (message != "ture") { info.Add("IsReg", "No"); info.Add("Message", message); Json = JsonConvert.SerializeObject(info); return; } //判断此货源是否存在 string sql = string.Format("select * from TB_DMT_CARGO where PKID='{0}'", id); var dt = new Leo.Oracle.DataAccess(Leo.RegistryKey.KeyPathWlxgx).ExecuteTable(sql); if (dt.Rows.Count == 0) { info.Add("IsModify", "No"); info.Add("Message", "此货源不存在!"); Json = JsonConvert.SerializeObject(info); return; } //更新货源 sql = string.Format(@"update TB_DMT_CARGO set sfd_province='{0}',sfd_city='{1}',sfd_county='{2}',mdd_province='{3}',mdd_city='{4}',mdd_county='{5}',cargoname='{6}',weight='{7}',volume='{8}',vehicleLen='{9}',vehicleType='{10}',mobile='{11}',phone='{12}',opeartetime=to_date('{13}','YYYY-MM-DD HH24:MI:SS'),contact_man='{14}',diatance='{15}',style='{16}' where pkid='{17}'" , SFDProvince, SFDCity, SFDCounty, MDDProvince, MDDCity, MDDCounty, goods, weight, volume, vehicleLen, vehicleType, mobile, phone, DateTime.Now, contact, distance, "1", id); dt = new Leo.Oracle.DataAccess(Leo.RegistryKey.KeyPathWlxgx).ExecuteTable(sql); info.Add("IsModify", "Yes"); info.Add("Message", "发布成功!"); Json = JsonConvert.SerializeObject(info); } catch (Exception ex) { info.Add("IsModify", "No"); info.Add("Message", string.Format("{0}:获取数据发生异常。{1}", ex.Source, ex.Message)); Json = JsonConvert.SerializeObject(info); } }
protected void Page_Load(object sender, EventArgs e) { //身份校验 if (!InterfaceTool.IdentityVerify(Request)) { Json = JsonConvert.SerializeObject(new DicPackage(false, null, "身份认证错误!").DicInfo()); return; } //手机号 string strMobile = Request.Params["Mobile"]; //strMobile = "17710556243"; //strMobile = "18036600293"; AppLog log = new AppLog(Request); log.strAccount = strMobile; log.strBehavior = "获取手机验证码"; log.strBehaviorURL = "/Entrance/GetMobileAuthCode.aspx"; try { if (strMobile == null) { Json = JsonConvert.SerializeObject(new DicPackage(false, null, "参数错误,获取验证码失败!").DicInfo()); return; } //手机号验证 string strMessage = TokenTool.VerifyMobile(strMobile); if (strMessage != "ture") { Json = JsonConvert.SerializeObject(new DicPackage(false, null, strMessage).DicInfo()); return; } //生成随机验证码 string strSql = string.Format("select round(dbms_random.value(100000,1000000)) as authcode from dual"); var dt0 = new Leo.Oracle.DataAccess(RegistryKey.KeyPathHmw).ExecuteTable(strSql); //if (dt0.Rows.Count <= 0) //{ // Json = JsonConvert.SerializeObject(new DicPackage(false, null, "网络错误,请稍后再试!").DicInfo()); // return; //} //获取应用中文名称 strSql = string.Format(@"select fullname from VW_APP_TOKEN where appname='{0}'", Request.Params["AppName"]); var dt1 = new Leo.Oracle.DataAccess(RegistryKey.KeyPathMa).ExecuteTable(strSql); //if (dt.Rows.Count <= 0) //{ // Json = JsonConvert.SerializeObject(new DicPackage(false, null, "网络错误,请稍后再试!").DicInfo()); // return; //} string paramData = "{\"template\":\"SMS_63320388\"," + "\"recipients\":[\"" + strMobile + "\"]," + "\"prefix\":\"连云港港\"," + "\"parameters\":{\"AUTHCODE\":\"" + Convert.ToString(dt0.Rows[0]["authcode"]) + "\",\"APPNAME\":\"" + "(" + Convert.ToString(dt1.Rows[0]["fullname"]) + ")" + "\"}}"; var result = ALiSmsSender.PostRequest(paramData); if (result.Item1 == true) { //保存动态验证码(MobileCenter) //string strDynamicIntervalTime = ConfigTool.GetWebConfigKey("DynamicIntervalTime"); //DateTime dynamicBeginTime = DateTime.Now; //DateTime dynamicEndTime = dynamicBeginTime.AddSeconds(Convert.ToDouble(strDynamicIntervalTime)); strSql = string.Format(@"insert into TB_APP_MOBILE_AUTHCODE (mobile,dynamic_authcode,dynamic_begintime,dynamic_endtime,un_dynamic_authcode) values({0},'{1}',sysdate,sysdate+2/24/60,{2})", strMobile, Identity.RijndaelEncode(Convert.ToString(dt0.Rows[0]["authcode"])), Convert.ToString(dt0.Rows[0]["authcode"])); new Leo.Oracle.DataAccess(RegistryKey.KeyPathMa).ExecuteNonQuery(strSql); Json = JsonConvert.SerializeObject(new DicPackage(true, null, "已成功发送,请注意查看!").DicInfo()); log.LogCatalogSuccess(); } else { Json = JsonConvert.SerializeObject(new DicPackage(false, null, "线路问题,请重新发送").DicInfo()); log.LogCatalogFailure("线路问题,请重新发送1"); } } catch (Exception ex) { Json = JsonConvert.SerializeObject(new DicPackage(false, null, string.Format("{0}:获取手机验证码数据发生异常。{1}", ex.Source, ex.Message)).DicInfo()); log.LogCatalogFailure(string.Format("{0}:获取手机验证码数据发生异常。{1}", ex.Source, ex.Message)); } }
public async Task <WrappedResponse <AccountResponse> > Handle(LoginCommand request, CancellationToken cancellationToken) { var newAccountInfo = request.Info; //判断该平台ID是否已经注册, 先从redis查找 var loginCheckInfo = await _redisRep.GetLoginCheckInfo(newAccountInfo.PlatformAccount); bool isRegister = false; AccountInfo accountInfo; if (loginCheckInfo != null) { //直接通过ID去查找这个玩家信息 accountInfo = await _redisRep.GetAccountInfo(loginCheckInfo.Id); //为空从数据库读取 if (accountInfo == null) { accountInfo = await _accountRep.GetByIdAsync(loginCheckInfo.Id); } } else { //查找数据库中是否有这个账号 accountInfo = await _accountRep.GetByPlatform(newAccountInfo.PlatformAccount); if (accountInfo == null) { //注册新账号 isRegister = true; long newUid = await _genRepository.GenNewId(); accountInfo = new AccountInfo(newUid, newAccountInfo.PlatformAccount, newAccountInfo.UserName, newAccountInfo.Sex, newAccountInfo.HeadUrl, newAccountInfo.Type, DateTime.Now); await _accountRep.AddAsync(accountInfo); } } if (accountInfo != null) { newAccountInfo.Id = accountInfo.Id; string token = TokenTool.GenToken(accountInfo.Id); AccountResponse accounResponse; bool isNeedUpdate = false; if (!isRegister && accountInfo.IsNeedUpdate(newAccountInfo)) { isNeedUpdate = true; } if (isRegister) { var mqResponse = await _moneyAddClient.GetResponseExt <AddMoneyMqCmd, WrappedResponse <MoneyMqResponse> > (new AddMoneyMqCmd(accountInfo.Id, InitRewardInfo.RewardCoins, 0, AddReason.InitReward)); var moneyInfo = mqResponse.Message.Body; accounResponse = new AccountResponse(newAccountInfo.Id, newAccountInfo.PlatformAccount, newAccountInfo.UserName, newAccountInfo.Sex, newAccountInfo.HeadUrl, token, new MoneyInfo(moneyInfo.CurCoins + moneyInfo.Carry, moneyInfo.CurDiamonds, moneyInfo.MaxCoins, moneyInfo.MaxDiamonds), WSHostManager.GetOneHost(), true, newAccountInfo.Type); } else { var mqResponse = await _moneyClient.GetResponseExt <GetMoneyMqCmd, WrappedResponse <MoneyMqResponse> > (new GetMoneyMqCmd(accountInfo.Id)); var moneyInfo = mqResponse.Message.Body; accounResponse = new AccountResponse(newAccountInfo.Id, newAccountInfo.PlatformAccount, newAccountInfo.UserName, newAccountInfo.Sex, newAccountInfo.HeadUrl, token, new MoneyInfo(moneyInfo.CurCoins + moneyInfo.Carry, moneyInfo.CurDiamonds, moneyInfo.MaxCoins, moneyInfo.MaxDiamonds), WSHostManager.GetOneHost(), false, newAccountInfo.Type); } _ = _bus.RaiseEvent <LoginEvent>(new LoginEvent(Guid.NewGuid(), accounResponse, isRegister, isNeedUpdate, newAccountInfo)); WrappedResponse <AccountResponse> retRresponse = new WrappedResponse <AccountResponse>(ResponseStatus.Success, null, accounResponse); return(retRresponse); } WrappedResponse <AccountResponse> response = new WrappedResponse <AccountResponse>(ResponseStatus.LoginError, null, null); return(response); }