コード例 #1
0
        public FileOpRes uploadFileBytes([FromBody] FileOpReq req)
        {
            string type    = req.type;
            string version = req.version;
            string content = req.content;

            // 参数检查
            if (string.IsNullOrEmpty(type))
            {
                return(newFailedRes(RespCode.FILE_OP_SERVICE_IllegalParameter, "参数不能为空(type)"));
            }
            if (string.IsNullOrEmpty(version))
            {
                return(newFailedRes(RespCode.FILE_OP_SERVICE_IllegalParameter, "参数不能为空(version)"));
            }
            if (string.IsNullOrEmpty(content))
            {
                return(newFailedRes(RespCode.FILE_OP_SERVICE_IllegalParameter, "参数不能为空(content)"));
            }

            // 上传数据
            bool flag = handler.uploadFileBytes(type, version, content);

            // 返回
            return(newSuccessRes(new FileSave(flag)));
        }
コード例 #2
0
        public FileOpRes getMaxVersionByType([FromBody] FileOpReq req)
        {
            string type = req.type;

            // 参数检查
            if (string.IsNullOrEmpty(type))
            {
                return(newFailedRes(RespCode.FILE_OP_SERVICE_IllegalParameter, "参数不能为空(type)"));
            }

            // 下载数据
            string version = handler.getMaxVersionByType(type);

            // 返回
            return(newSuccessRes(new FileVersion(version)));
        }
コード例 #3
0
        public FileOpRes downloadFileBytes([FromBody] FileOpReq req)
        {
            string type    = req.type;
            string version = req.version;

            // 参数检查
            if (string.IsNullOrEmpty(type))
            {
                return(newFailedRes(RespCode.FILE_OP_SERVICE_IllegalParameter, "参数不能为空(type)"));
            }
            if (string.IsNullOrEmpty(version))
            {
                return(newFailedRes(RespCode.FILE_OP_SERVICE_IllegalParameter, "参数不能为空(version)"));
            }

            // 下载数据
            string content = handler.downloadFileBytes(type, version);

            // 返回
            return(newSuccessRes(new FileContent(content)));
        }
コード例 #4
0
 public string getReqInfo([FromBody] FileOpReq req)
 {
     return("FileOpController.req(POST).parameter:" + ",type=" + req.type + ",version=" + req.version + ",content=" + req.content + ",random:" + new Random().Next(0, 9));
 }