Ejemplo n.º 1
0
 public void ReceiveBargainCoupon()
 {
     using (var client = new ShareBargainClient())
     {
         var request = new ReceiveBargainCouponRequest()
         {
             OwnerId           = new Guid("47B2C83F-1132-417E-9B53-B78C738FDA11"),
             ActivityProductId = 357,
             Pid    = "AP-3M-PN38816|1",
             Mobile = "12388883333",
         };
         var result = client.ReceiveBargainCoupon(request).Result;
         Assert.IsTrue(result.Code == 1);
     }
 }
        /// <summary>
        /// 用户领取砍价优惠券
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <OperationResult <ShareBargainBaseResult> > ReceiveBargainCouponAsync(ReceiveBargainCouponRequest request)
        {
            string inputStr = $"入参:ownerId={request.OwnerId},apId={request.ActivityProductId},pid={request.Pid}";

            Logger.Info($"用户领取砍价优惠券ReceiveBargainCouponAsync {inputStr}");
            if (request.OwnerId == Guid.Empty ||
                request.ActivityProductId < 1 ||
                string.IsNullOrWhiteSpace(request.Pid))
            {
                return(OperationResult.FromError <ShareBargainBaseResult>(ErrorCode.ParameterError, "参数不正确"));
            }

            var result = await BargainManager.ReceiveBargainCouponAsync(request);

            Logger.Info($"用户领取砍价优惠券ReceiveBargainCouponAsync 出参:result={JsonConvert.SerializeObject(result)} {inputStr}");

            return(OperationResult.FromResult(result));
        }