Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
galaxy-iOS
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mobile-group
galaxy-iOS
Commits
f4eea97a
Commit
f4eea97a
authored
Jun 24, 2024
by
pete谢兆麟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录成功接口调试
parent
3fe70e89
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
187 additions
and
27 deletions
+187
-27
project.pbxproj
galaxy/galaxy.xcodeproj/project.pbxproj
+8
-0
YHBaseViewModel.swift
galaxy/galaxy/Classes/Base/C/YHBaseViewModel.swift
+6
-7
YHAllowUseMyInfoViewController.swift
.../Modules/Login(登录)/C/YHAllowUseMyInfoViewController.swift
+14
-2
YHCodeSueecssViewController.swift
...ses/Modules/Login(登录)/C/YHCodeSueecssViewController.swift
+21
-6
YHUserInfoSettingViewController.swift
...Modules/Login(登录)/C/YHUserInfoSettingViewController.swift
+21
-3
YHChangeHeadModel.swift
...alaxy/Classes/Modules/Login(登录)/M/YHChangeHeadModel.swift
+14
-0
YHUserModel.swift
galaxy/galaxy/Classes/Modules/Login(登录)/M/YHUserModel.swift
+1
-0
YHUserInfoSettingViewModel.swift
...ses/Modules/Login(登录)/VM/YHUserInfoSettingViewModel.swift
+70
-0
YHAnalytics.swift
galaxy/galaxy/Classes/Tools/Analytics/YHAnalytics.swift
+1
-1
YHAllApiName.swift
galaxy/galaxy/Classes/Tools/NetWork/YHAllApiName.swift
+6
-0
YHOSSManager.swift
galaxy/galaxy/Classes/Tools/Upload/YHOSSManager.swift
+25
-8
No files found.
galaxy/galaxy.xcodeproj/project.pbxproj
View file @
f4eea97a
...
...
@@ -299,6 +299,8 @@
04AD31772C22DE6600DF5655
/* YHEditInterestViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04AD31762C22DE6600DF5655
/* YHEditInterestViewController.swift */
;
};
04AD31792C23FFC700DF5655
/* YHInterestModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04AD31782C23FFC700DF5655
/* YHInterestModel.swift */
;
};
04AD317B2C2428CB00DF5655
/* YHPeopleSuccessView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04AD317A2C2428CB00DF5655
/* YHPeopleSuccessView.swift */
;
};
04AD317D2C295AE800DF5655
/* YHUserInfoSettingViewModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04AD317C2C295AE800DF5655
/* YHUserInfoSettingViewModel.swift */
;
};
04AD317F2C295C0300DF5655
/* YHChangeHeadModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04AD317E2C295C0300DF5655
/* YHChangeHeadModel.swift */
;
};
04AF514E2BEB585C00009E3A
/* YHVideoPlayerVC.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04AF514D2BEB585C00009E3A
/* YHVideoPlayerVC.swift */
;
};
04AF58C42B4FC51C0066011A
/* YHLocalizable.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04AF58C32B4FC51C0066011A
/* YHLocalizable.swift */
;
};
04AF82D62C25542D0028CE2A
/* YHInterestTopicLayout.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04AF82D52C25542D0028CE2A
/* YHInterestTopicLayout.swift */
;
};
...
...
@@ -857,6 +859,8 @@
04AD31762C22DE6600DF5655
/* YHEditInterestViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHEditInterestViewController.swift
;
sourceTree
=
"<group>"
;
};
04AD31782C23FFC700DF5655
/* YHInterestModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHInterestModel.swift
;
sourceTree
=
"<group>"
;
};
04AD317A2C2428CB00DF5655
/* YHPeopleSuccessView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHPeopleSuccessView.swift
;
sourceTree
=
"<group>"
;
};
04AD317C2C295AE800DF5655
/* YHUserInfoSettingViewModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHUserInfoSettingViewModel.swift
;
sourceTree
=
"<group>"
;
};
04AD317E2C295C0300DF5655
/* YHChangeHeadModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHChangeHeadModel.swift
;
sourceTree
=
"<group>"
;
};
04AF514D2BEB585C00009E3A
/* YHVideoPlayerVC.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHVideoPlayerVC.swift
;
sourceTree
=
"<group>"
;
};
04AF58C32B4FC51C0066011A
/* YHLocalizable.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHLocalizable.swift
;
sourceTree
=
"<group>"
;
};
04AF82D52C25542D0028CE2A
/* YHInterestTopicLayout.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHInterestTopicLayout.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -1954,6 +1958,7 @@
children
=
(
0468D4352B57752F00CFB916
/* YHUserModel.swift */
,
044D0BF92C215C6F00C5CF5E
/* YHSettingItem.swift */
,
04AD317E2C295C0300DF5655
/* YHChangeHeadModel.swift */
,
);
path
=
M
;
sourceTree
=
"<group>"
;
...
...
@@ -1962,6 +1967,7 @@
isa
=
PBXGroup
;
children
=
(
0468D4392B579EAC00CFB916
/* YHLoginViewModel.swift */
,
04AD317C2C295AE800DF5655
/* YHUserInfoSettingViewModel.swift */
,
);
path
=
VM
;
sourceTree
=
"<group>"
;
...
...
@@ -3356,6 +3362,7 @@
045EEF1E2B9F171A0022A143
/* YHBottomNextView.swift in Sources */
,
A567E59E2BD7643D00D5D5A0
/* YHHomePageViewController.swift in Sources */
,
045EEEBA2B9F171A0022A143
/* YHWorkResponsibilitiesTableViewCell.swift in Sources */
,
04AD317F2C295C0300DF5655
/* YHChangeHeadModel.swift in Sources */
,
A5ACE9552B4564F7002C94D2
/* YHTabBarViewController.swift in Sources */
,
045EEF0A2B9F171A0022A143
/* YHBasicInfoSessionModel.swift in Sources */
,
045EEF022B9F171A0022A143
/* YHFormItemDegreeInfoCell.swift in Sources */
,
...
...
@@ -3441,6 +3448,7 @@
045EEEA92B9F171A0022A143
/* YHWorkExperienceListViewController.swift in Sources */
,
04A7BD132BA42F4200BD35A2
/* YHMyDocumentsDetailViewController.swift in Sources */
,
04A671622BA058DE00C1FB91
/* YHCertificateEditSheetView.swift in Sources */
,
04AD317D2C295AE800DF5655
/* YHUserInfoSettingViewModel.swift in Sources */
,
04FD85682C21277800BEF9C5
/* YHMyNameCardAvatarInfoCell.swift in Sources */
,
A566A79A2C219FA400980D06
/* YHHomeSalonAreaView.swift in Sources */
,
A5ACE9432B4564F7002C94D2
/* UILable+Extension.swift in Sources */
,
...
...
galaxy/galaxy/Classes/Base/C/YHBaseViewModel.swift
View file @
f4eea97a
...
...
@@ -12,7 +12,7 @@ import Alamofire
class
YHBaseViewModel
{
// 上传方法
func
uploadImage
(
_
image
:
UIImage
,
callBackBlock
:
@escaping
(
_
success
:
String
?,
_
error
:
YHErrorModel
?)
->
())
{
func
uploadImage
(
_
image
:
UIImage
,
_
isPublic
:
Bool
=
false
,
callBackBlock
:
@escaping
(
_
success
:
String
?,
_
error
:
YHErrorModel
?)
->
())
{
#if DEBUG
let
size
=
image
.
imageSize
()
YHHUD
.
flash
(
message
:
"
\(
Float
(
size
/
1024
/
1024
)
)
M"
)
...
...
@@ -44,7 +44,7 @@ class YHBaseViewModel {
return
}
YHOSSManager
.
share
.
updateToken
{
YHOSSManager
.
share
.
putObject
(
image
:
image
)
{[
weak
self
]
success
,
error
in
YHOSSManager
.
share
.
putObject
(
image
:
image
,
isPublic
)
{[
weak
self
]
success
,
error
in
guard
let
_
=
self
else
{
return
}
DispatchQueue
.
main
.
async
{
// 在这里执行需要在主线程上完成的任务
...
...
@@ -54,8 +54,7 @@ class YHBaseViewModel {
}
}
//换取一张
func
getPublicImageUrl
(
_
url
:
String
,
callBackBlock
:
@escaping
(
_
success
:
String
?,
_
error
:
YHErrorModel
?)
->
())
{
func
getPublicImageUrl
(
_
url
:
String
,
_
isPublic
:
Bool
=
false
,
callBackBlock
:
@escaping
(
_
success
:
String
?,
_
error
:
YHErrorModel
?)
->
())
{
// let strUrl = YHBaseUrlManager.shared.curOssURL() + YHAllApiName.OSS.getPublicApi
// let param: [String: Any] = ["fileUrl": url]
// let _ = YHNetRequest.getRequest(url: strUrl, params: param) { [weak self] json, code in
...
...
@@ -80,7 +79,7 @@ class YHBaseViewModel {
return
}
YHOSSManager
.
share
.
updateToken
{
YHOSSManager
.
share
.
getPublic
(
url
:
url
,
callBackBlock
:
{
[
weak
self
]
success
,
error
in
YHOSSManager
.
share
.
getPublic
(
url
:
url
,
isPublic
,
callBackBlock
:
{
[
weak
self
]
success
,
error
in
guard
let
_
=
self
else
{
return
}
DispatchQueue
.
main
.
async
{
// 在这里执行需要在主线程上完成的任务
...
...
@@ -109,7 +108,7 @@ class YHBaseViewModel {
}
// 上传方法
func
uploadFile
(
_
url
:
String
,
callBackBlock
:
@escaping
(
_
success
:
String
?,
_
error
:
YHErrorModel
?)
->
())
{
func
uploadFile
(
_
url
:
String
,
_
isPublic
:
Bool
=
false
,
callBackBlock
:
@escaping
(
_
success
:
String
?,
_
error
:
YHErrorModel
?)
->
())
{
// let strUrl = YHBaseUrlManager.shared.curOssURL() + YHAllApiName.OSS.uploadApi
// printLog("\(url)")
// let boundary = UUID().uuidString
...
...
@@ -138,7 +137,7 @@ class YHBaseViewModel {
return
}
YHOSSManager
.
share
.
updateToken
{
YHOSSManager
.
share
.
putFile
(
file
:
url
,
callBackBlock
:
{[
weak
self
]
success
,
error
in
YHOSSManager
.
share
.
putFile
(
file
:
url
,
isPublic
,
callBackBlock
:
{[
weak
self
]
success
,
error
in
guard
let
_
=
self
else
{
return
}
DispatchQueue
.
main
.
async
{
// 在这里执行需要在主线程上完成的任务
...
...
galaxy/galaxy/Classes/Modules/Login(登录)/C/YHAllowUseMyInfoViewController.swift
View file @
f4eea97a
...
...
@@ -12,6 +12,8 @@ class YHAllowUseMyInfoViewController: YHBaseViewController {
var
tableView
:
UITableView
!
var
nextButton
:
UIButton
!
let
items
:
[
YHSettingItem
]
=
[
YHSettingItem
(
type
:
.
normal
,
title
:
"允许您的信息在名片中使用"
,
subTitle
:
"开启后,您的信息将自动同步至您的个人名片,并对您的好友公开可见"
,
isSelect
:
true
,
isShowAlert
:
false
)]
var
viewModel
:
YHUserInfoSettingViewModel
=
YHUserInfoSettingViewModel
()
var
isOpen
:
Bool
=
true
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
...
...
@@ -65,8 +67,14 @@ class YHAllowUseMyInfoViewController: YHBaseViewController {
}
@objc
func
nextStep
()
{
let
vc
=
YHInformationAuthorizationStepOneViewController
()
self
.
navigationController
?
.
pushViewController
(
vc
)
var
open
=
1
if
isOpen
{
open
=
2
}
viewModel
.
requestAuthorizationSubmit
(
agress
:
open
)
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
self
.
dismiss
(
animated
:
true
)
}
}
}
...
...
@@ -78,6 +86,10 @@ extension YHAllowUseMyInfoViewController: UITableViewDelegate, UITableViewDataSo
func
tableView
(
_
tableView
:
UITableView
,
cellForRowAt
indexPath
:
IndexPath
)
->
UITableViewCell
{
let
cell
=
tableView
.
dequeueReusableCell
(
withClass
:
YHAllowSettingTableViewCell
.
self
)
cell
.
item
=
items
[
indexPath
.
row
]
cell
.
block
=
{
[
weak
self
]
model
in
guard
let
self
=
self
else
{
return
}
self
.
isOpen
=
!
self
.
isOpen
}
return
cell
}
...
...
galaxy/galaxy/Classes/Modules/Login(登录)/C/YHCodeSueecssViewController.swift
View file @
f4eea97a
...
...
@@ -169,8 +169,13 @@ class YHCodeSueecssViewController: YHBaseViewController {
YHLoginManager
.
shared
.
loginSuccessActionBlock
?()
YHHUD
.
flash
(
message
:
"登录成功"
)
TXCommonHandler
.
sharedInstance
()
.
cancelLoginVC
(
animated
:
true
)
self
.
dismiss
(
animated
:
true
)
self
.
navigationController
?
.
popToRootViewController
(
animated
:
true
)
self
.
dismiss
(
animated
:
true
)
{
if
YHLoginManager
.
shared
.
userModel
?
.
is_first_login
==
1
{
let
vc
=
UINavigationController
(
rootVC
:
YHUserInfoSettingViewController
())
vc
.
modalPresentationStyle
=
.
fullScreen
UIViewController
.
current
?
.
present
(
vc
,
animated
:
true
)
}
}
}
})
}
...
...
@@ -185,8 +190,13 @@ class YHCodeSueecssViewController: YHBaseViewController {
YHLoginManager
.
shared
.
loginSuccessActionBlock
?()
YHHUD
.
flash
(
message
:
"登录成功"
)
TXCommonHandler
.
sharedInstance
()
.
cancelLoginVC
(
animated
:
true
)
self
.
dismiss
(
animated
:
true
)
self
.
navigationController
?
.
popToRootViewController
(
animated
:
true
)
self
.
dismiss
(
animated
:
true
)
{
if
YHLoginManager
.
shared
.
userModel
?
.
is_first_login
==
1
{
let
vc
=
UINavigationController
(
rootVC
:
YHUserInfoSettingViewController
())
vc
.
modalPresentationStyle
=
.
fullScreen
UIViewController
.
current
?
.
present
(
vc
,
animated
:
true
)
}
}
}
})
}
...
...
@@ -207,8 +217,13 @@ class YHCodeSueecssViewController: YHBaseViewController {
YHLoginManager
.
shared
.
loginSuccessActionBlock
?()
YHHUD
.
flash
(
message
:
"登录成功"
)
TXCommonHandler
.
sharedInstance
()
.
cancelLoginVC
(
animated
:
true
)
self
?
.
dismiss
(
animated
:
true
)
self
?
.
navigationController
?
.
popToRootViewController
(
animated
:
true
)
self
?
.
dismiss
(
animated
:
true
)
{
if
YHLoginManager
.
shared
.
userModel
?
.
is_first_login
==
1
{
let
vc
=
UINavigationController
(
rootVC
:
YHUserInfoSettingViewController
())
vc
.
modalPresentationStyle
=
.
fullScreen
UIViewController
.
current
?
.
present
(
vc
,
animated
:
true
)
}
}
}
}
}
...
...
galaxy/galaxy/Classes/Modules/Login(登录)/C/YHUserInfoSettingViewController.swift
View file @
f4eea97a
...
...
@@ -15,10 +15,14 @@ class YHUserInfoSettingViewController: YHBaseViewController {
var
nameLabel
:
UILabel
!
var
nameTextField
:
UITextField
!
var
nextButton
:
UIButton
!
var
viewModel
:
YHUserInfoSettingViewModel
=
YHUserInfoSettingViewModel
()
var
headUrl
:
String
=
""
var
name
:
String
=
""
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
setView
()
changeHead
()
}
func
setView
()
{
...
...
@@ -125,11 +129,20 @@ class YHUserInfoSettingViewController: YHBaseViewController {
YHImagePickerView
.
show
()
{[
weak
self
]
image
in
guard
let
self
=
self
else
{
return
}
self
.
photoImageView
.
image
=
image
self
.
viewModel
.
uploadImage
(
image
,
true
)
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
self
.
headUrl
=
success
??
""
}
}
}
@objc
func
changeHead
()
{
viewModel
.
requestChangeHead
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
self
.
headUrl
=
self
.
viewModel
.
headUrl
let
url
=
URL
(
string
:
self
.
headUrl
)
self
.
photoImageView
.
kf
.
setImage
(
with
:
url
)
}
}
@objc
func
nextStep
()
{
...
...
@@ -137,7 +150,12 @@ class YHUserInfoSettingViewController: YHBaseViewController {
YHHUD
.
flash
(
message
:
"请填写您的真实姓名"
)
return
}
let
vc
=
YHAllowUseMyInfoViewController
()
self
.
navigationController
?
.
pushViewController
(
vc
)
self
.
name
=
nameTextField
.
text
??
""
// 请求接口逻辑
viewModel
.
requestSaveUserInfo
(
head
:
headUrl
,
name
:
name
)
{[
weak
self
]
success
,
error
in
guard
let
self
=
self
else
{
return
}
let
vc
=
YHAllowUseMyInfoViewController
()
self
.
navigationController
?
.
pushViewController
(
vc
)
}
}
}
galaxy/galaxy/Classes/Modules/Login(登录)/M/YHChangeHeadModel.swift
0 → 100644
View file @
f4eea97a
//
// YHChangeHeadModel.swift
// galaxy
//
// Created by EDY on 2024/6/24.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import
UIKit
class
YHChangeHeadModel
:
YHBaseModel
{
var
avatar
:
String
=
""
}
galaxy/galaxy/Classes/Modules/Login(登录)/M/YHUserModel.swift
View file @
f4eea97a
...
...
@@ -16,6 +16,7 @@ struct YHUserModel: SmartCodable {
var
headpic
:
String
?
var
sex
:
Int
?
var
token
:
String
?
var
is_first_login
:
Int
=
0
}
struct
YHDeviceTokenModel
{
...
...
galaxy/galaxy/Classes/Modules/Login(登录)/VM/YHUserInfoSettingViewModel.swift
0 → 100644
View file @
f4eea97a
//
// YHUserInfoSettingViewModel.swift
// galaxy
//
// Created by EDY on 2024/6/24.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import
UIKit
class
YHUserInfoSettingViewModel
:
YHBaseViewModel
{
var
headUrl
:
String
=
""
func
requestChangeHead
(
callBackBlock
:
@escaping
(
_
success
:
Bool
,
_
error
:
YHErrorModel
?)
->
())
{
let
strUrl
=
YHBaseUrlManager
.
shared
.
curURL
()
+
YHAllApiName
.
People
.
change
let
_
=
YHNetRequest
.
getRequest
(
url
:
strUrl
)
{
[
weak
self
]
json
,
code
in
//1. json字符串 转 对象
guard
let
self
=
self
else
{
return
}
if
json
.
code
==
200
{
let
dic
=
json
.
data
guard
let
result
=
YHChangeHeadModel
.
deserialize
(
from
:
dic
as?
Dictionary
)
else
{
callBackBlock
(
false
,
nil
)
return
}
self
.
headUrl
=
result
.
avatar
callBackBlock
(
true
,
nil
)
}
else
{
let
error
:
YHErrorModel
=
YHErrorModel
(
errorCode
:
Int32
(
json
.
code
),
errorMsg
:
json
.
msg
)
callBackBlock
(
false
,
error
)
}
}
failBlock
:
{
err
in
callBackBlock
(
false
,
err
)
}
}
func
requestSaveUserInfo
(
head
:
String
,
name
:
String
,
callBackBlock
:
@escaping
(
_
success
:
Bool
,
_
error
:
YHErrorModel
?)
->
())
{
let
params
:
[
String
:
Any
]
=
[
"avatar"
:
head
,
"username"
:
name
]
let
strUrl
=
YHBaseUrlManager
.
shared
.
curURL
()
+
YHAllApiName
.
People
.
userSubmit
let
_
=
YHNetRequest
.
postRequest
(
url
:
strUrl
,
params
:
params
)
{
[
weak
self
]
json
,
code
in
//1. json字符串 转 对象
guard
let
_
=
self
else
{
return
}
if
json
.
code
==
200
{
callBackBlock
(
true
,
nil
)
}
else
{
let
error
:
YHErrorModel
=
YHErrorModel
(
errorCode
:
Int32
(
json
.
code
),
errorMsg
:
json
.
msg
)
callBackBlock
(
false
,
error
)
}
}
failBlock
:
{
err
in
callBackBlock
(
false
,
err
)
}
}
func
requestAuthorizationSubmit
(
agress
:
Int
,
callBackBlock
:
@escaping
(
_
success
:
Bool
,
_
error
:
YHErrorModel
?)
->
())
{
let
params
:
[
String
:
Any
]
=
[
"information_to_card"
:
agress
]
let
strUrl
=
YHBaseUrlManager
.
shared
.
curURL
()
+
YHAllApiName
.
People
.
authorizationSubmit
let
_
=
YHNetRequest
.
postRequest
(
url
:
strUrl
,
params
:
params
)
{
[
weak
self
]
json
,
code
in
//1. json字符串 转 对象
guard
let
_
=
self
else
{
return
}
if
json
.
code
==
200
{
callBackBlock
(
true
,
nil
)
}
else
{
let
error
:
YHErrorModel
=
YHErrorModel
(
errorCode
:
Int32
(
json
.
code
),
errorMsg
:
json
.
msg
)
callBackBlock
(
false
,
error
)
}
}
failBlock
:
{
err
in
callBackBlock
(
false
,
err
)
}
}
}
galaxy/galaxy/Classes/Tools/Analytics/YHAnalytics.swift
View file @
f4eea97a
...
...
@@ -17,7 +17,7 @@ class YHAnalytics {
#if DEBUG
let
options
=
SAConfigOptions
.
init
(
serverURL
:
YhConstant
.
SensorsAnalytics
.
urlForTest
,
launchOptions
:
launchOptions
)
//开启log
options
.
enableLog
=
tru
e
options
.
enableLog
=
fals
e
SensorsAnalyticsSDK
.
sharedInstance
()?
.
set
([
"evn"
:
"test"
])
#elseif TESTENV
let
options
=
SAConfigOptions
.
init
(
serverURL
:
YhConstant
.
SensorsAnalytics
.
urlForTest
,
launchOptions
:
launchOptions
)
...
...
galaxy/galaxy/Classes/Tools/NetWork/YHAllApiName.swift
View file @
f4eea97a
...
...
@@ -314,5 +314,11 @@ class YHAllApiName {
static
let
addFriendApi
=
"super-app/community/friend-application"
// 接收好友请求
static
let
receiveFriendRequestApi
=
"super-app/community/process-friend-requests"
static
let
matchUserList
=
"super-app/radar/list"
static
let
change
=
"super-app/avatar/change"
static
let
userSubmit
=
"super-app/user-base/submit"
static
let
authorizationSubmit
=
"super-app/authorization/submit"
}
}
galaxy/galaxy/Classes/Tools/Upload/YHOSSManager.swift
View file @
f4eea97a
...
...
@@ -68,7 +68,7 @@ class YHOSSManager: NSObject, URLSessionDelegate {
}
}
func
putObject
(
image
:
UIImage
,
callBackBlock
:
@escaping
(
_
success
:
String
?,
_
error
:
YHErrorModel
?)
->
())
{
func
putObject
(
image
:
UIImage
,
_
isPublic
:
Bool
=
false
,
callBackBlock
:
@escaping
(
_
success
:
String
?,
_
error
:
YHErrorModel
?)
->
())
{
let
request
=
OSSPutObjectRequest
()
let
size
=
Int
(
2
*
1024
*
1024
)
guard
let
imageData
=
image
.
compressOriginalImage
(
size
)
else
{
...
...
@@ -86,7 +86,11 @@ class YHOSSManager: NSObject, URLSessionDelegate {
dateFormatter
.
dateFormat
=
"yyyyMMdd"
let
currentDateMMdd
=
dateFormatter
.
string
(
from
:
Date
())
self
.
fileName
.
append
(
name
)
request
.
objectKey
=
"4001001"
+
"/"
+
currentDateMMdd
+
"/"
+
"
\(
name
)
"
if
isPublic
{
request
.
objectKey
=
"5000000"
+
"/"
+
currentDateMMdd
+
"/"
+
"
\(
name
)
"
}
else
{
request
.
objectKey
=
"4001001"
+
"/"
+
currentDateMMdd
+
"/"
+
"
\(
name
)
"
}
request
.
contentDisposition
=
"inline"
request
.
uploadProgress
=
{
(
bytesSent
:
Int64
,
totalBytesSent
:
Int64
,
totalBytesExpectedToSend
:
Int64
)
->
Void
in
printLog
(
"bytesSent:
\(
bytesSent
)
,totalBytesSent:
\(
totalBytesSent
)
,totalBytesExpectedToSend:
\(
totalBytesExpectedToSend
)
"
)
...
...
@@ -102,9 +106,13 @@ class YHOSSManager: NSObject, URLSessionDelegate {
let
dateFormatter
=
DateFormatter
()
dateFormatter
.
dateFormat
=
"yyyyMMdd"
let
currentDateMMdd
=
dateFormatter
.
string
(
from
:
Date
())
let
string
=
"https://"
+
self
.
model
.
bucket
+
"."
+
"oss-cn-shenzhen.aliyuncs.com/"
+
"4001001"
+
"/"
+
currentDateMMdd
+
"/"
+
"
\(
self
.
fileName
.
first
??
""
)
"
var
string
=
""
if
isPublic
{
string
=
"https://"
+
self
.
model
.
bucket
+
"."
+
"oss-cn-shenzhen.aliyuncs.com/"
+
"5000000"
+
"/"
+
currentDateMMdd
+
"/"
+
"
\(
self
.
fileName
.
first
??
""
)
"
}
else
{
string
=
"https://"
+
self
.
model
.
bucket
+
"."
+
"oss-cn-shenzhen.aliyuncs.com/"
+
"4001001"
+
"/"
+
currentDateMMdd
+
"/"
+
"
\(
self
.
fileName
.
first
??
""
)
"
}
self
.
fileName
.
removeFirst
()
print
(
"------------
\(
string
)
"
)
callBackBlock
(
string
,
YHErrorModel
())
}
return
...
...
@@ -112,7 +120,7 @@ class YHOSSManager: NSObject, URLSessionDelegate {
}
}
func
putFile
(
file
:
String
,
callBackBlock
:
@escaping
(
_
success
:
String
?,
_
error
:
YHErrorModel
?)
->
())
{
func
putFile
(
file
:
String
,
_
isPublic
:
Bool
=
false
,
callBackBlock
:
@escaping
(
_
success
:
String
?,
_
error
:
YHErrorModel
?)
->
())
{
let
request
=
OSSPutObjectRequest
()
guard
let
fileData
=
try
?
Data
(
contentsOf
:
URL
(
string
:
file
)
??
URL
(
fileURLWithPath
:
""
))
else
{
callBackBlock
(
nil
,
YHErrorModel
())
...
...
@@ -129,7 +137,11 @@ class YHOSSManager: NSObject, URLSessionDelegate {
let
dateFormatter
=
DateFormatter
()
dateFormatter
.
dateFormat
=
"yyyyMMdd"
let
currentDateMMdd
=
dateFormatter
.
string
(
from
:
Date
())
request
.
objectKey
=
"4001001"
+
"/"
+
currentDateMMdd
+
"/"
+
"
\(
name
)
"
if
isPublic
{
request
.
objectKey
=
"5000000"
+
"/"
+
currentDateMMdd
+
"/"
+
"
\(
name
)
"
}
else
{
request
.
objectKey
=
"4001001"
+
"/"
+
currentDateMMdd
+
"/"
+
"
\(
name
)
"
}
request
.
contentDisposition
=
"inline"
request
.
uploadProgress
=
{
(
bytesSent
:
Int64
,
totalBytesSent
:
Int64
,
totalBytesExpectedToSend
:
Int64
)
->
Void
in
printLog
(
"bytesSent:
\(
bytesSent
)
,totalBytesSent:
\(
totalBytesSent
)
,totalBytesExpectedToSend:
\(
totalBytesExpectedToSend
)
"
)
...
...
@@ -147,7 +159,12 @@ class YHOSSManager: NSObject, URLSessionDelegate {
let
dateFormatter
=
DateFormatter
()
dateFormatter
.
dateFormat
=
"yyyyMMdd"
let
currentDateMMdd
=
dateFormatter
.
string
(
from
:
Date
())
let
string
=
"https://"
+
self
.
model
.
bucket
+
"."
+
"oss-cn-shenzhen.aliyuncs.com/"
+
"4001001"
+
"/"
+
currentDateMMdd
+
"/"
+
"
\(
self
.
fileName
.
first
??
""
)
"
var
string
=
""
if
isPublic
{
string
=
"https://"
+
self
.
model
.
bucket
+
"."
+
"oss-cn-shenzhen.aliyuncs.com/"
+
"5000000"
+
"/"
+
currentDateMMdd
+
"/"
+
"
\(
self
.
fileName
.
first
??
""
)
"
}
else
{
string
=
"https://"
+
self
.
model
.
bucket
+
"."
+
"oss-cn-shenzhen.aliyuncs.com/"
+
"4001001"
+
"/"
+
currentDateMMdd
+
"/"
+
"
\(
self
.
fileName
.
first
??
""
)
"
}
self
.
fileName
.
removeFirst
()
callBackBlock
(
string
,
YHErrorModel
())
}
...
...
@@ -156,7 +173,7 @@ class YHOSSManager: NSObject, URLSessionDelegate {
}
}
func
getPublic
(
url
:
String
,
callBackBlock
:
@escaping
(
_
success
:
String
?,
_
error
:
YHErrorModel
?)
->
())
{
func
getPublic
(
url
:
String
,
_
isPublic
:
Bool
=
false
,
callBackBlock
:
@escaping
(
_
success
:
String
?,
_
error
:
YHErrorModel
?)
->
())
{
DispatchQueue
.
global
()
.
async
{
let
bucketName
=
self
.
getBucket
(
url
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment