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
c3e7ca4e
Commit
c3e7ca4e
authored
Oct 31, 2024
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// 阿里云日志
parent
644fd013
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
98 additions
and
7 deletions
+98
-7
YHAliYunLogManager.swift
...Classes/Modules/AliYunLog(阿里云日志)/YHAliYunLogManager.swift
+46
-7
YHAppleLoginViewModel.swift
...es/Modules/AppleLogin(苹果登录)/V/YHAppleLoginViewModel.swift
+3
-0
YHOneKeyLoginViewModel.swift
...es/Modules/AutoLogin(一键登录)/M/YHOneKeyLoginViewModel.swift
+3
-0
YHHomeHoldViewPageViewController.swift
...Modules/Home(首页)/C/YHHomeHoldViewPageViewController.swift
+14
-0
YHLoginViewModel.swift
...alaxy/Classes/Modules/Login(登录)/VM/YHLoginViewModel.swift
+31
-0
YHMySettingViewController.swift
...lasses/Modules/Mine(我的)/C/YHMySettingViewController.swift
+1
-0
No files found.
galaxy/galaxy/Classes/Modules/AliYunLog(阿里云日志)/YHAliYunLogManager.swift
View file @
c3e7ca4e
...
...
@@ -11,10 +11,7 @@ import AliyunLogProducer
enum
YHAliYunLogKey
:
String
{
case
moduleNameNetworkDataType
=
"moduleName-networkDataType"
// 网络数据
case
moduleNameH5InteractionType
=
"moduleName-h5InteractionType"
// 与H5交互相关
case
moduleNameClickType
=
"moduleName-clickType"
// 用户点点击事件
case
moduleName
=
"moduleName"
// 模块名
case
mobile
=
"mobile"
// 当前登录用户的手机号码
case
remark
=
"remark"
// 可以随意上传内容
case
timestamp
=
"timestamp"
// 时间戳
...
...
@@ -25,6 +22,12 @@ enum YHAliYunLogKey: String {
case
os_version_name
=
"os_version_name"
// 操作系统版本号
}
enum
YHModuleNameValue
:
String
{
case
networkDataType
=
"networkDataType"
// 网络数据
case
h5InteractionType
=
"h5InteractionType"
// 与H5交互相关
case
clickType
=
"clickType"
// 用户点点击事件
}
class
YHAliYunLogManager
{
static
let
SLS_ENDPOINT
=
"cn-shenzhen.log.aliyuncs.com"
...
...
@@ -57,11 +60,11 @@ class YHAliYunLogManager {
accessKeyID
:
SLS_KEY
,
accessKeySecret
:
SLS_SECRET
)
// 设置日志主题
config
?
.
setTopic
(
"example_topic"
)
//
config?.setTopic("example_topic")
// 设置日志来源。
config
?
.
setSource
(
"your new-source"
)
//
config?.setSource("your new-source")
// 设置tag信息,此tag信息将被附加在每条日志上。
config
?
.
addTag
(
"example"
,
value
:
"example_tag"
)
//
config?.addTag("example", value: "example_tag")
// 是否丢弃过期日志。0表示不丢弃,把日志时间修改为当前时间; 1表示丢弃。默认值为1。
config
?
.
setDropDelayLog
(
1
)
// 是否丢弃鉴权失败的日志,0表示不丢弃,1表示丢弃。默认值为0。
...
...
@@ -85,4 +88,40 @@ class YHAliYunLogManager {
log
.
putContent
(
"银河移动开发组效忠宣言"
,
value
:
"坚决拥护龙的领导,团结在龙的周围,凡是龙的决策,我们都坚决维护,凡是龙的指示,我们都始终不渝地遵循"
)
client
?
.
add
(
log
)
}
func
addModuleName
(
_
moduleName
:
YHModuleNameValue
,
remark
:
String
)
{
let
log
=
Log
()
addCommonInfoLog
(
log
)
log
.
putContent
(
YHAliYunLogKey
.
moduleName
.
rawValue
,
value
:
moduleName
.
rawValue
)
log
.
putContent
(
YHAliYunLogKey
.
remark
.
rawValue
,
value
:
remark
)
client
?
.
add
(
log
)
}
func
addModuleName
(
_
moduleName
:
YHModuleNameValue
,
remark
:
[
AnyHashable
:
Any
])
{
let
log
=
Log
()
addCommonInfoLog
(
log
)
log
.
putContent
(
YHAliYunLogKey
.
moduleName
.
rawValue
,
value
:
moduleName
.
rawValue
)
log
.
putContent
(
YHAliYunLogKey
.
remark
.
rawValue
,
dictValue
:
remark
)
client
?
.
add
(
log
)
}
private
func
addCommonInfoLog
(
_
log
:
Log
)
{
// 当前登录用户的手机号码
if
YHLoginManager
.
shared
.
isLogin
(),
let
mobile
=
YHLoginManager
.
shared
.
userModel
?
.
mobile
,
!
mobile
.
isEmpty
{
log
.
putContent
(
YHAliYunLogKey
.
mobile
.
rawValue
,
value
:
mobile
)
}
// 系统、平台
log
.
putContent
(
YHAliYunLogKey
.
app_platform
.
rawValue
,
value
:
"iOS"
)
// app版本号
log
.
putContent
(
YHAliYunLogKey
.
app_version
.
rawValue
,
value
:
UIDevice
.
appVersion
())
// app渠道号
log
.
putContent
(
YHAliYunLogKey
.
app_channel
.
rawValue
,
value
:
"appStore"
)
// 手机型号
log
.
putContent
(
YHAliYunLogKey
.
app_phoneModel
.
rawValue
,
value
:
UIDevice
.
iPhoneModelName
())
// 操作系统版本号
log
.
putContent
(
YHAliYunLogKey
.
os_version_name
.
rawValue
,
value
:
UIDevice
.
iPhoneVersion
())
// 当前时间戳
log
.
putContent
(
YHAliYunLogKey
.
timestamp
.
rawValue
,
value
:
String
(
Date
()
.
timeIntervalSince1970
))
}
}
galaxy/galaxy/Classes/Modules/AppleLogin(苹果登录)/V/YHAppleLoginViewModel.swift
View file @
c3e7ca4e
...
...
@@ -30,6 +30,9 @@ class YHAppleLoginViewModel: NSObject {
//数据保存到本地
YHLoginManager
.
shared
.
saveLocalUserInfo
()
let
newDic
=
dic
.
merging
([
"op_type"
:
"login"
])
{
(
current
,
_
)
in
current
}
YHAliYunLogManager
.
shared
.
addModuleName
(
.
networkDataType
,
remark
:
newDic
)
NotificationCenter
.
default
.
post
(
name
:
YhConstant
.
YhNotification
.
didLoginSuccessNotifiction
,
object
:
nil
)
callBackBlock
(
true
,
nil
)
...
...
galaxy/galaxy/Classes/Modules/AutoLogin(一键登录)/M/YHOneKeyLoginViewModel.swift
View file @
c3e7ca4e
...
...
@@ -55,6 +55,9 @@ class YHOneKeyLoginViewModel {
//数据保存到本地
YHLoginManager
.
shared
.
saveLocalUserInfo
()
let
newDic
=
dic
.
merging
([
"op_type"
:
"login"
])
{
(
current
,
_
)
in
current
}
YHAliYunLogManager
.
shared
.
addModuleName
(
.
networkDataType
,
remark
:
newDic
)
NotificationCenter
.
default
.
post
(
name
:
YhConstant
.
YhNotification
.
didLoginSuccessNotifiction
,
object
:
nil
)
//回调
...
...
galaxy/galaxy/Classes/Modules/Home(首页)/C/YHHomeHoldViewPageViewController.swift
View file @
c3e7ca4e
...
...
@@ -57,6 +57,8 @@ class YHHomeHoldViewPageViewController: YHBaseViewController {
var
needReloadDataFlag
:
Bool
=
false
let
loginViewModel
=
YHLoginViewModel
()
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
setupUI
()
...
...
@@ -361,6 +363,18 @@ extension YHHomeHoldViewPageViewController {
self
.
segmentedView
.
selectItemAt
(
index
:
itemIndex
)
self
.
listContainerView
.
didClickSelectedItem
(
at
:
itemIndex
)
}
func
getCurrentUserInfo
()
{
if
!
YHLoginManager
.
shared
.
isLogin
()
{
return
}
guard
let
mobile
=
YHLoginManager
.
shared
.
userModel
?
.
mobile
else
{
return
}
self
.
loginViewModel
.
getUserInfo
{
success
,
error
in
}
}
}
//MARK: - JXSegmentedViewDelegate
...
...
galaxy/galaxy/Classes/Modules/Login(登录)/VM/YHLoginViewModel.swift
View file @
c3e7ca4e
...
...
@@ -74,6 +74,9 @@ extension YHLoginViewModel {
//数据保存到本地
YHLoginManager
.
shared
.
saveLocalUserInfo
()
let
newDic
=
dic
.
merging
([
"op_type"
:
"login"
])
{
(
current
,
_
)
in
current
}
YHAliYunLogManager
.
shared
.
addModuleName
(
.
networkDataType
,
remark
:
newDic
)
NotificationCenter
.
default
.
post
(
name
:
YhConstant
.
YhNotification
.
didLoginSuccessNotifiction
,
object
:
nil
)
//回调
...
...
@@ -165,6 +168,9 @@ extension YHLoginViewModel {
//数据保存到本地
YHLoginManager
.
shared
.
saveLocalUserInfo
()
let
newDic
=
dic
.
merging
([
"op_type"
:
"login"
])
{
(
current
,
_
)
in
current
}
YHAliYunLogManager
.
shared
.
addModuleName
(
.
networkDataType
,
remark
:
newDic
)
NotificationCenter
.
default
.
post
(
name
:
YhConstant
.
YhNotification
.
didLoginSuccessNotifiction
,
object
:
nil
)
//回调
...
...
@@ -202,4 +208,29 @@ extension YHLoginViewModel {
callBack
?(
""
)
}
}
func
getUserInfo
(
callBackBlock
:
@escaping
(
_
success
:
Bool
,
_
error
:
YHErrorModel
?)
->
())
{
let
strUrl
=
YHBaseUrlManager
.
shared
.
curURL
()
+
YHAllApiName
.
User
.
verifyCode
let
_
=
YHNetRequest
.
postRequest
(
url
:
strUrl
)
{[
weak
self
]
json
,
code
in
guard
self
!=
nil
else
{
return
}
//1. json字符串 转 对象
if
json
.
code
==
200
{
if
let
dic
=
json
.
data
?
.
peel
as?
[
AnyHashable
:
Any
]
{
if
let
mobile
=
dic
[
"mobile"
]
as?
String
{
YHLoginManager
.
shared
.
userModel
?
.
mobile
=
mobile
}
}
callBackBlock
(
true
,
nil
)
}
else
{
let
error
:
YHErrorModel
=
YHErrorModel
(
errorCode
:
Int32
(
json
.
code
),
errorMsg
:
json
.
msg
)
callBackBlock
(
false
,
error
)
}
}
failBlock
:
{
error
in
callBackBlock
(
false
,
error
)
}
}
}
galaxy/galaxy/Classes/Modules/Mine(我的)/C/YHMySettingViewController.swift
View file @
c3e7ca4e
...
...
@@ -173,6 +173,7 @@ class YHMySettingViewController: YHBaseViewController, ConstraintRelatableTarget
if
success
{
DispatchQueue
.
main
.
async
{
YHHUD
.
flash
(
message
:
"退出成功"
)
YHAliYunLogManager
.
shared
.
addModuleName
(
.
networkDataType
,
remark
:
"logout"
)
YHLoginManager
.
shared
.
clearUserInfo
()
NotificationCenter
.
default
.
post
(
name
:
YhConstant
.
YhNotification
.
didLogoutSuccessNotifiction
,
object
:
nil
)
// 发送清空所有未读消息通知
...
...
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