コード例 #1
0
        public List <MessageListOMItem> GetListByPage(Guid merchantAccountId, int pageIndex, int size, bool isZH)
        {
            var list = MessagesComponent.GetMessagesByPage(merchantAccountId, UserType.Merchant, pageIndex, size);

            var outPutList = new List <MessageListOMItem>();

            foreach (var entity in list)
            {
                var lang     = isZH ? "zh" : "en";
                var content  = ResourceHelper.FiiiPos.GetFormatResource(entity.TitleKey, lang, entity.CoinCode);
                var subTitle = ResourceHelper.FiiiPos.GetFormatResource(entity.SubTitleKey, lang, entity.CoinCode);

                var outPutModel = new MessageListOMItem
                {
                    NoticeId  = entity._id.ToString(),
                    Type      = entity.MsgType,
                    QueryId   = entity.QueryId,
                    Title     = content,
                    SubTitle  = subTitle,
                    Timestamp = entity.CreateTime.ToUnixTime(),
                    Status    = entity.Status
                };

                outPutList.Add(outPutModel);
            }

            return(outPutList);
        }
コード例 #2
0
        public ServiceResult <MessageListOM> GetNewMessageList(MessageListIM model)
        {
            if (!model.MaxType.HasValue)
            {
                model.MaxType = 27;
            }
            if (model.PageSize > 20)
            {
                model.PageSize = 20;
            }
            var outPutList = new List <MessageListOMItem>();

            try
            {
                var isZH = this.IsZH();

                var list = MessagesComponent.GetMessagesByPage(this.GetUser().Id, UserType.User, model.PageIndex, model.PageSize);
                if (list != null && list.Count > 0)
                {
                    list.RemoveAll(t => t.MsgType > model.MaxType.Value);
                }

                foreach (var entity in list)
                {
                    var    lang     = isZH ? "zh" : "en";
                    string content  = ResourceHelper.FiiiPay.GetFormatResource(entity.TitleKey, lang, entity.CoinCode);
                    string subTitle = ResourceHelper.FiiiPay.GetFormatResource(entity.SubTitleKey, lang, entity.CoinCode);

                    var outPutModel = new MessageListOMItem
                    {
                        NoticeId  = entity._id.ToString(),
                        Type      = entity.MsgType,
                        QueryId   = entity.QueryId,
                        Title     = content,
                        SubTitle  = subTitle,
                        Timestamp = entity.CreateTime.ToUnixTime(),
                        Status    = entity.Status
                    };

                    outPutList.Add(outPutModel);
                }
            }
            catch (Exception ex)
            {
                _log.Error(string.Format("GetMessageList:{0}", ex));
            }

            return(new ServiceResult <MessageListOM>
            {
                Data = new MessageListOM
                {
                    List = outPutList
                }
            });
        }