예제 #1
0
        private void UserCoupon()
        {
            int          cid    = GetInt("couponid");
            int          userId = GetInt("uid");
            int          index  = GetInt("start");
            int          size   = GetInt("limit");
            JsonTransfer jt     = new JsonTransfer();

            try
            {
                var userCoupon = new UserCoupon()
                {
                    CouponId = cid,
                    UserId   = userId
                               //CreateTime = DateTime.Now
                };
                var old = CouponHelper.GetUserCoupon(userId, cid);
                if (old != null && old.Id != 0)
                {
                    jt.Add("status", 0);
                    jt.Add("message", "用户已经使用过该优惠券");
                    Response.Write(DesEncrypt(jt).ToLower());
                    Response.End();
                    return;
                }
                CouponHelper.CreateUserCoupon(userCoupon);
            }
            catch
            {
                throw;
            }

            jt.AddSuccessParam();
            Response.Write(DesEncrypt(jt).ToLower());
            Response.End();
        }