예제 #1
0
        /// <summary>
        /// 同步获取多张比列缩放图片
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public object Post(FSScalePicFileListRequest request)
        {
            int errCode = ImageFilesValid(request);

            if (errCode != (int)FS_ErrorCode.Request_Success)
            {
                return new ScalePicFileListModel {
                    ret = errCode,
                    message = ErrorCodeDic.GetInstance().CodeMessage(errCode),
                    picUrls = null
                };
            }

            var response = new ScalePicFileListModel();
            try
            {
                IPictureFileService picSvr = new PictureFileService();
                response = picSvr.ScalePictureFile(request.file_guid, JsonUtil<List<string>>.FromJosn(request.sizes));
            }
            catch (Exception e)
            {
                string err = string.Format("PictureServiceHost.FSScalePicFileListRequest error = {0}, request = {1}", e.ToString(), JsonUtil<FSScalePicFileListRequest>.ToJson(request));
                LogUtil.Error(err);
            }

            return response;
        }
예제 #2
0
        /// <summary>
        /// 获取单个指定尺寸图片
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public object Post(FSScalePicFileRequest request)
        {
            int errCode = ImageFileRequestValid(request);

            if (errCode != (int)FS_ErrorCode.Request_Success)
                return new AsyncFileDownloadResponse
                    {
                        ret = errCode,
                        message = ErrorCodeDic.GetInstance().CodeMessage(errCode),
                        File_url = null
                    };

            AsyncFileDownloadResponse response = new AsyncFileDownloadResponse();

            try
            {
                IPictureFileService picSvr = new PictureFileService();
                response = picSvr.ScalePictureFile(request.file_guid, request.width, request.height);
            }
            catch(Exception e)
            {
                string err = string.Format("PictureServiceHost.FSScalePicFileRequest error = {0}, request = {1}", e.ToString(), JsonUtil<FSScalePicFileRequest>.ToJson(request));
                LogUtil.Error(err);
            }

            return response;
        }