void DeleteAgent() { JToken result = new JObject(); if (glbf.GetLoginStatus() != 1) { result["result"] = "fail"; result["msg"] = "未完成登入程序"; result["column"] = "session"; Response.Write(JsonConvert.SerializeObject(result)); return; } Model.Member.Define memberDefine = new Model.Member.Define(); int targetAgentId; int agentId = (int)Session["id"]; int agentLevelId = (int)Session["levelId"]; int targetAgentLevelId; string targetAgentId_s = (req["agentId"] ?? "").ToString(); var chkAgentIdFmt = int.TryParse(targetAgentId_s, out targetAgentId); if (chkAgentIdFmt == false) { result["result"] = "fail"; result["msg"] = "代理帳號格式錯誤"; result["column"] = "agentId"; Response.Write(JsonConvert.SerializeObject(result)); return; } var chkAgentIdExit = memberDefine.CheckMemberIdExist(targetAgentId); if (chkAgentIdExit == false) { result["result"] = "fail"; result["msg"] = "代理帳號不存在"; result["column"] = "agentId"; Response.Write(JsonConvert.SerializeObject(result)); return; } targetAgentLevelId = memberDefine.GetMemberLevelId(targetAgentId); int?targetAgentLN = memberDefine.GetMemberLN(targetAgentId, agentLevelId); if (agentId != targetAgentLN || agentId == targetAgentId) { result["result"] = "fail"; result["msg"] = "權限不足"; result["column"] = "levelId"; Response.Write(JsonConvert.SerializeObject(result)); return; } Model.Member.Edit memberEdit = new Model.Member.Edit(); Model.Member.Edit.AgentStruct bs = new Model.Member.Edit.AgentStruct(); bs.AgentId = targetAgentId; bs.Stauts = Model.Member.Define.MemberStauts.Disable; bs.UpdateUserId = agentId; memberEdit.AgentStructHandle(bs); result["result"] = "success"; result["msg"] = "鎖定帳戶成功"; Response.Write(JsonConvert.SerializeObject(result)); }
void Login() { JToken result = new JObject(); Model.Member.Define memberDefine = new Model.Member.Define(); string clientIP = glbf.GetClientIP(); int agentId; int agentLevelId; string agentStatus; string username = (req["username"] ?? "").ToString(); var chkUsernameExit = memberDefine.CheckMemberUsernameExist(username); if (chkUsernameExit == false) { result["result"] = "fail"; result["msg"] = "無此帳號"; result["column"] = "username"; Response.Write(JsonConvert.SerializeObject(result)); return; } agentId = memberDefine.GetMemberId(username); agentLevelId = memberDefine.GetMemberLevelId(agentId); agentStatus = memberDefine.GetMemberStatus(agentId); if (agentLevelId < 7) { result["result"] = "fail"; result["msg"] = "非代理帳號"; result["column"] = "agentId"; Response.Write(JsonConvert.SerializeObject(result)); return; } if (agentStatus == Model.Member.Define.MemberStauts.Disable) { result["result"] = "fail"; result["msg"] = "帳號鎖定"; result["column"] = "status"; Response.Write(JsonConvert.SerializeObject(result)); return; } else if (agentStatus == Model.Member.Define.MemberStauts.NeedToChangePassword) { result["result"] = "fail"; result["msg"] = "請修改密碼後再次登入"; result["column"] = "status"; Response.Write(JsonConvert.SerializeObject(result)); return; } string password = (req["password"] ?? "").ToString(); if (password != memberDefine.GetMemberPassword(agentId)) { result["result"] = "fail"; result["msg"] = "密碼錯誤"; result["column"] = "password"; Response.Write(JsonConvert.SerializeObject(result)); return; } Model.Member.Edit e = new Model.Member.Edit(); Model.Member.Edit.AgentLoginStruct s = new Model.Member.Edit.AgentLoginStruct(); s.AgentId = agentId; s.LoginIP = clientIP; e.AgentLoginStructHandle(s); result["result"] = "success"; result["msg"] = "登入成功"; result["id"] = agentId.ToString(); Response.Write(JsonConvert.SerializeObject(result)); }
void ForwardGame() { JToken result = new JObject(); Model.Member.Define memberDefine = new Model.Member.Define(); int memberId; string guid; int agentId; string agentId_s = (req["agentId"] ?? "").ToString(); var chkAgentIdFmt = int.TryParse(agentId_s, out agentId); if (chkAgentIdFmt == false) { result["result"] = "fail"; result["msg"] = "代理帳號格式錯誤"; result["errorCode"] = ApiErrorCodes.AgentIdExistFalse; Response.Write(JsonConvert.SerializeObject(result)); return; } var chkAgentIdExit = memberDefine.CheckMemberIdExist(agentId); if (chkAgentIdExit == false) { result["result"] = "fail"; result["msg"] = "代理帳號不存在"; result["errorCode"] = ApiErrorCodes.AgentIdExistFalse; Response.Write(JsonConvert.SerializeObject(result)); return; } string externalId_s = (req["externalId"] ?? "").ToString(); var checkExternalIdExit = memberDefine.CheckMemberExternalIdExist(externalId_s, agentId); if (checkExternalIdExit == false) { result["result"] = "fail"; result["msg"] = "externalId不存在"; result["errorCode"] = ApiErrorCodes.NotFindUsername; Response.Write(JsonConvert.SerializeObject(result)); return; } memberId = memberDefine.GetMemberId(externalId_s, agentId); guid = Guid.NewGuid().ToString("N"); Model.Member.Edit edit = new Model.Member.Edit(); Model.Member.Edit.ForwardGameStruct fg = new Model.Member.Edit.ForwardGameStruct(); fg.MemberId = memberId; fg.Guid = guid; edit.ForwardGameStructHandle(fg); JToken jtk = new JObject(); jtk["agentId"] = agentId; jtk["externalId"] = externalId_s; jtk["guid"] = guid; string str = JsonConvert.SerializeObject(jtk); byte[] bt = Encoding.UTF8.GetBytes(str); string webaddr = Convert.ToBase64String(bt); result["result"] = "success"; result["errorCode"] = 0; result["agentId"] = agentId; result["externalId"] = externalId_s; result["url"] = "http://192.168.1.131:82/lottery/externalLogin?post=" + webaddr; Response.Write(JsonConvert.SerializeObject(result)); }
void EditDefaultBetSetting() { JToken result = new JObject(); if (glbf.GetLoginStatus() != 1) { result["result"] = "fail"; result["msg"] = "未完成登入程序"; result["column"] = "session"; Response.Write(JsonConvert.SerializeObject(result)); return; } Model.Member.Define memberDefine = new Model.Member.Define(); int agentId = (int)Session["id"]; int targetAgentId; JObject defaultBetSettingObj; int agentLevelId = (int)Session["levelId"]; int targetAgentLevelId; string defaultBetSetting = (req["defaultBetSetting"] ?? "").ToString(); string targetAgentUsername = (req["agentUsername"] ?? "").ToString(); string targetAgentId_s = (req["agentId"] ?? "").ToString(); var chkAgentIdFmt = int.TryParse(targetAgentId_s, out targetAgentId); if (chkAgentIdFmt == false) { result["result"] = "fail"; result["msg"] = "代理帳號格式錯誤"; result["errorCode"] = ApiErrorCodes.AgentIdExistFalse; Response.Write(JsonConvert.SerializeObject(result)); return; } var chkAgentIdExit = memberDefine.CheckMemberIdExist(targetAgentId); if (chkAgentIdExit == false) { result["result"] = "fail"; result["msg"] = "代理帳號不存在"; result["errorCode"] = ApiErrorCodes.AgentIdExistFalse; Response.Write(JsonConvert.SerializeObject(result)); return; } targetAgentLevelId = memberDefine.GetMemberLevelId(targetAgentId); try { defaultBetSettingObj = JsonConvert.DeserializeObject <JObject>(defaultBetSetting); } catch (Exception excep) { result["result"] = "fail"; result["msg"] = "betSetting轉換json失敗"; result["column"] = "betSetting"; Response.Write(JsonConvert.SerializeObject(result)); return; } int?targetAgentLN = memberDefine.GetMemberLN(targetAgentId, agentLevelId); if (agentId != targetAgentLN) { result["result"] = "fail"; result["msg"] = "權限不足"; result["column"] = "levelId"; Response.Write(JsonConvert.SerializeObject(result)); return; } Model.Member.Edit edit = new Model.Member.Edit(); Model.Member.Edit.AgentStruct bs = new Model.Member.Edit.AgentStruct(); bs.AgentId = targetAgentId; bs.DefaultBetSetting = defaultBetSettingObj; bs.UpdateUserId = agentId; edit.AgentStructHandle(bs); result["result"] = "success"; result["msg"] = "修改預設賽事設定完成"; result["column"] = ""; Response.Write(JsonConvert.SerializeObject(result)); }
void oneTimeLinkLogin() { JToken result = new JObject(); Model.Member.Define memberDefine = new Model.Member.Define(); byte[] decbuff = Convert.FromBase64String(Request["post"]); var o = System.Text.Encoding.UTF8.GetString(decbuff); var json = JsonConvert.DeserializeObject <JObject>(o); int memberId; string ip = glbf.GetClientIP(); int agentId; string memberGuid; string agentId_s = (json["agentId"] ?? "").ToString(); var chkAgentIdFmt = int.TryParse(agentId_s, out agentId); if (chkAgentIdFmt == false) { result["result"] = "fail"; result["msg"] = "代理帳號格式錯誤"; result["errorCode"] = ApiErrorCodes.AgentIdExistFalse; Response.Write(JsonConvert.SerializeObject(result)); return; } var chkAgentIdExit = memberDefine.CheckMemberIdExist(agentId); if (chkAgentIdExit == false) { result["result"] = "fail"; result["msg"] = "代理帳號不存在"; result["errorCode"] = ApiErrorCodes.AgentIdExistFalse; Response.Write(JsonConvert.SerializeObject(result)); return; } string externalId_s = (json["externalId"] ?? "").ToString(); var checkExternalIdExit = memberDefine.CheckMemberExternalIdExist(externalId_s, agentId); if (checkExternalIdExit == false) { result["result"] = "fail"; result["msg"] = "externalId不存在"; result["errorCode"] = ApiErrorCodes.NotFindUsername; Response.Write(JsonConvert.SerializeObject(result)); return; } memberId = memberDefine.GetMemberId(externalId_s, agentId); memberGuid = memberDefine.GetMemberGuid(memberId); string guid_s = (json["guid"] ?? "").ToString(); if (guid_s != memberGuid) { result["result"] = "fail"; result["msg"] = "guid錯誤"; result["errorcode"] = ApiErrorCodes.NotFindUsername; Response.Write(JsonConvert.SerializeObject(result)); return; } Model.Member.Edit memberEdit = new Model.Member.Edit(); Model.Member.Edit.MemberLoginStruct s = new Model.Member.Edit.MemberLoginStruct(); s.MemberId = memberId; s.LoginIP = ip; memberEdit.MemberLoginStructHandle(s); result["result"] = "success"; result["msg"] = "登入成功"; Response.Redirect("./index"); }
void depositWalletAmount() { JToken result = new JObject(); Model.Member.Define memberDefine = new Model.Member.Define(); int memberId; decimal memberWalletAmount; string transferType; decimal walletDiff; int agentId; string transferType_s = (req["transferType"] ?? "").ToString(); string walletAmount_s = (req["walletAmount"] ?? "").ToString(); string agentId_s = (req["agentId"] ?? "").ToString(); var chkAgentIdFmt = int.TryParse(agentId_s, out agentId); if (chkAgentIdFmt == false) { result["result"] = "fail"; result["msg"] = "代理帳號格式錯誤"; result["errorCode"] = ApiErrorCodes.AgentIdExistFalse; Response.Write(JsonConvert.SerializeObject(result)); return; } var chkAgentIdExit = memberDefine.CheckMemberIdExist(agentId); if (chkAgentIdExit == false) { result["result"] = "fail"; result["msg"] = "代理帳號不存在"; result["errorCode"] = ApiErrorCodes.AgentIdExistFalse; Response.Write(JsonConvert.SerializeObject(result)); return; } string externalId_s = (req["externalId"] ?? "").ToString(); var checkExternalIdExit = memberDefine.CheckMemberExternalIdExist(externalId_s, agentId); if (checkExternalIdExit == false) { result["result"] = "fail"; result["msg"] = "externalId不存在"; result["errorCode"] = ApiErrorCodes.NotFindUsername; Response.Write(JsonConvert.SerializeObject(result)); return; } memberId = memberDefine.GetMemberId(externalId_s, agentId); memberWalletAmount = memberDefine.GetMemberWalletAmount(memberId); bool conversionWalletAmount = decimal.TryParse(walletAmount_s, out walletDiff); if (conversionWalletAmount == false) { result["result"] = "fail"; result["msg"] = "金額格式錯誤"; Response.Write(JsonConvert.SerializeObject(result)); return; } bool checkTransferType = Model.Member.Define.TransactionTypesLangMap.ContainsKey(transferType_s); if (checkTransferType == false) { result["result"] = "fail"; result["msg"] = "交易型態錯誤"; Response.Write(JsonConvert.SerializeObject(result)); return; } transferType = transferType_s; if (transferType == Model.Member.Define.TransactionType.Debits) { if (walletDiff > memberWalletAmount) { result["result"] = "fail"; result["msg"] = "餘額不足"; Response.Write(JsonConvert.SerializeObject(result)); return; } memberWalletAmount -= walletDiff; } else if (transferType == Model.Member.Define.TransactionType.Deposit) { memberWalletAmount += walletDiff; } Model.Member.Edit.BalanceTransferStruct m = new Model.Member.Edit.BalanceTransferStruct(); Model.Member.Edit edit = new Model.Member.Edit(); m.MemberId = memberId; m.WalletAmount = memberWalletAmount; edit.BalanceTransferStructHandle(m); result["result"] = "success"; result["msg"] = "交易成功,交易金額為:" + walletDiff.ToString() + ",目前餘額為:" + memberWalletAmount.ToString(); Response.Write(JsonConvert.SerializeObject(result)); }
void betFormAdd() { JToken result = new JObject(); if (glbf.GetLoginStatus() != 2) { result["result"] = "fail"; result["msg"] = "未完成登入程序"; result["column"] = "session"; Response.Write(JsonConvert.SerializeObject(result)); return; } Model.Member.Define memberDefine = new Model.Member.Define(); Model.BetForm.Define betFormDefine = new Model.BetForm.Define(); int memberId = (int)Session["id"]; int parentId = (int)Session["parentId"]; string ip = glbf.GetClientIP(); string periodId = betFormDefine.GetLotteryPeriodId(); JObject chooseBallObj; string betType; string betBranch; string betRemark = null; decimal betAmount; int combo; decimal rate; decimal totalBet; decimal walletAmount = memberDefine.GetMemberWalletAmount(memberId); string betType_s = (req["betType"] ?? "").ToString(); var checkBetTypeExit = Model.BetForm.Define.BetTypesLangMap.ContainsKey(betType_s); if (checkBetTypeExit == false) { result["result"] = "fail"; result["msg"] = "找不到此BetType"; result["column"] = "betType"; Response.Write(JsonConvert.SerializeObject(result)); return; } betType = betType_s; string betBranch_s = (req["betBranch"] ?? "").ToString(); int betBranchTemp; var chkBetBranchTempFmt = int.TryParse(betBranch_s, out betBranchTemp); if (chkBetBranchTempFmt == false) { result["result"] = "fail"; result["msg"] = "betBranch格式錯誤"; result["column"] = "betBranch"; Response.Write(JsonConvert.SerializeObject(result)); return; } betBranch = betBranch_s; string betRemark_s = (req["betRemark"] ?? "").ToString(); if (betRemark_s != "") { var checkBetRemark = memberDefine.TitleValidate(betRemark_s); if (checkBetRemark == 2) { result["result"] = "fail"; result["msg"] = "只能輸入中文或英數"; result["column"] = "betRemark"; Response.Write(JsonConvert.SerializeObject(result)); return; } else if (checkBetRemark == 1) { result["result"] = "fail"; result["msg"] = "字串長度錯誤"; result["column"] = "betRemark"; Response.Write(JsonConvert.SerializeObject(result)); return; } } betRemark = betRemark_s; string betAmount_s = (req["betAmount"] ?? "").ToString(); bool chkBetBetAmountFmt = decimal.TryParse(betAmount_s, out betAmount); if (chkBetBetAmountFmt == false) { result["result"] = "fail"; result["msg"] = "BetAmount格式錯誤"; result["column"] = "betAmount"; Response.Write(JsonConvert.SerializeObject(result)); return; } decimal singleBetMinValue = memberDefine.GetMemberSingleBetMinValue(memberId, betType); if (betAmount < singleBetMinValue) { result["result"] = "fail"; result["msg"] = "小於玩法單注限額"; result["column"] = "betAmount"; Response.Write(JsonConvert.SerializeObject(result)); return; } decimal singleBetMaxValue = memberDefine.GetMemberSingleBetMaxValue(memberId, betType); if (betAmount > singleBetMaxValue) { result["result"] = "fail"; result["msg"] = "大於玩法單注限額"; result["column"] = "betAmount"; Response.Write(JsonConvert.SerializeObject(result)); return; } //bool checkBetTime = define.CheckBetTime(); //if (checkBalance == false) //{ // result["result"] = "fail"; // result["msg"] = "超過時間"; // result["errorcode"] = ApiErrorCodes.OverTime; // Response.Write(JsonConvert.SerializeObject(result)); // return; //} string chooseBall_s = (req["chooseBall"] ?? "").ToString().TrimEnd(',').Replace("\r\n", "").Replace(" ", ""); try { chooseBallObj = JsonConvert.DeserializeObject <JObject>(chooseBall_s); } catch (Exception excep) { result["result"] = "fail"; result["msg"] = "chooseBall轉換json失敗"; result["column"] = "chooseBall"; Response.Write(JsonConvert.SerializeObject(result)); return; } var checkChooseBallCntCorrect = betFormDefine.CheckChooseBallCntCorrect(chooseBallObj, betType); if (checkChooseBallCntCorrect == false) { result["result"] = "fail"; result["msg"] = "chooseBall數量錯誤"; result["column"] = "chooseBall"; Response.Write(JsonConvert.SerializeObject(result)); return; } var chkChooseBallItem = betFormDefine.CheckChooseBallItemCorrect(chooseBallObj, betType, parentId); if (chkChooseBallItem == false) { result["result"] = "fail"; result["msg"] = "賠率異常或球號異常"; result["column"] = "chooseBall"; Response.Write(JsonConvert.SerializeObject(result)); return; } string rate_s = (req["rate"] ?? "").ToString(); var chkRateFmt = decimal.TryParse(rate_s, out rate); if (chkRateFmt == false) { result["result"] = "fail"; result["msg"] = "rate格式錯誤"; result["column"] = "rate"; Response.Write(JsonConvert.SerializeObject(result)); return; } if (rate != betFormDefine.CalcBetFormRate(chooseBallObj, betType)) { result["result"] = "fail"; result["msg"] = "rate錯誤"; result["column"] = "rate"; Response.Write(JsonConvert.SerializeObject(result)); return; } string combo_s = (req["combo"] ?? "").ToString(); int comboTemp; var chkComboFmt = int.TryParse(combo_s, out comboTemp); if (chkComboFmt == false) { result["result"] = "fail"; result["msg"] = "combo格式錯誤"; result["column"] = "combo"; Response.Write(JsonConvert.SerializeObject(result)); return; } if (betFormDefine.CalcBetFormCombo(chooseBallObj, betType) != comboTemp) { result["result"] = "fail"; result["msg"] = "combo錯誤"; result["column"] = "combo"; Response.Write(JsonConvert.SerializeObject(result)); return; } combo = comboTemp; string totalBet_s = (req["totalBet"] ?? "").ToString(); var chkTotalBetFmt = decimal.TryParse(totalBet_s, out totalBet); if (chkTotalBetFmt == false) { result["result"] = "fail"; result["msg"] = "totalBet格式錯誤"; result["column"] = "totalBet"; Response.Write(JsonConvert.SerializeObject(result)); return; } if (totalBet != betAmount * combo) { result["result"] = "fail"; result["msg"] = "totalBet錯誤"; result["column"] = "totalBet"; Response.Write(JsonConvert.SerializeObject(result)); return; } decimal betMaxValueByBetType = memberDefine.GetMemberBetMaxValueByBetType(memberId, betType); decimal agentBetMaxValue = memberDefine.GetMemberAgentBetMaxValue(memberId, betType); decimal totalBetByMember = betFormDefine.GetTotalBetByMember(memberId, periodId, betType); decimal totalBetByAgent = betFormDefine.GetTotalBetByAgent(parentId, periodId); if (totalBet + totalBetByMember > betMaxValueByBetType) { result["result"] = "fail"; result["msg"] = "超過單一玩法限制最大總計金額"; result["column"] = "totalBet"; Response.Write(JsonConvert.SerializeObject(result)); return; } if (totalBet + totalBetByAgent > agentBetMaxValue) { result["result"] = "fail"; result["msg"] = "超過代理限制最大總計金額"; result["column"] = ""; Response.Write(JsonConvert.SerializeObject(result)); return; } if (totalBet > walletAmount) { result["result"] = "fail"; result["msg"] = "餘額不足"; result["column"] = ""; Response.Write(JsonConvert.SerializeObject(result)); return; } walletAmount -= totalBet; // 錢包餘額扣掉下注總金額 bool checkBetFormExist = betFormDefine.CheckBetFormExist(memberId, chooseBallObj, betType); if (checkBetFormExist == true) { result["result"] = "fail"; result["msg"] = "重複下注"; result["column"] = ""; Response.Write(JsonConvert.SerializeObject(result)); return; } Model.BetForm.Add betFormAdd = new Model.BetForm.Add(); Model.BetForm.Add.BetFormStruct b = new Model.BetForm.Add.BetFormStruct(); b.memberId = memberId; b.BetType = betType; b.BetBranch = betBranch; // 暫時未使用 b.ChooseBall = JsonConvert.SerializeObject(chooseBallObj); b.Rate = rate; b.Combo = combo; b.BetAmount = betAmount; b.TotalBet = totalBet; b.IP = ip; b.PeriodId = periodId; b.BetRemark = betRemark; betFormAdd.BetFormStructtHandle(b); // add 注單 Model.Member.Edit memberEdit = new Model.Member.Edit(); Model.Member.Edit.BalanceTransferStruct eb = new Model.Member.Edit.BalanceTransferStruct(); eb.MemberId = memberId; eb.WalletAmount = totalBet; memberEdit.BalanceTransferStructHandle(eb); // 修改 walletAmount result["result"] = "success"; result["msg"] = "第" + periodId + "期下注成功,下注金額為:" + totalBet.ToString() + "賠率為:" + rate.ToString() + " ,剩餘金額:" + walletAmount.ToString(); result["column"] = ""; Response.Write(JsonConvert.SerializeObject(result)); }
void Edit() { JToken result = new JObject(); if (glbf.GetLoginStatus() != 1) { result["result"] = "fail"; result["msg"] = "未完成登入程序"; result["column"] = "session"; Response.Write(JsonConvert.SerializeObject(result)); return; } Model.Member.Define memberDefine = new Model.Member.Define(); int targetAgentId; string password = null; string title = null; string nickname = null; string targetAgentStatus = null; int targetAgentLevelId; int agentId = (int)Session["id"];; int agentLevelId = (int)Session["levelId"]; string targetAgentId_s = (req["agentId"] ?? "").ToString(); var chkAgentIdFmt = int.TryParse(targetAgentId_s, out targetAgentId); if (chkAgentIdFmt == false) { result["result"] = "fail"; result["msg"] = "代理帳號格式錯誤"; result["errorCode"] = ApiErrorCodes.AgentIdExistFalse; Response.Write(JsonConvert.SerializeObject(result)); return; } var chkAgentIdExit = memberDefine.CheckMemberIdExist(targetAgentId); if (chkAgentIdExit == false) { result["result"] = "fail"; result["msg"] = "代理帳號不存在"; result["errorCode"] = ApiErrorCodes.AgentIdExistFalse; Response.Write(JsonConvert.SerializeObject(result)); return; } targetAgentLevelId = memberDefine.GetMemberLevelId(targetAgentId); if (targetAgentLevelId < 7) { result["result"] = "fail"; result["msg"] = "修改對象非代理帳號"; result["column"] = "AgentId"; Response.Write(JsonConvert.SerializeObject(result)); return; } string password_s = (req["password"] ?? "").ToString(); if (password_s != "") { var chkpassword = memberDefine.PasswordValidate(password_s); if (chkpassword == 1) { result["result"] = "fail"; result["msg"] = "password長度必須為4~10"; result["column"] = "password"; Response.Write(JsonConvert.SerializeObject(result)); return; } else if (chkpassword == 2) { result["result"] = "fail"; result["msg"] = "password字元須為英數"; result["column"] = "password"; Response.Write(JsonConvert.SerializeObject(result)); return; } targetAgentStatus = Model.Member.Define.MemberStauts.NeedToChangePassword; password = password_s; } string title_s = (req["title"] ?? "").ToString(); if (title_s != "") { var chktitle = memberDefine.TitleValidate(title_s); if (chktitle == 1) { result["result"] = "fail"; result["msg"] = "title長度必須為1~15"; result["column"] = "title"; Response.Write(JsonConvert.SerializeObject(result)); return; } else if (chktitle == 2) { result["result"] = "fail"; result["msg"] = "title字元須為英數"; result["column"] = "title"; Response.Write(JsonConvert.SerializeObject(result)); return; } title = title_s; } string nickname_s = (req["nickname"] ?? "").ToString(); if (nickname_s != "") { var chkNicknameFmt = memberDefine.TitleValidate(nickname_s); if (chkNicknameFmt == 1) { result["result"] = "fail"; result["msg"] = "nickname長度必須為1~15"; result["column"] = "nickname"; Response.Write(JsonConvert.SerializeObject(result)); return; } else if (chkNicknameFmt == 2) { result["result"] = "fail"; result["msg"] = "nickname字元須為英數"; result["column"] = "nickname"; Response.Write(JsonConvert.SerializeObject(result)); return; } nickname = nickname_s; } int?targetAgentLN = memberDefine.GetMemberLN(targetAgentId, agentLevelId); if (agentId != targetAgentLN || agentId == targetAgentId) { result["result"] = "fail"; result["msg"] = "無修改權限"; result["column"] = "levelId"; Response.Write(JsonConvert.SerializeObject(result)); return; } Model.Member.Edit.AgentStruct s = new Model.Member.Edit.AgentStruct(); Model.Member.Edit update = new Model.Member.Edit(); s.AgentId = targetAgentId; s.Password = password; s.Title = title; s.Nickname = nickname; s.UpdateUserId = agentId; s.Stauts = targetAgentStatus; update.AgentStructHandle(s); result["result"] = "success"; result["msg"] = "更新成功"; result["column"] = ""; Response.Write(JsonConvert.SerializeObject(result)); }