示例#1
0
        public async Task <BaseApiResponse> IncentiveWallet([FromBody] IncentiveWalletRequest request)
        {
            request.CheckNotNull(nameof(request));
            if (request.BenevolenceIndex >= 1 || request.BenevolenceIndex <= 0)
            {
                return(new BaseApiResponse {
                    Code = 400, Message = "指出值异常"
                });
            }
            var wallet = _walletQueryService.Info(request.WalletId);

            if (wallet == null)
            {
                return(new BaseApiResponse {
                    Code = 400, Message = "没有找到钱包"
                });
            }
            var command = new IncentiveBenevolenceCommand(request.WalletId, request.BenevolenceIndex);
            var result  = await ExecuteCommandAsync(command);

            if (!result.IsSuccess())
            {
                return(new BaseApiResponse {
                    Code = 400, Message = "命令没有执行成功:{0}".FormatWith(result.GetErrorMessage())
                });
            }
            return(new BaseApiResponse());
        }
示例#2
0
        public async Task <BaseApiResponse> IncentiveWallet(IncentiveWalletRequest request)
        {
            request.CheckNotNull(nameof(request));
            if (request.BenevolenceIndex >= 1 || request.BenevolenceIndex <= 0)
            {
                return(new BaseApiResponse {
                    Code = 400, Message = "指出值异常"
                });
            }
            var wallet = _walletQueryService.Info(request.WalletId);

            if (wallet == null)
            {
                return(new BaseApiResponse {
                    Code = 400, Message = "没有找到钱包"
                });
            }
            var command = new IncentiveBenevolenceCommand(request.WalletId, request.BenevolenceIndex);
            var result  = await ExecuteCommandAsync(command);

            if (!result.IsSuccess())
            {
                return(new BaseApiResponse {
                    Code = 400, Message = "命令没有执行成功:{0}".FormatWith(result.GetErrorMessage())
                });
            }
            //添加操作记录
            var currentAdmin = _contextService.GetCurrentAdmin(HttpContext.Current);

            RecordOperat(currentAdmin.AdminId.ToGuid(), "激励钱包福豆", wallet.Id, "钱包{0},指数:{1}".FormatWith(wallet.OwnerMobile, request.BenevolenceIndex));

            return(new BaseApiResponse());
        }