Esempio n. 1
0
        public async override Task <UserDto> Update(UpdateUserInput input)
        {
            if (!string.IsNullOrEmpty(input.FileIds))
            {
                int fileId  = input.FileIds.ToListBySplit().FirstOrDefault();
                var newFile = await UpdateUserPhoto(input.Id, fileId);

                input.Photos = newFile.FilePath;
            }

            //检查账号是否存在,如果不存在,那么就自动生成
            if (string.IsNullOrEmpty(input.Account))
            {
                input.Account = GenerateAccount();
                ////提醒手机用户,信息审核通过
                await _jpushHelper.PushToAlias("审核通过", $"恭喜你,你的信息已经审核;账号:{input.Account},密码身份证后6位", new List <string>() { input.Id.ToString() });
            }

            return(await base.Update(input));
        }
Esempio n. 2
0
        /// <summary>
        /// 给订单指派人
        /// </summary>
        /// <param name="handlers"></param>
        /// <returns></returns>
        public async Task <bool> Assign(long orderId, long userId)
        {
            var order = await _orderRepository.GetAsync(orderId);

            if (order.HandlerId.HasValue)
            {
                throw new UserFriendlyException("该任务已经派过人员");
            }
            order.HandlerId = userId;
            order.TStatus   = TStatus.Wait;

            //生成消息类容
            await _messageService.Create(new CreateMessageInput()
            {
                Title   = order.Category,
                Content = order.ItemName,
                UserId  = userId,
                //接单
                AppPage = order.OrderType.GetDescription(),
                SrcId   = orderId
            });

            //插入Handler记录
            await _handlerRepository.InsertAsync(new WOrder_Handler()
            {
                OrderId  = order.Id,
                HandleId = userId,
                OStatus  = OStatus.Init,
            });

            //如果消息没有设置未已阅的话,那么就在此处设置已阅读
            await _messageService.ReadMyMsg(orderId);

            //执行推送消息
            await _jpushHelper.PushToAlias($"有新任务来了", $"{order.Category}", new List <string>() { userId.ToString() });

            return(await Task.FromResult(true));
        }