Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
base_data_channel
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
PublicSource
base_data_channel
Commits
bc0dc184
Commit
bc0dc184
authored
Nov 27, 2023
by
tongzifang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add business type
parent
f3e97fbb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
1 deletion
+19
-1
business_type.dart
lib/config/business_type.dart
+12
-0
header_interceptor.dart
lib/http/header_interceptor.dart
+7
-1
No files found.
lib/config/business_type.dart
0 → 100644
View file @
bc0dc184
enum
BusinessType
{
Cy2
(
"新饮食"
,
"66"
,
"catering"
),
Bake
(
"新休闲"
,
"18"
,
"baking"
),
MealMate
(
"新正餐"
,
"70"
,
"mealmate-apiserver"
),
;
const
BusinessType
(
this
.
prefix
,
this
.
type
,
this
.
api
);
final
String
prefix
;
final
String
type
;
final
String
api
;
}
lib/http/header_interceptor.dart
View file @
bc0dc184
import
'package:base_data_channel/config/business_type.dart'
;
import
'package:base_data_channel/http/qmai_host.dart'
;
import
'package:base_data_channel/http/qmai_host.dart'
;
import
'package:dio/dio.dart'
;
import
'package:dio/dio.dart'
;
import
'package:sp_util/sp_util.dart'
;
import
'package:sp_util/sp_util.dart'
;
...
@@ -10,7 +11,7 @@ class HeaderInterceptor extends Interceptor {
...
@@ -10,7 +11,7 @@ class HeaderInterceptor extends Interceptor {
Map
<
String
,
dynamic
>
dictionary
=
{
Map
<
String
,
dynamic
>
dictionary
=
{
'Accept'
:
'*/*; v=1.0'
,
'Accept'
:
'*/*; v=1.0'
,
'Accept-Language'
:
'Accept-Language'
:
'zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2'
,
'zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2'
,
'QM-STORE-AUTH'
:
'undefined2'
,
'QM-STORE-AUTH'
:
'undefined2'
,
'X-CSRF-TOKEN'
:
'{{csrf_token()}}'
,
'X-CSRF-TOKEN'
:
'{{csrf_token()}}'
,
'Connection'
:
'close'
,
'Connection'
:
'close'
,
...
@@ -25,6 +26,11 @@ class HeaderInterceptor extends Interceptor {
...
@@ -25,6 +26,11 @@ class HeaderInterceptor extends Interceptor {
'Qm-From'
:
'android'
,
'Qm-From'
:
'android'
,
};
};
options
.
headers
.
addAll
(
dictionary
);
options
.
headers
.
addAll
(
dictionary
);
if
(
SpUtil
.
getString
(
'businessType'
)
==
BusinessType
.
MealMate
.
type
&&
options
.
path
.
contains
(
BusinessType
.
Cy2
.
api
))
{
options
.
path
=
options
.
path
.
replaceFirst
(
BusinessType
.
Cy2
.
api
,
BusinessType
.
MealMate
.
api
);
}
super
.
onRequest
(
options
,
handler
);
super
.
onRequest
(
options
,
handler
);
}
}
}
}
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