protected override bool DecodePacket(MessageStructure reader, MessageHead head) { responsePack = ProtoBufUtils.Deserialize <ResponsePack>(netReader.Buffer); string responseDataInfo = ""; responseDataInfo = "request :" + Game.Utils.JsonHelper.prettyJson <Request2000Pack>(req) + "\n"; responseDataInfo += "response:" + Game.Utils.JsonHelper.prettyJson <ResponsePack>(responsePack) + "\n"; DecodePacketInfo = responseDataInfo; int childStepId = getChild(2000); System.Console.WriteLine("childStepID:" + childStepId); if (childStepId > 0) { System.Collections.Generic.Dictionary <string, string> dic = new System.Collections.Generic.Dictionary <string, string>(); /* * req.token = GetParamsData("token",req.token); * req.typeUser = GetParamsData("typeUser",req.typeUser); * req.version = GetParamsData("version", req.version); * req.UserID = GetParamsData("UserID", req.UserID); */ SetChildStep(childStepId.ToString(), _setting, dic); } return(true); }
public BaseResponseModel <LoginOutPut> UserLogin(LoginModel loginModel) { string errMsg = string.Empty; LoginOutPut loginOutPut = new LoginOutPut(); try { //验证提交数据合法性 UserDataLegalityVerification(loginModel); loginOutPut = userService.UserLogin(loginModel); } catch (VerificationException ex) { loginOutPut.remindMsg = ex.Message; } catch (OperationException ex) { errMsg = ex.Message; } catch (Exception ex) { errMsg = ex.Message; } return(ResponsePack.Responsing(loginOutPut, errMeassage: errMsg)); }
public Action1000(ActionGetter actionGetter) : base(1000, actionGetter) { responsePack = new ResponsePack(); _watch = new Stopwatch(); _versionsNotSupport = new List <string>(); }
private void SetResponseHead() { _responseHead = new ResponsePack() { MsgId = actionGetter.GetMsgId(), ActionId = actionGetter.GetActionId(), ErrorCode = ErrorCode, ErrorInfo = ErrorInfo, St = St }; }
public BaseResponseModel <OrderSubmitDto> SubmitOrderByCart(OrderSubmitInputDto orderSubmitInputDto) { OrderSubmitDto submitDto = new OrderSubmitDto(); string errMsg = string.Empty; try { submitDto = orderService.SubmitOrderByCart(userDataContent.userID, orderSubmitInputDto.IDs, orderSubmitInputDto.ifSumbitAll); } catch (Exception ex) { errMsg = ex.Message; } return(ResponsePack.Responsing(submitDto, errMsg)); }
protected override bool DecodePacket(MessageStructure reader, MessageHead head) { responsePack = ProtoBufUtils.Deserialize <ResponsePack>(netReader.Buffer); string responseDataInfo = ""; responseDataInfo = "request :" + Game.Utils.JsonHelper.prettyJson <Request1000Pack>(req) + "\n"; responseDataInfo += "response:" + Game.Utils.JsonHelper.prettyJson <ResponsePack>(responsePack) + "\n"; DecodePacketInfo = responseDataInfo; int childStepId = getChild(1000); if (childStepId > 0) { System.Collections.Generic.Dictionary <string, string> dic = new System.Collections.Generic.Dictionary <string, string>(); dic.Add("UserID", responsePack.UserID.ToString()); SetChildStep(childStepId.ToString(), _setting, dic); } return(true); }
/// <summary> /// 获取商品数据 通过分类CD /// </summary> /// <param name="categoryCD"></param> /// <returns></returns> public BaseResponseModel <GoodsDataOutput> GetGoodsByCategoryCD(string categoryCD) { string errMsg = string.Empty; GoodsDataOutput result = null; try { result = goodsService.GetGoodsByCategoryCD(categoryCD); } catch (VerificationException ex) { errMsg = ex.Message; } catch (Exception ex) { errMsg = ex.Message; } return(ResponsePack.Responsing(result, errMsg)); }
public BaseResponseModel <GoodsDetailOutput> GetGoodsDetail(int ID) { string errMsg = string.Empty; GoodsDetailOutput goodsDetailOutput = null; try { goodsDetailOutput = goodsService.GetGoodsDetail(ID); } catch (VerificationException ex) { errMsg = ex.Message; } catch (Exception ex) { errMsg = ex.Message; } return(ResponsePack.Responsing(goodsDetailOutput, errMsg)); }
public bool TryParse(byte[] data, out PackageHead head, out byte[] bodyBytes) { bodyBytes = null; head = null; int pos = 0; if (data == null || data.Length == 0) { return(false); } int headSize = GetInt(data, ref pos); byte[] headBytes = new byte[headSize]; Buffer.BlockCopy(data, pos, headBytes, 0, headBytes.Length); pos += headSize; ResponsePack resPack = ProtoBufUtils.Deserialize <ResponsePack>(headBytes); head = new PackageHead(); head.StatusCode = resPack.ErrorCode; head.MsgId = resPack.MsgId; head.Description = resPack.ErrorInfo; head.ActionId = resPack.ActionId; head.StrTime = resPack.St; int bodyLen = data.Length - pos; if (bodyLen > 0) { bodyBytes = new byte[bodyLen]; Buffer.BlockCopy(data, pos, bodyBytes, 0, bodyLen); } else { bodyBytes = new byte[0]; } //UnityEngine.Debug.Log(string.Format("ActionId:{0}, ErrorCode:{1}, len:{2}", resPack.ActionId, resPack.ErrorCode, bodyBytes.Length)); return(true); }
public BaseResponseModel <bool> SendVerificationCode(string mobile) { bool result = false; string errMsg = string.Empty; try { if (!IsMobilePhone(mobile)) { throw new VerificationException("手机号码不合法."); } result = SystemService.SendVerificationCode(mobile); } catch (VerificationException ex) { errMsg = ex.Message; } catch (Exception ex) { errMsg = ex.Message; } return(ResponsePack.Responsing(result, errMeassage: errMsg)); }
public BaseResponseModel <List <OrderDataDto> > GetGetOrderList(string type) { return(ResponsePack.Responsing(orderService.GetOrderList(userDataContent.userID, type))); }
public Action2000(ActionGetter actionGetter) : base(1000, actionGetter) { responsePack = new ResponsePack(); }
public BaseResponseModel <bool> ChangeUserAddress(UserAddress userAddress) { var result = userService.UserUpdateAddress(userAddress, userDataContent.userID); return(ResponsePack.Responsing(result)); }
public BaseResponseModel <bool> DeleteUserAddress(int addressID) { var result = userService.UserDeleteAddress(addressID, userDataContent.userID); return(ResponsePack.Responsing(result)); }
public BaseResponseModel <bool> RemoveCart(RemoveCartInput removeCartInput) { return(ResponsePack.Responsing(orderService.RemoveCart(userDataContent.userID, removeCartInput.goodsID, removeCartInput.ifRemoveAll))); }
public BaseResponseModel <bool> AddToCart(AddCartInput addCart) { return(ResponsePack.Responsing(orderService.ADDToCart(userDataContent.userID, addCart.goodsID, addCart.goodsCount))); }
public BaseResponseModel <OrderCartDto> GetUserCart() { return(ResponsePack.Responsing(orderService.GetUserCart(userDataContent.userID))); }
public BaseResponseModel <OrderDataDto> GetOrderDetail(int baseID) { return(ResponsePack.Responsing(orderService.GetOrderDetail(baseID))); }
public BaseResponseModel <UserDataOutput> GetUserData() { var user = userService.GetUser(userDataContent.userID); return(ResponsePack.Responsing(user)); }
public BaseResponseModel <AddressOutput> GetUserAddress() { var result = userService.GetAddress(userDataContent.userID); return(ResponsePack.Responsing(result)); }