Skip to content

Commit

Permalink
新增json对post文件的支持,使用方法:
Browse files Browse the repository at this point in the history
"POST /BBS/TestUpload":
        {
            "request":
            {
                "uEmail":""
            },
            "fileList":
            {
                "pic1":"{jpg}",
                "pic2":"{png}",
                "pic3":"{file}"
            }
        }

生成的post请求代码如下:
if ( self.sending )
	{
		if ( nil == self.req || NO == [self.req validate] )
		{
			self.failed = YES;
			return;
		}

		NSString * requestURI = [[ServerConfig sharedInstance].url stringByAppendingString:@"/BBS/TestUpload"];
		self.HTTP_POST( requestURI ).PARAM(@"json", [self.req objectToDictionary] ).FILE_JPG(@"pic1", self.fileList.pic1).FILE(@"pic3", self.fileList.pic3).FILE_PNG(@"pic2", self.fileList.pic2);
	}

使用方法如下:
API_BBS_TESTUPLOAD *api = [API_BBS_TESTUPLOAD apiWithResponder:self];
    api.fileList.pic3 = [[NSData alloc] init];
    api.fileList.pic2 = [[UIImage alloc] init];
    api.fileList.pic1 = [[UIImage alloc] init];
    [api send];
  • Loading branch information
cdoky committed Mar 4, 2015
1 parent a49ca91 commit 9efaba9
Show file tree
Hide file tree
Showing 2 changed files with 333 additions and 115 deletions.
7 changes: 7 additions & 0 deletions projects/scaffold/scaffold/SchemaGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ AS_INT( TYPE_OBJECT )

#pragma mark -

@interface SchemaFileList : SchemaModel
@end

#pragma mark -

@interface SchemaController : SchemaObject

@property (nonatomic, retain) NSString * desc;
Expand All @@ -166,6 +171,8 @@ AS_INT( TYPE_OBJECT )
@property (nonatomic, retain) NSString * relativeUrl;
@property (nonatomic, retain) SchemaRequest * request;
@property (nonatomic, retain) SchemaResponse * response;
@property (nonatomic, retain) SchemaFileList * fileList;
@property (nonatomic, retain) NSDictionary * fileParam;

@end

Expand Down
Loading

0 comments on commit 9efaba9

Please sign in to comment.