예제 #1
0
        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);
        }
예제 #2
0
        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));
        }
예제 #3
0
 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));
        }
예제 #6
0
        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));
        }
예제 #9
0
    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);
    }
예제 #10
0
        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)));
 }
예제 #12
0
 public Action2000(ActionGetter actionGetter)
     : base(1000, actionGetter)
 {
     responsePack = new ResponsePack();
 }
예제 #13
0
        public BaseResponseModel <bool> ChangeUserAddress(UserAddress userAddress)
        {
            var result = userService.UserUpdateAddress(userAddress, userDataContent.userID);

            return(ResponsePack.Responsing(result));
        }
예제 #14
0
        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)));
 }
예제 #19
0
        public BaseResponseModel <UserDataOutput> GetUserData()
        {
            var user = userService.GetUser(userDataContent.userID);

            return(ResponsePack.Responsing(user));
        }
예제 #20
0
        public BaseResponseModel <AddressOutput> GetUserAddress()
        {
            var result = userService.GetAddress(userDataContent.userID);

            return(ResponsePack.Responsing(result));
        }