コード例 #1
0
        /// <summary>
        /// 添加阅读数量
        /// </summary>
        public string SetReaderCount()
        {
            string content = string.Empty;

            var respData = new SetReaderCountRespData();

            try
            {
                string reqContent = Request["ReqContent"];
                var    reqObj     = reqContent.DeserializeJSONTo <SetReaderCountReqData>();

                string photoId = reqObj.special.photoId;    //活动ID

                if (string.IsNullOrEmpty(photoId))
                {
                    photoId = "3DD35B9A122F41C8A0E5D5B78D72CE65";
                }

                Loggers.Debug(new DebugLogInfo()
                {
                    Message = string.Format("SetReaderCount: {0}", reqContent)
                });

                //判断客户ID是否传递
                if (!string.IsNullOrEmpty(reqObj.common.customerId))
                {
                    customerId = reqObj.common.customerId;
                }
                var loggingSessionInfo = Default.GetBSLoggingSession(customerId, "1");

                var photoService = new LEventsAlbumPhotoBLL(loggingSessionInfo);
                var photoList    = photoService.QueryByEntity(new LEventsAlbumPhotoEntity {
                    PhotoId = photoId
                }, null);

                if (photoList != null && photoList.Length > 0)
                {
                    var photoEntity = photoList.FirstOrDefault();

                    photoEntity.ReaderCount += 1;

                    photoService.Update(photoEntity);
                }
            }
            catch (Exception ex)
            {
                respData.code        = "103";
                respData.description = "数据库操作错误";
                //respData.exception = ex.ToString();
            }
            content = respData.ToJSON();
            return(content);
        }
コード例 #2
0
        /// <summary>
        /// 获取照片信息
        /// </summary>
        public string GetPhoto()
        {
            string content = string.Empty;

            var respData = new GetPhotoRespData();

            try
            {
                string reqContent = Request["ReqContent"];
                var    reqObj     = reqContent.DeserializeJSONTo <GetPhotoReqData>();

                string albumId = reqObj.special.albumId;    //活动ID

                if (string.IsNullOrEmpty(albumId))
                {
                    albumId = "3DD35B9A122F41C8A0E5D5B78D72CE65";
                }

                Loggers.Debug(new DebugLogInfo()
                {
                    Message = string.Format("GetPhoto: {0}", reqContent)
                });

                //判断客户ID是否传递
                if (!string.IsNullOrEmpty(reqObj.common.customerId))
                {
                    customerId = reqObj.common.customerId;
                }
                var loggingSessionInfo = Default.GetBSLoggingSession(customerId, "1");

                var bll = new LEventsAlbumPhotoBLL(loggingSessionInfo);

                respData.content = bll.GetByAlbumID(reqObj.special.albumId);
            }
            catch (Exception ex)
            {
                respData.code        = "103";
                respData.description = "数据库操作错误";
                //respData.exception = ex.ToString();
            }
            content = respData.ToJSON();
            return(content);
        }