条件查询

2020-12-11  本文已影响0人  Hurricane_4283

where参数设置

        if([keyisEqualToString:@"where"]) {

            NSError*error;

            NSData*jsonData = [NSJSONSerializationdataWithJSONObject:par[key]options:0error:&error];

            NSString*jsonString = [[NSStringalloc]initWithData:jsonDataencoding:NSUTF8StringEncoding];

            NSString* hString = [jsonString stringByAddingPercentEncodingWithAllowedCharacters:  [NSCharacterSet URLUserAllowedCharacterSet]];

            searchStr = [NSStringstringWithFormat:@"%@=%@",key,hString];

其他参数拼接

else {

            if(searchStr.length==0) {

                searchStr = [NSStringstringWithFormat:@"%@=%@",key,par[key]];

            }else{

                searchStr = [NSStringstringWithFormat:@"%@&%@=%@",searchStr,key,par[key]];

            }

        }

上一篇下一篇

猜你喜欢

热点阅读