Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
MiYaFastCashier
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jiangjiantao
MiYaFastCashier
Commits
b004a9e3
Commit
b004a9e3
authored
Jul 14, 2022
by
赵鹏翔
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
换肤开始处理,渠道信息通过本地资源文件进行匹配配置
parent
1e6b3443
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
134 additions
and
1 deletion
+134
-1
channel.json
app/src/main/assets/channel.json
+14
-0
MiyaApplication.kt
app/src/main/java/com/miya/fastcashier/MiyaApplication.kt
+3
-0
ChannelManageKit.java
...va/com/miya/fastcashier/util/manage/ChannelManageKit.java
+116
-0
AccountService.kt
...fastcashier/lib_common/function/account/AccountService.kt
+1
-1
No files found.
app/src/main/assets/channel.json
0 → 100644
View file @
b004a9e3
[
{
"ChannelId"
:
-1
,
"ChannelName"
:
"通用"
,
"ChannelNameDesc"
:
"common"
,
"ChannelAccountArray"
:
[]
},
{
"ChannelId"
:
1
,
"ChannelName"
:
"匡威"
,
"ChannelNameDesc"
:
"converse"
,
"ChannelAccountArray"
:
[
"6011"
,
"6013"
,
"6014"
,
"6017"
,
"6021"
]
}
]
\ No newline at end of file
app/src/main/java/com/miya/fastcashier/MiyaApplication.kt
View file @
b004a9e3
...
...
@@ -20,6 +20,7 @@ import com.fastcashier.lib_common.util.DateUtils
import
com.fastcashier.lib_common.util.LogFileUtils
import
com.miya.fastcashier.util.ContextUtils
import
com.miya.fastcashier.util.DensityUtils
import
com.miya.fastcashier.util.manage.ChannelManageKit
import
com.miya.fastcashier.util.manage.LocalKeyDataMKManageKit
import
com.miya.print.PrinterManager
import
com.sdy.miya.moblie.component.pay.core.net.MiYaPayMobileApiClient
...
...
@@ -203,5 +204,7 @@ class MiyaApplication : BaseApplication() {
OrderRecordManageKit
.
clearOrderDataYeaterday
()
//清除本地个人信息
AccountService
.
clear
()
//清除本地渠道数据信息
ChannelManageKit
.
clearChannelResData
()
}
}
\ No newline at end of file
app/src/main/java/com/miya/fastcashier/util/manage/ChannelManageKit.java
0 → 100644
View file @
b004a9e3
package
com
.
miya
.
fastcashier
.
util
.
manage
;
import
android.content.Context
;
import
android.content.res.AssetManager
;
import
android.text.TextUtils
;
import
com.fastcashier.lib_common.function.account.AccountService
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.util.Map
;
/**
* 类说明:渠道管理类(用于处理品牌全局设置,以及换肤所需渠道配置)
* 详细描述:目前通过本地资源文件加载 todo 后期能改成接口返回渠道最好
* 创建人:zpxiang
* 创建时间:
* 修改人:
* 修改时间:
*/
public
class
ChannelManageKit
{
private
static
Map
<
String
,
String
>
channelMap
;
private
static
final
long
CHANNEL_OFFICIAL_ID
=
-
1
;
private
static
final
String
CHANNEL_OFFICIAL_NAME
=
"通用"
;
/**
* 初始化本地渠道数据
*/
public
static
void
initChannelRes
(
Context
context
)
{
if
(
null
==
context
)
{
initDefaultChannelRes
();
return
;
}
String
assetsJson
=
getAssetsJson
(
context
,
"channel.json"
);
if
(
TextUtils
.
isEmpty
(
assetsJson
))
{
initDefaultChannelRes
();
return
;
}
// GsonUtils.fromJson(assetsJson);
}
private
static
void
initDefaultChannelRes
()
{
}
/**
* 获取渠道名称
*/
public
static
String
getAppChannelName
(
Context
context
)
{
if
(
channelMap
==
null
||
channelMap
.
isEmpty
())
{
initChannelRes
(
context
);
}
String
channelName
=
channelMap
.
get
(
AccountService
.
INSTANCE
.
getUserName
());
if
(
TextUtils
.
isEmpty
(
channelName
))
{
return
CHANNEL_OFFICIAL_NAME
;
}
return
channelName
;
}
/**
* 获取App渠道编号
*/
public
static
long
getAppChannelId
(
Context
context
)
{
if
(
context
==
null
)
{
return
CHANNEL_OFFICIAL_ID
;
}
if
(
channelMap
==
null
||
channelMap
.
isEmpty
())
{
initChannelRes
(
context
);
}
String
channelCode
=
channelMap
.
get
(
getAppChannelName
(
context
));
if
(
TextUtils
.
isEmpty
(
channelCode
))
{
return
CHANNEL_OFFICIAL_ID
;
}
return
Long
.
parseLong
(
channelCode
);
}
public
static
void
clearChannelResData
()
{
if
(
null
==
channelMap
)
{
return
;
}
channelMap
.
clear
();
channelMap
=
null
;
}
/**
* 读取json文件
*
* @param context
* @param fileName
* @return
*/
private
static
String
getAssetsJson
(
Context
context
,
String
fileName
)
{
StringBuilder
stringBuilder
=
new
StringBuilder
();
AssetManager
assetManager
=
context
.
getAssets
();
try
{
BufferedReader
bf
=
new
BufferedReader
(
new
InputStreamReader
(
assetManager
.
open
(
fileName
),
"UTF-8"
));
String
line
;
while
((
line
=
bf
.
readLine
())
!=
null
)
{
stringBuilder
.
append
(
line
);
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
stringBuilder
.
toString
();
}
}
lib_common/src/main/java/com/fastcashier/lib_common/function/account/AccountService.kt
View file @
b004a9e3
...
...
@@ -19,7 +19,7 @@ object AccountService {
}
fun
getUserName
():
String
{
return
userName
.
toString
()
;
return
userName
.
toString
()
}
fun
getAccountPassword
():
String
{
...
...
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