123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- //
- // RQURLParameters.m
- // RQCommon
- //
- // Created by 张嵘 on 2018/11/16.
- // Copyright © 2018 张嵘. All rights reserved.
- //
- #import "RQURLParameters.h"
- #import "RQHTTPService.h"
- @implementation SBURLExtendsParameters
- + (instancetype)extendsParameters
- {
- return [[self alloc] init];
- }
- - (instancetype)init
- {
- self = [super init];
- if (self) {
- }
- return self;
- }
- - (NSString *)ver{
- static NSString *version = nil;
- if (version == nil) version = [NSBundle mainBundle].infoDictionary[@"CFBundleShortVersionString"];
- return (version.length>0)?version:@"";
- }
- - (NSString *)token {
- // NSString *uid = self.uid;
- // if (RQStringIsNotEmpty(uid) && RQStringIsNotEmpty([RQHTTPService sharedInstance].token)){
- // NSString *t_token = [NSString stringWithFormat:@"%@-%@",uid,[RQHTTPService sharedInstance].token];
- // return t_token;
- // }
- return @"";//[RQHTTPService sharedInstance].token;
- }
- - (NSString *)deviceid {
- static NSString *deviceidStr = nil;
- if (deviceidStr == nil) deviceidStr = [SAMKeychain deviceId];
- return deviceidStr.length>0?deviceidStr:@"";
- }
- - (NSString *)platform{
- return @"iOS";
- }
- - (NSString *)channel{
- return @"AppStore";
- }
- - (NSString *)t {
- return [NSString stringWithFormat:@"%.f", [NSDate date].timeIntervalSince1970];
- }
- @end
- @implementation RQURLParameters
- + (instancetype)urlParametersWithMethod:(NSString *)method path:(NSString *)path parameters:(NSDictionary *)parameters {
- //控制-测试环境
- if(!isOfficial){
- path = [path stringByReplacingOccurrencesOfString:@"jsjp-admin.zzxcx.net" withString:@"jsjp-admin1.zzxcx.net"];
- // path = [path stringByReplacingOccurrencesOfString:@"https://jsjp-admin.zzxcx.net" withString:@"http://192.168.31.101:8080"];
- // path = [path stringByReplacingOccurrencesOfString:@"/jsjp-admin" withString:@""];
- // path = [path stringByReplacingOccurrencesOfString:@"userInfo/vip/info" withString:@"gzpt/userInfo/vip/info"];
-
- }
- return [[self alloc] initUrlParametersWithMethod:method path:path parameters:parameters];
- }
- - (instancetype)initUrlParametersWithMethod:(NSString *)method path:(NSString *)path parameters:(NSDictionary *)parameters {
- self = [super init];
- if (self) {
- self.method = method;
- self.path = path;
- self.parameters = parameters;
- self.extendsParameters = [[SBURLExtendsParameters alloc] init];
- }
- return self;
- }
- @end
|