Ejemplo n.º 1
0
        /// <summary>
        /// 代金券或立减优惠解析
        /// </summary>
        /// <param name="parser"></param>
        /// <returns></returns>
        protected unsafe bool parseCoupon(xmlParser parser, char *name)
        {
            int  index;
            char code = *(name + 7);

            if (code == 'i')
            {
                if ((index = getCouponIndex("coupon_id_", name)) >= 0)
                {
                    return(parser.UnsafeParse(ref coupons[index].coupon_id));
                }
            }
            else if (code == 'f')
            {
                if ((index = getCouponIndex("coupon_fee_", name)) >= 0)
                {
                    return(parser.UnsafeParse(ref coupons[index].coupon_fee));
                }
            }
            return(parser.IgnoreValue());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 退款信息
        /// </summary>
        /// <param name="parser"></param>
        /// <returns></returns>
        private unsafe bool parseRefund(xmlParser parser, char *name)
        {
            int index, couponIndex = 0;

            switch (*name - 'c')
            {
            case 'c' - 'c':
                switch (*(name + 14) - 'b')
                {
                case 'f' - 'b':
                    if ((index = getCouponIndex("coupon_refund_fee_", name, ref couponIndex)) >= 0)
                    {
                        if (couponIndex >= 0)
                        {
                            return(parser.UnsafeParse(ref refunds[index].coupons[couponIndex].coupon_refund_fee));
                        }
                        else
                        {
                            return(parser.UnsafeParse(ref refunds[index].coupon_refund_fee));
                        }
                    }
                    break;

                case 'c' - 'b':
                    if ((index = getRefundIndex("coupon_refund_count_", name)) >= 0)
                    {
                        return(parser.UnsafeParse(ref refunds[index].coupon_refund_count));
                    }
                    break;

                case 'b' - 'b':
                    if ((index = getCouponIndex("coupon_refund_batch_id_", name, ref couponIndex)) >= 0 && couponIndex >= 0)
                    {
                        return(parser.UnsafeParse(ref refunds[index].coupons[couponIndex].coupon_refund_batch_id));
                    }
                    break;

                case 'i' - 'b':
                    if ((index = getCouponIndex("coupon_refund_id_", name, ref couponIndex)) >= 0 && couponIndex >= 0)
                    {
                        return(parser.UnsafeParse(ref refunds[index].coupons[couponIndex].coupon_refund_id));
                    }
                    break;
                }
                break;

            case 'r' - 'c':
                switch (*(name + 7) - 'c')
                {
                case 'i' - 'c':
                    if ((index = getRefundIndex("refund_id_", name)) >= 0)
                    {
                        return(parser.UnsafeParse(ref refunds[index].refund_id));
                    }
                    break;

                case 'c' - 'c':
                    if ((index = getRefundIndex("refund_channel_", name)) >= 0)
                    {
                        return(parser.UnsafeEnumByte(ref refunds[index].refund_channel));
                    }
                    break;

                case 'f' - 'c':
                    if ((index = getRefundIndex("refund_fee_", name)) >= 0)
                    {
                        return(parser.UnsafeParse(ref refunds[index].refund_fee));
                    }
                    break;

                case 's' - 'c':
                    if ((index = getRefundIndex("refund_status_", name)) >= 0)
                    {
                        return(parser.UnsafeEnumByte(ref refunds[index].refund_status));
                    }
                    break;
                }
                break;

            case 'o' - 'c':
                if ((index = getRefundIndex("out_refund_no_", name)) >= 0)
                {
                    return(parser.UnsafeParse(ref refunds[index].out_refund_no));
                }
                break;
            }
            return(parser.IgnoreValue());
        }