别问楼主是什么,自己看嘿嘿,mark

Posted kaihaOS

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了别问楼主是什么,自己看嘿嘿,mark相关的知识,希望对你有一定的参考价值。

#import "XBApi.h"
#import "NSString+MD5.h"

@interface XBApi()

    XBHttpClient *http_common ;
    XBHttpClient *http_json ;


@end

@implementation XBApi

+ (instancetype)SharedXBApi

    static XBApi* xb = nil;
    static dispatch_once_t once ;
    dispatch_once(&once, ^
        xb = [[XBApi alloc] init];
    );
    return xb;


- (instancetype)init

    self = [super init];
    if (self)
    
        http_json = [[XBHttpClient alloc] init];
        AFJSONRequestSerializer* request_json = [[AFJSONRequestSerializer alloc] init];
        
        [request_json setValue:@"Mozilla/5.0 (Linux; U; android 4.2.2; zh; Coolpad Coolpad 7270/Jelly Bean) AppleWebKit/533.1 (Khtml, like Gecko) Version/4.0 Mobile Safari/533.1 CloudShopping/2.2.1" forHTTPHeaderField:@"User-Agent"];
        
        [http_json setRequestSerializer:request_json];
        
        http_common = [[XBHttpClient alloc] init];
        AFHTTPRequestSerializer* request_common = [[AFHTTPRequestSerializer alloc] init];
        
        [request_common setValue:@"Mozilla/5.0 (Linux; U; Android 4.2.2; zh; Coolpad Coolpad 7270/Jelly Bean) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 CloudShopping/2.2.1" forHTTPHeaderField:@"User-Agent"];
        
        [http_common setRequestSerializer:request_common];
    
    return self;


- (void)requestWithURL:(NSString *)url
                 paras:(NSDictionary *)parasDict
                  type:(XBHttpResponseType)type
               success:(void(^)(AFHTTPRequestOperation* operation, NSObject *resultObject))success
               failure:(void(^)(NSError *requestErr))failure

    if(type == XBHttpResponseType_Common)
    
        [http_common.requestSerializer setValue:[self reqtokenWith:url] forHTTPHeaderField:@"reqtoken"];
        [http_common requestWithURL:url paras:parasDict type:type success:success failure:failure];
    
    else
    
        [http_json.requestSerializer setValue:[self reqtokenWith:url] forHTTPHeaderField:@"reqtoken"];
        [http_json requestWithURL:url paras:parasDict type:type success:success failure:failure];
    


- (void)requestWithURL2:(NSString *)url
               referer:(NSString *)refer
                 paras:(NSDictionary *)parasDict
                  type:(XBHttpResponseType)type
               success:(void(^)(AFHTTPRequestOperation* operation, NSObject *resultObject))success
               failure:(void(^)(NSError *requestErr))failure

    if(type == XBHttpResponseType_Common)
    
        [http_common.requestSerializer setValue:[self reqtokenWith:url] forHTTPHeaderField:@"reqtoken"];
        [http_common.requestSerializer setValue:refer forHTTPHeaderField:@"Referer"];
        [http_common requestWithURL:url paras:parasDict type:type success:success failure:failure];
    
    else
    
        [http_json.requestSerializer setValue:[self reqtokenWith:url] forHTTPHeaderField:@"reqtoken"];
        [http_json.requestSerializer setValue:refer forHTTPHeaderField:@"Referer"];
        [http_json requestWithURL:url paras:parasDict type:type success:success failure:failure];
    



- (NSString *)reqtokenWith:(NSString *)url

    NSArray *arr = [url componentsSeparatedByString:@"?action="];
    NSString *str1 = [arr lastObject];
    NSArray *arr2 = [str1 componentsSeparatedByString:@"&"];
    NSString* strAction = [arr2 firstObject];
    
    NSTimeInterval timeStamp = [[NSDate date] timeIntervalSince1970];
    NSString* strTime = [NSString stringWithFormat:@"%0.f",timeStamp];
    NSString* reqtoken = [strTime stringByAppendingString:@"appReqToken@2015"];
    reqtoken = [reqtoken stringByAppendingString:strAction];
    NSString *reqtokenMD5 = [NSString md5:reqtoken];
    reqtoken = [NSString stringWithFormat:@"%@,%@,%@", strTime, strAction ,reqtokenMD5];
    NSLog(@"--------%@",reqtoken);
    return reqtoken;


@end

=============pch地址部分,很多地址不行了,没有确认过=============


/因数据涉及版权问题,故这里不做公开,请自行对(一元云购)抓包获取,谢谢
//home
#define oyImageBaseUrl      @"http://goodsimg.1yyg.com/GoodsPic/pic-400-400/"

//#define oyImageBigUrl       @"http://postimg.1yyg.com/userpost/big/"
#define oyImageBigUrl       @"http://postimg.1yyg.com/UserPost/RecHome/"

#define oyHeadBaseUrl       @"http://faceimg.1yyg.com/UserFace/"

#define oyBaseUrl           @"http://json.1yyg.com"
#define oyLoginUrl          @"http://json.1yyg.com/JPData?action=userlogin&name=%@&pwd=%@"
#define oyLoginOK           @"http://json.1yyg.com/JPData?action=loginok"
#define oyGetUserInfo       @"http://json.1yyg.com/JPData?action=getUInfo"
#define oyGetCartNum        @"http://json.1yyg.com/JPData?action=cartnum"

#define oyAdTop             @"http://json.1yyg.com/android/index?action=getADListForPage&sortID=13"
#define oyAdSearch1         @"http://json.1yyg.com/android/index?action=getADListForPage&sortID=21"
#define oyAdSearch2         @"http://json.1yyg.com/android/index?action=getADListForPage&sortID=22"
#define oyNewest            @"http://json.1yyg.com/android/index?action=getStartRaffleGoodsList&quantity=2147483647"

//#define oyOrderShow         @"http://json.1yyg.com/JPData?action=getPostPageList&FIdx=0&EIdx=3&isCount=1&order=10"

// getHomePage
#define oyOrderShow         @"http://json.1yyg.com/android/post?&action=getPostSingleDetail&postID=%d&appCode=22"

#define oyHomePage          @"http://json.1yyg.com/android/index?action=getHomePage"  //已揭晓、人气推荐、晒单分享

//product
#define oyGoodsUrl          @"http://json.1yyg.com/android/goods?brandID=0&sortID=%d&FIdx=%d&EIdx=%d&orderFlag=%d&isCount=1&action=getGoodsPageList"
#define oyGoodsDetail       @"http://json.1yyg.com/android/goods?goodsID=%d&action=getGoodsDetailPageData"

//#define oyGoodsByCodeId     @"http://json.1yyg.com/android/goods?goodsID=0&action=getGoodsPeriodList&codeID=%d"

#define oyGoodsByCodeId     @"http://json.1yyg.com/android/goods?action=getGoodsPeriodPageList&codeID=0&EIdx=60&goodsID=%d&isCount=1&FIdx=0&appCode=22"


#define oyGoodsLottery      @"http://json.1yyg.com/android/lottery?action=getRaffleBaseInfo&codeID=%d"
#define oyGoodsBuyList      @"http://json.1yyg.com/android/goods?sortType=1&action=getUserBuyListByBarcode&codeID=%d&FIdx=%d&EIdx=%d&isCount=1"

//newest
#define oyNewestedPage      @"http://json.1yyg.com/android/lottery?action=getBarcodeRaffleList&sortID=%d&EIdx=%d&isCount=1&FIdx=%d"

//user
#define oyMineUserUrl       @"http://json.1yyg.com/member/index.do"
#define oyMineBuyList       @"http://json.1yyg.com/JPData?action=getUserBuyList&FIdx=%d&EIdx=%d&isCount=1&state=%d"
#define oyMineOrderList     @"http://json.1yyg.com/JPData?action=getUserOrderList&FIdx=%d&EIdx=%d&isCount=1"
#define oyMineShowOrderList @"http://json.1yyg.com/JPData?action=getUserPostList&FIdx=%d&EIdx=%d&isCount=1"
#define oyMineMoneyUrl      @"http://json.1yyg.com/member/consumption.do"
#define oyMineMoneyOut      @"http://json.1yyg.com/JPData?action=getUserConsumption&FIdx=%d&EIdx=%d&isCount=1"
#define oyMineMoneyIn       @"http://json.1yyg.com/JPData?action=getUserRecharge&FIdx=%d&EIdx=%d&isCount=1"

//cart
#define oyCartStateUrl      @"http://json.1yyg.com/products/%d.html"
#define oyCartDetail        @"http://json.1yyg.com/mycart/index.do"
#define oyCartDelUrl        @"http://json.1yyg.com/JPData?action=delCartItem&codeID=%d"
#define oyCartAddUrl        @"http://json.1yyg.com/JPData?action=addShopCart&shopNum=%d&codeID=%d"
#define oyCartPostPay       @"http://json.1yyg.com/JPData/API.ashx/JPData?action=UserPay&integral=0&device=1"
#define oyCartPayResult     @"http://json.1yyg.com/JPData/API.ashx?action=getshopresult&t=0&id=%@"
#define oyCartPayRefer      @"http://json.1yyg.com/mycart/payment.do"

//search
#define oySearchUrl         @"http://json.1yyg.com/android/index?action=getSearchList&EIdx=100&orderFlag=1&isCount=1&FIdx=1&key=%@"

//show
#define oyShowListUrl       @"http://json.1yyg.com/android/post?action=getPostSinglePageList&order=10&isCount=1&FIdx=%d&EIdx=%d"
#define oyShowGoodsList     @"http://json.1yyg.com/android/post?action=getPageForGoodsPostSingle&goodsID=%d&isCount=1&FIdx=%d&EIdx=%d"

// 晒单详情
#define oyShowGoodsDetail   @"http://json.1yyg.com/android/post?postID=%d&action=getPostSingleDetail"

#define oyShowReplyUrl      @"http://json.1yyg.com/android/post?postID=59580&action=getPostReplyGetByID&EIdx=6&isCount=1&FIdx=1"

//getproduct step
#define oyTransUrl          @"http://json.1yyg.com/member/orderdetail-%d.do"
#define oyComfirmOrder      @"http://json.1yyg.com/JPData?action=confirmAddr&oid=%d&cid=%d"
#define oyComfirmShip       @"http://json.1yyg.com/JPData?action=confirmShiped&oid=%d"

//reg
#define oyRegPhoneSms       @"http://json.1yyg.com/android/Register?action=sendSMS&mobile=%@"
#define oyRegPhoneCode      @"https://json.1yyg.com/JPData?action=mobileregsn&mobile=%@&sn=%@"
#define oyRegRefer          @"http://json.1yyg.com/passport/mobilecheck.html?mobile=%@"
#define oyRegSetPwd         @"https://json.1yyg.com/JPData?action=mobileregsiter&str=%@&pwd=%@"
#define oyRegSetPwdRefer    @"http://json.1yyg.com/passport/mobilesave.html?str=%@"
#define oyRegOkUrl          @"http://json.1yyg.com/JPData?action=mobileok"

//address
#define oyAddressUrl        @"http://json.1yyg.com/JPData?action=getMemberContactList"
#define oyAddressRefer      @"http://json.1yyg.com/Address.do"
#define oyAddressDel        @"http://json.1yyg.com/JPData?action=deleteMemberContact&contactID=%d"
#define oyAddreasAddUrl     @"http://json.1yyg.com/JPData"

//area
#define oyAreaGetUrl        @"http://json.1yyg.com/JPData?action=getAreaChildNodes&areaID=%d"
#define oyAreaDefaultUrl    @"http://json.1yyg.com/JPData?action=setMemberContactDefault&contactID=%d"



===========晒单分享,添加字段=====
===========HomeOrderShowCell=====

- (void)setOrderShows:(NSArray*)listHomepage

    /*
    if([HomeInstance ShardInstnce].listOrderShows)
    
        [vShow1 setOrderShow:[[HomeInstance ShardInstnce].listOrderShows.listItems objectAtIndex:0]];
        [vShow2 setOrderShow:[[HomeInstance ShardInstnce].listOrderShows.listItems objectAtIndex:1]];
        [vShow3 setOrderShow:[[HomeInstance ShardInstnce].listOrderShows.listItems objectAtIndex:2]];
    
     */
    
    if (listHomepage.count > 0) 
        [vShow1 setOrderShow:[listHomepage objectAtIndex:0]];
        [vShow2 setOrderShow:[listHomepage objectAtIndex:1]];
        [vShow3 setOrderShow:[listHomepage objectAtIndex:2]];
    


===========HomeOrderShowView===========

- (void)setOrderShow:(HomeOrderShowItem *)order


//    NSString* name = order.postAllPic;
//    if ([name rangeOfString:@","].location > 0)
//        name = [name substringToIndex:[name rangeOfString:@","].location];
    
    NSString* name = order.postImg;
    
    [imgPro setImage_oy:oyImageBigUrl image:name];
    
    [lblTitle setText:[order.postTitle stringByReplacingOccurrencesOfString:@" " withString:@" "]];
    CGSize s = [lblTitle.text textSizeWithFont:lblTitle.font constrainedToSize:CGSizeMake(MAXFLOAT, 999) lineBreakMode:NSLineBreakByCharWrapping];
    CGFloat w = s.width;
    if(w > self.bounds.size.width)
        w = self.bounds.size.width;
    lblTitle.frame = CGRectMake((self.bounds.size.width - w) / 2, self.bounds.size.height - s.height - 5, w, s.height);
    


===========HomeModel===========
===========HomeOrderShowView 添加postImg字段;

@protocol  HomeOrderShowItem <NSObject>
@end
@interface HomeOrderShowItem : OneBaseParser
@property (nonatomic,copy)NSString* postImg;
@property (nonatomic,copy)NSNumber* postID;
@property (nonatomic,copy)NSString* postTitle;
@property (nonatomic,copy)NSString* postTime;

@property (nonatomic,copy)NSString* postAllPic;
@property (nonatomic,copy)NSString* postContent;
@property (nonatomic,copy)NSString* userPhoto;
@property (nonatomic,copy)NSString* userName;
@property (nonatomic,copy)NSString* userWeb;

@property (nonatomic,copy)NSNumber* postHits;
@property (nonatomic,copy)NSNumber* postReplyCount;
@end

以上是关于别问楼主是什么,自己看嘿嘿,mark的主要内容,如果未能解决你的问题,请参考以下文章

汤不热分享动画

ue4蓝图类的事件图标是只读,无法编辑怎么办 只看楼主收藏回复

这交互炸了:爱范儿是如何让详情页缩小为横向列表的

android http通信之HttpURLConnection post乱码问题

程序员眼里搜索引擎哪家强?别问,点进来偷偷收藏!

怎么看视频比特率?