/// <summary>
        /// 发放积分
        /// </summary>
        public async void SendPoints(PointLogDto input)
        {
            //获取积分规则
            var pointRule = await _pointRuleRepository.FirstOrDefaultAsync(b => b.Name == input.ActionType);

            if (pointRule == null)
            {
                return;
            }

            //获取规则默认描述
            string defaultDesc = EnumHelper.GetEnumDescription(typeof(PointActionEnum), (int)pointRule.Name);

            //对象映射
            var pointLog = ObjectMapper.Map <PointLog>(input);

            //默认值处理
            pointLog.Points = pointRule.Point;
            if (string.IsNullOrEmpty(pointLog.ActionDesc))
            {
                pointLog.ActionDesc = defaultDesc;
            }

            await _pointLogRepository.InsertAsync(pointLog);
        }
示例#2
0
        public virtual void InsertPointLogsBatchCommandTest()
        {
            PointLogDto newPointLog = new PointLogDto
            {
                logid   = Guid.NewGuid().ToString(),
                logtype = 2,
                point   = 12,
                isdel   = 0,
                wftid   = "W002233"
            };

            var result = pointLogService.HandlerCommand(
                new InsertPointLogsBatchCommand
            {
                pointLogs = new List <PointLogDto> {
                    newPointLog
                }
            });

            Assert.IsNotNull(result);
        }