/// <summary> /// APP获取指定的APK版本 /// </summary> /// <param name="inparams">JSON格式的数据参数</param> /// <returns></returns> public ResponseAppResult AppvdGetApkVersion(Dictionary <string, string> inparams) { ResponseAppResult Result = null; userinfos appvdInfo = new userinfos(); try { if (!inparams.Keys.Contains("apkid") || inparams["apkid"] == "") { Result = new ResponseAppResult(ResState.ParamsImperfect, "缺少apkid或apkid为空!", null); return(Result); } apkinfo info = GetApkVersionByID(inparams["sysflag"], inparams["apkid"]); if (info != null) { Result = new ResponseAppResult(ResState.Success, "操作成功", info); } else { Result = new ResponseAppResult(ResState.OperationFailed, "当前APK编号不存在!", null); } } catch (Exception ex) { LogHelper.WriteError("AppvdGetApkVersion调用异常", ex); Result = new ResponseAppResult(ResState.OperationFailed, ex.Message, null); } return(Result); }
/// <summary> /// 根据用户ID获取用户实体信息 /// </summary> /// <param name="sysflag"></param> /// <param name="usernameormobilenum"></param> /// <param name="pwd"></param> /// <param name="username"></param> /// <returns>返回用户对象实体</returns> private userinfos GetUAppIDUserCheckByUpt(string sysflag, string uid) { ComSqlHelper csh = new ComSqlHelper(); SqlParameter[] Parameters = { new SqlParameter("@uid", uid) }; DataTable dt = csh.FillDataSet(WebProc.GetAppSysflagKey(sysflag), WebProc.Proc("QWGProc_App_GetUserInfo"), Parameters).Tables[0]; if (dt.Rows.Count > 0) { userinfos appvduser = new userinfos(); appvduser.uid = dt.Rows[0]["UID"].ToString().Trim(); appvduser.username = dt.Rows[0]["NAME"].ToString().Trim(); appvduser.pwd = dt.Rows[0]["PASSWORD"].ToString().Trim(); appvduser.mobilenum = dt.Rows[0]["MobileNum"].ToString().Trim(); appvduser.memo = dt.Rows[0]["MEMO"].ToString(); appvduser.email = dt.Rows[0]["Email"].ToString(); appvduser.fullname = dt.Rows[0]["FullName"].ToString(); appvduser.sex = dt.Rows[0]["Sex"].ToString(); appvduser.phoneno = dt.Rows[0]["PHONENO"].ToString(); appvduser.id_card_no = dt.Rows[0]["ID_CARD_NO"].ToString(); appvduser.nativeplace = dt.Rows[0]["NATIVEPLACE"].ToString(); appvduser.adress = dt.Rows[0]["ADDRESS"].ToString(); return(appvduser); } else { return(null); } }
/// <summary> /// 根据用户名和手机号码获取用户实体信息 /// </summary> /// <param name="sysflag"></param> /// <param name="usernameormobilenum"></param> /// <param name="pwd"></param> /// <param name="username"></param> /// <returns></returns> private void GetUAppIDUserCheck(string sysflag, string usernameormobilenum, string pwd) { ComSqlHelper csh = new ComSqlHelper(); SqlParameter[] Parameters = { new SqlParameter("@nameormobile", usernameormobilenum), new SqlParameter("@pwd", pwd) }; DataTable dt = csh.FillDataSet(WebProc.GetAppSysflagKey(sysflag), WebProc.Proc("QWGProc_Appvd_GetUserByNameORMobilenum"), Parameters).Tables[0]; if (dt.Rows.Count > 0) { appvduser = new userinfos(); string dbpwd = dt.Rows[0]["PASSWORD"].ToString(); appvduser.uid = dt.Rows[0]["UID"].ToString(); appvduser.username = dt.Rows[0]["NAME"].ToString().Trim(); appvduser.pwd = dt.Rows[0]["PASSWORD"].ToString().Trim(); appvduser.mobilenum = dt.Rows[0]["MobileNum"].ToString().Trim(); appvduser.source = dt.Rows[0]["SourceId"].ToString(); appvduser.memo = dt.Rows[0]["MEMO"].ToString(); appvduser.email = dt.Rows[0]["Email"].ToString(); appvduser.fullname = dt.Rows[0]["FullName"].ToString(); appvduser.sex = dt.Rows[0]["SEX"].ToString(); appvduser.phoneno = dt.Rows[0]["PHONENO"].ToString(); appvduser.id_card_no = dt.Rows[0]["ID_CARD_NO"].ToString(); appvduser.adress = dt.Rows[0]["ADDRESS"].ToString(); appvduser.nativeplace = dt.Rows[0]["NATIVEPLACE"].ToString(); appvdreturn.userinfo = appvduser; } }
/// <summary> /// 用户信息修改 /// </summary> /// <param name="uinfo"></param> public void UserInfoUpdate(userinfos uinfo, string sysflag) { ComSqlHelper csh = new ComSqlHelper(); SqlParameter[] Parameters = { new SqlParameter("@uid", uinfo.uid), new SqlParameter("@username", uinfo.username), new SqlParameter("@pwd", uinfo.pwd), new SqlParameter("@mobilenum", uinfo.mobilenum), new SqlParameter("@memo", uinfo.memo), new SqlParameter("@email", uinfo.email), new SqlParameter("@fullname", uinfo.fullname), new SqlParameter("@sex", uinfo.sex), new SqlParameter("@phoneno", uinfo.phoneno), new SqlParameter("@id_card_no", uinfo.id_card_no), new SqlParameter("@adress", uinfo.adress), new SqlParameter("@nativeplace", uinfo.nativeplace), }; csh.ExecuteSPNoQuery(WebProc.GetAppSysflagKey(sysflag), WebProc.Proc("QWGProc_Appvd_UserUpdate"), Parameters, true); }
/// <summary> /// APP用户信息修改 /// </summary> /// <param name="inparams"></param> /// <returns></returns> public ResponseAppResult AppvdUserUpdate(Dictionary <string, string> inparams) { ResponseAppResult Result = null; userinfos appvdInfo = new userinfos(); if (!inparams.Keys.Contains("uid") || inparams["uid"] == "") { Result = new ResponseAppResult(ResState.ParamsImperfect, "缺少uid或uid为空!", null); return(Result); } //if (!inparams.Keys.Contains("mobilenum") || inparams["mobilenum"] == "") //{ // Result = new ResponseAppResult(ResState.ParamsImperfect, "缺少mobilenum或mobilenum为空!", null); // return Result; //} try { string sysflag = inparams["sysflag"]; appvdInfo.uid = inparams["uid"]; userinfos uinfo = GetUAppIDUserCheckByUpt(inparams["sysflag"], inparams["uid"]); //必填项 string mobilenum_new = inparams.ContainsKey("mobilenum") && inparams["mobilenum"].Trim() != "" ? inparams["mobilenum"] : uinfo.mobilenum; string username_new = inparams.ContainsKey("username") && inparams["username"].Trim() != "" ? inparams["username"] : uinfo.username; appvdInfo.mobilenum = mobilenum_new; appvdInfo.username = username_new; if (uinfo != null) { //非必填项 如果不包含指定的参数值,那么读取该实体的数据信息,并赋值 appvdInfo.memo = inparams.ContainsKey("memo") ? inparams["memo"] : uinfo.memo; appvdInfo.pwd = inparams.ContainsKey("pwd") ? inparams["pwd"] : uinfo.pwd; appvdInfo.email = inparams.ContainsKey("email") ? inparams["email"] : uinfo.email; appvdInfo.fullname = inparams.ContainsKey("fullname") ? inparams["fullname"] : uinfo.email; appvdInfo.sex = inparams.ContainsKey("sex") ? inparams["sex"] : uinfo.sex; appvdInfo.phoneno = inparams.ContainsKey("phoneno") ? inparams["phoneno"] : uinfo.phoneno; appvdInfo.id_card_no = inparams.ContainsKey("id_card_no") ? inparams["id_card_no"] : uinfo.id_card_no; appvdInfo.nativeplace = inparams.ContainsKey("nativeplace") ? inparams["nativeplace"] : uinfo.nativeplace; appvdInfo.adress = inparams.ContainsKey("adress") ? inparams["adress"] : uinfo.adress; if (mobilenum_new != uinfo.mobilenum || username_new != uinfo.username) //判断是否要修改手机号码; { int s = CheckUserNameMobileNum(sysflag, username_new, mobilenum_new); //如果修改,验证当前新手机号码是否与数据库中存在的手机号码重复 if (s == 0) { UserInfoUpdate(appvdInfo, sysflag); Result = new ResponseAppResult(ResState.Success, "操作成功!", null); return(Result); } else //表示新手机号码和用户名都存在 { Result = new ResponseAppResult(ResState.OperationFailed, "手机号码,或用户名已存在!", null); } } else { UserInfoUpdate(appvdInfo, sysflag); Result = new ResponseAppResult(ResState.Success, "操作成功!", null); } } else { Result = new ResponseAppResult(ResState.OperationFailed, "用户不存在", null); } } catch (Exception ex) { LogHelper.WriteError("AppvdUserUpdate调用异常", ex); Result = new ResponseAppResult(ResState.OperationFailed, ex.Message, null); } return(Result); }
public appvduserinfo appvdreturn = new appvduserinfo(); //用户登录返回的信息实体类 #region APP用户注册 /// <summary> /// APP用户注册 /// </summary> /// <param name="inparams">JSON格式的数据参数</param> /// <returns></returns> public ResponseAppResult AppvdUserRegister(Dictionary <string, string> inparams) { ResponseAppResult Result = null; userinfos appvdInfo = new userinfos(); if (!inparams.Keys.Contains("username") || inparams["username"] == "") { Result = new ResponseAppResult(ResState.ParamsImperfect, "缺少username或username为空!", null); return(Result); } if (!inparams.Keys.Contains("pwd") || inparams["pwd"] == "") { Result = new ResponseAppResult(ResState.ParamsImperfect, "缺少pwd或pwd为空!", null); return(Result); } if (!inparams.Keys.Contains("mobilenum") || inparams["mobilenum"] == "") { Result = new ResponseAppResult(ResState.ParamsImperfect, "缺少mobilenum或mobilenum为空!", null); return(Result); } if (!inparams.Keys.Contains("smscode") || inparams["smscode"] == "") { Result = new ResponseAppResult(ResState.ParamsImperfect, "缺少smscode或smscode为空!", null); return(Result); } try { //必填项 appvdInfo.username = inparams["username"].Trim(); appvdInfo.pwd = inparams["pwd"].Trim(); appvdInfo.mobilenum = inparams["mobilenum"].Trim(); appvdInfo.source = "1"; //默认为手机APP用户注册类型 string sysflag = inparams["sysflag"]; //非必填项 appvdInfo.memo = inparams.ContainsKey("memo") ? inparams["memo"] : ""; appvdInfo.email = inparams.ContainsKey("email") ? inparams["email"] : ""; appvdInfo.fullname = inparams.ContainsKey("fullname") ? inparams["fullname"] : ""; appvdInfo.sex = inparams.ContainsKey("sex") ? inparams["sex"] : ""; appvdInfo.phoneno = inparams.ContainsKey("phoneno") ? inparams["phoneno"] : ""; appvdInfo.id_card_no = inparams.ContainsKey("id_card_no") ? inparams["id_card_no"] : ""; appvdInfo.nativeplace = inparams.ContainsKey("nativeplace") ? inparams["nativeplace"] : ""; appvdInfo.adress = inparams.ContainsKey("adress") ? inparams["adress"] : ""; string smscode = inparams["smscode"]; if (MessageCodeManager.CheckSms(smscode, appvdInfo.mobilenum)) //判断验证码是否存在于公共静态变量中 { int s = CheckUserNameMobileNum(sysflag, appvdInfo.username, appvdInfo.mobilenum); //验证用户名和手机号码是否重复 if (s == 0) //不存在相同的用户名和手机号码 { UserRegister(appvdInfo, sysflag); string dbusername = ""; int uid = GetUIDUserCheck(sysflag, appvdInfo.username, appvdInfo.pwd, out dbusername); if (uid > 0) { appvduserreg ul = new appvduserreg(); ul.uid = uid.ToString(); ul.username = appvdInfo.username; ul.pwd = appvdInfo.pwd; Result = new ResponseAppResult(ResState.Success, "操作成功", ul); } else { Result = new ResponseAppResult(ResState.OperationFailed, "注册失败", null); //return Result; } MessageCodeManager.DelSmsByCode(smscode); //当前验证码存在于静态变量中,将其删除(避免生成重复的验证码) } else if (s == 1) //用户名存在 { Result = new ResponseAppResult(ResState.OperationFailed, "手机号码已经注册!", null); return(Result); } else if (s == 2)//手机号码存在 { Result = new ResponseAppResult(ResState.OperationFailed, "用户名已存在!", null); return(Result); } else if (s == 3)//用户已经注册 { Result = new ResponseAppResult(ResState.OperationFailed, "用户已经注册!", null); return(Result); } } else { Result = new ResponseAppResult(ResState.OperationFailed, "验证码错误!", null); } } catch (Exception ex) { LogHelper.WriteError("AppvdUserRegister调用异常", ex); Result = new ResponseAppResult(ResState.OperationFailed, ex.Message, null); } return(Result); }