コード例 #1
0
        public async Task <IActionResult> GetDoctorIntegralPageAsync([FromBody] GetDoctorIntegralPageRequestDto request)
        {
            DoctorBiz doctorBiz = new DoctorBiz();
            ScoreBiz  scoreBiz  = new ScoreBiz();
            var       response  = await doctorBiz.GetDoctorIntegralAsync(request);

            if (!response.CurrentPage.Any())
            {
                return(Success(response));
            }
            var users       = response.CurrentPage.Select(a => a.DoctorGuid).ToArray();
            var totalPoints = await scoreBiz.GetUserPointsAsync(users);

            var earnPoints = await scoreBiz.GetUserEarnPointsAsync(users);

            var usePoints = await scoreBiz.GetUserUsePointsAsync(users);

            foreach (var item in response.CurrentPage)
            {
                item.TotalPoints = totalPoints.FirstOrDefault(a => a.UserGuid == item.DoctorGuid)?.Variation ?? 0;
                item.EarnPoints  = earnPoints.FirstOrDefault(a => a.UserGuid == item.DoctorGuid)?.Variation ?? 0;
                item.UsePoints   = usePoints.FirstOrDefault(a => a.UserGuid == item.DoctorGuid)?.Variation ?? 0;
            }
            return(Success(response));
        }
コード例 #2
0
        public async Task <IActionResult> GetIntegralInfoPageAsync([FromBody] GetIntegralInfoPageRequestDto request)
        {
            ScoreBiz scoreBiz = new ScoreBiz();
            var      response = await scoreBiz.GetIntegralInfoPageAsync(request);

            return(Success(response));
        }
コード例 #3
0
        public async Task <IActionResult> ExportIntegralInfoAsync([FromBody] ExportIntegralInfoRequestDto request)
        {
            ScoreBiz scoreBiz = new ScoreBiz();
            var      response = await scoreBiz.ExportIntegralInfoAsync(request);

            return(Success(new ExportIntegralInfoResponseDto {
                Items = response
            }));
        }
コード例 #4
0
        public async Task <IActionResult> GetDoctorPageAsync([FromBody] GetDoctorPageRequestDto request)
        {
            var      settings    = Factory.GetSettings("host.json");
            var      presence    = settings["XMPP:presence"];
            var      domain      = settings["XMPP:domain"];
            var      response    = await new DoctorBiz().GetDoctorPageAsync(request);
            ScoreBiz scoreBiz    = new ScoreBiz();
            var      users       = response.CurrentPage.Select(a => a.DoctorGuid).ToArray();
            var      totalPoints = await scoreBiz.GetUserPointsAsync(users);

            var wechatSubscriptionRecommendCounts = await new WechatSubscriptionBiz().GetWechatSubscriptionRecommendCountsAsync(WechatSubscriptionModel.EntranceEnum.Doctor, users);

            foreach (var item in response.CurrentPage)
            {
                item.PresenceIcon   = $"{presence}?jid={item.DoctorGuid}@{domain}";
                item.TotalPoints    = totalPoints.FirstOrDefault(a => a.UserGuid == item.DoctorGuid)?.Variation ?? 0;
                item.RecommendCount = wechatSubscriptionRecommendCounts.FirstOrDefault(a => a.UserGuid == item.DoctorGuid)?.Count ?? 0;
            }
            return(Success(response));
        }