Exemple #1
0
        public IHttpActionResult PutNotification(int id, [FromBody] ApplyNotifyRequest request,
                                                 [UserProfile] UserProfile userProfile)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            IHttpActionResult httpActionResult;
            var result = CheckDataRoleAndArrangeParams(request, userProfile, out httpActionResult);

            if (!result)
            {
                return(httpActionResult);
            }

            request.ApplyId = id;

            var exectueResult = _shopApplicationService.Notification(request);

            return(RetrunHttpActionResult4ExectueResult(exectueResult));
        }
        public ExectueResult <ShopApplicationDto> Notification(ApplyNotifyRequest request)
        {
            //需要调用 微信通知

            var dto = _inviteCodeRequestRepository.GetDto(request.ApplyId);

            if (dto == null)
            {
                return(new FailureExectueResult <ShopApplicationDto>(String.Format("申请单{0}未找到", request.ApplyId)));
            }

            var status = (InviteCodeRequestStatus)dto.ApproveStatus;

            switch (status)
            {
            case InviteCodeRequestStatus.Requesting:
                //正在审核
                break;

            case InviteCodeRequestStatus.Approved:
                //已经通过
                _inviteCodeRequestRepository.SetApprovedNotificationTimes(request.ApplyId, request.Times ?? 1);
                break;

            case InviteCodeRequestStatus.Reject:
                //拒绝
                _inviteCodeRequestRepository.SetDemotionNotificationTimes(request.ApplyId, request.Times ?? 1);
                break;

            default:
                throw new OpcException(String.Format("申请单{0}状态({1})未知", request.ApplyId, dto.ApproveStatus));
                break;
            }



            return(GetItem(request.ApplyId));
        }