예제 #1
0
        public async Task <JsonResult> GetUserActivityModels(Guid activityId, Service.Activity.Enum.AuditStatus auditStatus = Service.Activity.Enum.AuditStatus.None, int pageIndex = 1, int pageSize = 10)
        {
            using (var client = new ActivityClient())
            {
                var result = await client.GetUserApplyActivityModelsPagedAsync(activityId, auditStatus, pageIndex, pageSize);

                if (result.Success)
                {
                    return(AjaxHelper.MvcJsonResult(HttpStatusCode.OK, "成功", result.Result));
                }
                return(AjaxHelper.MvcJsonResult(HttpStatusCode.BadGateway, "服务器内部错误"));
            }
        }
예제 #2
0
        public async Task <JsonResult> AuditUserActivityStatusByPKID(int pkid, Guid activityId, Service.Activity.Enum.AuditStatus status, string remark)
        {
            if (pkid <= 0 || activityId == Guid.Empty || status != Service.Activity.Enum.AuditStatus.NotPassed && status != Service.Activity.Enum.AuditStatus.Passed)
            {
                return(AjaxHelper.MvcJsonResult(HttpStatusCode.BadRequest, "参数不完整"));
            }
            string sendText;
            var    userActivity = new UserApplyActivityModel
            {
                PKID   = pkid,
                Remark = remark,
                Status = status
            };

            if (status == Service.Activity.Enum.AuditStatus.Passed)
            {
                using (var client = new ActivityClient())
                {
                    var activity = await client.GetActivityModelByActivityIdAsync(activityId);

                    if (activity.Success)
                    {
                        if (!await CheckApplyUserCountAsync(activityId, activity.Result.Quota))
                        {
                            return(AjaxHelper.MvcJsonResult(HttpStatusCode.Accepted, "活动审核通过人数已满"));
                        }
                    }
                    else
                    {
                        return(AjaxHelper.MvcJsonResult(HttpStatusCode.BadGateway, "服务器内部错误"));
                    }
                }
                var serviceCode = Guid.NewGuid();
                sendText = serviceCode.ToString();
                userActivity.ServiceCode = serviceCode;
            }
            else
            {
                sendText = $"抱歉,您报名途虎免费洗车活动审核未通过。备注:{remark}";
            }
            using (var activityClient = new ActivityClient())
            {
                var result = await activityClient.UpdateUserActivityStatusByPKIDAsync(userActivity);

                if (result.Success && result.Result)
                {
                    //短信发送服务码
                    var ua = await activityClient.GetUserApplyActivityByPKIDAsync(pkid);

                    if (ua.Success)
                    {
                        using (var client = new Service.Utility.SmsClient())
                        {
                            var sendResult = client.SendSms(ua.Result.Mobile, 138, sendText);
                            if (sendResult.Success)
                            {
                                return(AjaxHelper.MvcJsonResult(HttpStatusCode.OK, "审核成功"));
                            }
                        }
                    }
                    return(AjaxHelper.MvcJsonResult(HttpStatusCode.OK, "审核成功,但短信发送失败。"));
                }
            }
            return(AjaxHelper.MvcJsonResult(HttpStatusCode.BadGateway, "审核失败"));
        }