Example #1
0
        public IHttpActionResult GetVipPoint(string openId = "")
        {
            var vip   = _vipService.GetVipInfo(openId);
            var point = _pointService.GetVipPoint(vip);

            if (point != null)
            {
                var pointRecord = _pointService.GetVipPointRecord(vip);
                return(Json(new { success = true, message = new { score = point.VipPoint, pointRecord = pointRecord } }));
            }
            return(Json(new { success = false, message = "发生错误!" }));
        }
Example #2
0
        public IHttpActionResult ExChangeCoupon(string openId = "", string couponConfigId = "")
        {
            var vip    = _vipService.GetVipInfo(openId);
            var coupon = _couponService.GetShopCoupon(couponConfigId);

            if (coupon != null && vip != null)
            {
                var point = _pointService.GetVipPoint(vip);
                if (point != null)
                {
                    if (point.VipPoint >= coupon.CouponPoint)
                    {
                        if (_couponService.ExChangeCoupon(vip.VipId, coupon.CouponConfigId))
                        {
                            return(Json(new { success = true, message = "兑换成功!" }));
                        }
                    }
                    return(Json(new { success = false, message = "积分不足!" }));
                }
            }
            return(Json(new { success = false, message = "发生错误!" }));
        }