更换存储

This commit is contained in:
liyuhua
2024-03-25 15:28:15 +08:00
parent 6d450443d0
commit 348e2b14a4
9 changed files with 133 additions and 5 deletions

View File

@@ -76,6 +76,7 @@ target 'YuMi' do
pod 'WMZDropDownMenu'
pod 'TABAnimated'
pod 'YuMi',:path=>'yum'
pod 'QCloudCOSXML'
end
post_install do |installer|

View File

@@ -304,6 +304,7 @@
239141C92AE1358F00322CA9 /* PIInputEntireServerScrollingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 239141C82AE1358F00322CA9 /* PIInputEntireServerScrollingView.m */; };
239141CC2AE267EF00322CA9 /* PIReceiveRedPacketSuccessView.m in Sources */ = {isa = PBXBuildFile; fileRef = 239141CB2AE267EF00322CA9 /* PIReceiveRedPacketSuccessView.m */; };
23942E912A86424500D0ECC2 /* XPLoginAuthCodeVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 23942E902A86424500D0ECC2 /* XPLoginAuthCodeVC.m */; };
23959FE72BB15C930085A282 /* UploadFileModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 23959FE62BB15C930085A282 /* UploadFileModel.m */; };
2396FCE42B22BE5D0014021D /* pi_area_info.json in Resources */ = {isa = PBXBuildFile; fileRef = 2396FCE32B22BE5D0014021D /* pi_area_info.json */; };
239BEEDB2AA1E058005CDA94 /* PIHoemCategoryTitleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 239BEEDA2AA1E058005CDA94 /* PIHoemCategoryTitleView.m */; };
23A03F2D2B4408CD0094227A /* pi_room_lucky_gift.svga in Resources */ = {isa = PBXBuildFile; fileRef = 23A03F2C2B4408CD0094227A /* pi_room_lucky_gift.svga */; };
@@ -2080,6 +2081,8 @@
239141CB2AE267EF00322CA9 /* PIReceiveRedPacketSuccessView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PIReceiveRedPacketSuccessView.m; sourceTree = "<group>"; };
23942E8F2A86424500D0ECC2 /* XPLoginAuthCodeVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPLoginAuthCodeVC.h; sourceTree = "<group>"; };
23942E902A86424500D0ECC2 /* XPLoginAuthCodeVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPLoginAuthCodeVC.m; sourceTree = "<group>"; };
23959FE52BB15C930085A282 /* UploadFileModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UploadFileModel.h; sourceTree = "<group>"; };
23959FE62BB15C930085A282 /* UploadFileModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UploadFileModel.m; sourceTree = "<group>"; };
2396FCE32B22BE5D0014021D /* pi_area_info.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = pi_area_info.json; sourceTree = "<group>"; };
239BEED92AA1E058005CDA94 /* PIHoemCategoryTitleView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PIHoemCategoryTitleView.h; sourceTree = "<group>"; };
239BEEDA2AA1E058005CDA94 /* PIHoemCategoryTitleView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PIHoemCategoryTitleView.m; sourceTree = "<group>"; };
@@ -6128,8 +6131,10 @@
9B33E3C827D85379003B0E62 /* File */ = {
isa = PBXGroup;
children = (
9B33E3C927D85379003B0E62 /* UploadFile.m */,
9B33E3CA27D85379003B0E62 /* UploadFile.h */,
9B33E3C927D85379003B0E62 /* UploadFile.m */,
23959FE52BB15C930085A282 /* UploadFileModel.h */,
23959FE62BB15C930085A282 /* UploadFileModel.m */,
);
path = File;
sourceTree = "<group>";
@@ -11300,6 +11305,7 @@
189DD68426E1FDBB00AB55B1 /* XNDJTDDLoadingTool.m in Sources */,
9B1B72AF280031F8003FACE9 /* XPAnchorPKSelectRoomView.m in Sources */,
E818DD1C2A4896EE00F163F7 /* XPLoginAraeViewController.m in Sources */,
23959FE72BB15C930085A282 /* UploadFileModel.m in Sources */,
E8D4824A278D1F73003C1D08 /* XPAcrossRoomPKInviteView.m in Sources */,
E85E7B432A4EB0D300B6D00A /* XPMineExchangeAuthorityHeadView.m in Sources */,
23194DD02AD14BF000649F51 /* DDLog.m in Sources */,

View File

@@ -7,6 +7,7 @@
#import "AppDelegate+ThirdConfig.h"
///Third
#import <QCloudCOSXML/QCloudCOSXML.h>
#import <NIMSDK/NIMSDK.h>
#import <ShareSDK/ShareSDK.h>
#import <UserNotifications/UNUserNotificationCenter.h>
@@ -66,6 +67,9 @@ UIKIT_EXTERN NSString * adImageName;
}];
}
}
-(void)initQCloud{
}
/**
Bugly

View File

@@ -345,6 +345,8 @@ NS_ASSUME_NONNULL_BEGIN
/// - roomUid: 房间id
/// - type: 1=房间
+(void)requestUnmaskingFromBlackRoomList:(HttpRequestHelperCompletion)completion objId:(NSString *)objId type:(NSString *)type ;
///得到腾讯存储信息
+ (void)getQCloudInfo:(HttpRequestHelperCompletion)completion;
@end
NS_ASSUME_NONNULL_END

View File

@@ -139,7 +139,10 @@
NSString * fang = [NSString stringFromBase64String:@"cWluaXUvdXBsb2FkL2dldFVwbG9hZFRva2Vu"];///qiniu/upload/getUploadToken
[self makeRequest:fang method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, nil];
}
///
+ (void)getQCloudInfo:(HttpRequestHelperCompletion)completion{
[self makeRequest:@"tencent/cos/getToken" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, nil];
}
///
/// @param completion

View File

@@ -10,7 +10,7 @@
NS_ASSUME_NONNULL_BEGIN
@interface UploadFile : NSObject
+ (instancetype)share;
/// 上传一个文件
/// @param filePath 文件地址
/// @param fileName 文件的名字

View File

@@ -4,12 +4,89 @@
//
// Created by GreenLand on 2022/2/23.
//
#import <QCloudCOSXML/QCloudCOSXML.h>
#import "UploadFile.h"
#import <Qiniu/QiniuSDK.h>
#import <AFNetworking.h>
#import "Api+Mine.h"
#import "UploadFileModel.h"
static UploadFile* manager;
@interface UploadFile()<QCloudSignatureProvider>
@property(nonatomic,strong) UploadFileModel *fileModel;
@end
@implementation UploadFile
+ (instancetype)share {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
manager = [[UploadFile alloc] init];
});
return manager;
}
-(void)initQCloud{
[Api getQCloudInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200){
UploadFileModel *fileModel = [UploadFileModel modelWithDictionary:data.data];
self.fileModel = fileModel;
QCloudServiceConfiguration* configuration = [QCloudServiceConfiguration new];
QCloudCOSXMLEndPoint* endpoint = [[QCloudCOSXMLEndPoint alloc] init];
endpoint.regionName = fileModel.region;
// 使 HTTPS
endpoint.useHTTPS = true;
configuration.endpoint = endpoint;
//
configuration.signatureProvider = self;
// COS
[QCloudCOSXMLService registerDefaultCOSXMLWithConfiguration:configuration];
[QCloudCOSTransferMangerService registerDefaultCOSTransferMangerWithConfiguration:
configuration];
}
}];
}
#pragma mark- QCloudSignatureProvider
- (void) signatureWithFields:(QCloudSignatureFields*)fileds
request:(QCloudBizHTTPRequest*)request
urlRequest:(NSMutableURLRequest*)urlRequst
compelete:(QCloudHTTPAuthentationContinueBlock)continueBlock
{
QCloudCredential* credential = [QCloudCredential new];
// SecretId
// sercret_id SecretId访https://console.cloud.tencent.com/cam/capi
credential.secretID = self.fileModel.secretId;
// SecretKey
// sercret_key SecretKey访https://console.cloud.tencent.com/cam/capi
credential.secretKey = self.fileModel.secretKey;
// Token
// 使token使使https://cloud.tencent.com/document/product/436/14048
credential.token = self.fileModel.sessionToken;
/** , (startTimeexpiredTime)
*/
credential.startDate = [NSDate dateWithTimeIntervalSince1970:self.fileModel.startTime]; //
credential.expirationDate = [NSDate dateWithTimeIntervalSince1970:self.fileModel.startTime];//
QCloudAuthentationV5Creator* creator = [[QCloudAuthentationV5Creator alloc]
initWithCredential:credential];
// urlRequst copymutableCopy
QCloudSignature *signature = [creator signatureForData:urlRequst];
continueBlock(signature, nil);
}
//zoneAs0
///
/// @param filePath

View File

@@ -0,0 +1,23 @@
//
// UploadFileModel.h
// YuMi
//
// Created by duoban on 2024/3/25.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface UploadFileModel : NSObject
@property(nonatomic,copy) NSString *secretId;
@property(nonatomic,copy) NSString *secretKey;
@property(nonatomic,copy) NSString *sessionToken;
@property(nonatomic,copy) NSString *bucket;
@property(nonatomic,copy) NSString *region;
@property(nonatomic,copy) NSString *customDomain;
@property(nonatomic,assign) long startTime;
@property(nonatomic,assign) long expireTime;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,12 @@
//
// UploadFileModel.m
// YuMi
//
// Created by duoban on 2024/3/25.
//
#import "UploadFileModel.h"
@implementation UploadFileModel
@end