Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
gm_flutter
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
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
林生雨
gm_flutter
Commits
955bbd5d
Commit
955bbd5d
authored
Jul 14, 2020
by
林生雨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
186bb428
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
138 additions
and
46 deletions
+138
-46
PlanModel.dart
lib/ClueModel/page/plan/PlanModel.dart
+1
-1
PlanPage.dart
lib/ClueModel/page/plan/PlanPage.dart
+4
-4
MainManager.dart
lib/MainRouter/manager/MainManager.dart
+11
-11
NetProxyPage.dart
lib/MainRouter/page/proxy/NetProxyPage.dart
+6
-5
MainApi.dart
lib/MainRouter/service/remote/api/MainApi.dart
+5
-0
MainApi.serv.dart
lib/MainRouter/service/remote/api/MainApi.serv.dart
+18
-0
CityBean.dart
lib/MainRouter/service/remote/entity/CityBean.dart
+66
-0
App.dart
lib/commonModel/App.dart
+24
-23
Api.dart
lib/commonModel/net/Api.dart
+2
-1
DioUtil.dart
lib/commonModel/net/DioUtil.dart
+1
-1
No files found.
lib/ClueModel/page/plan/PlanModel.dart
View file @
955bbd5d
...
...
@@ -12,6 +12,7 @@ import 'package:gm_flutter/ClueModel/page/plan/PlanModelInstance.dart';
import
'package:gm_flutter/ClueModel/server/api/ClueApi.serv.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/PlanBean.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/PlanFeedBean.dart'
;
import
'package:gm_flutter/commonModel/App.dart'
;
import
'package:gm_flutter/commonModel/GMBase.dart'
;
import
'package:gm_flutter/commonModel/bean/Pair.dart'
;
import
'package:gm_flutter/commonModel/cache/CacheManager.dart'
;
...
...
@@ -130,7 +131,6 @@ class PlanModel extends BaseModel {
})
.
addToDispose
(
rxDispose
)
.
onError
((
err
)
{
print
(
"ERROR12WCCCCCC
${err.toString()}
"
);
PrintUtil
.
printBug
(
err
);
stateLive
.
notifyView
(
FAIL
);
});
...
...
lib/ClueModel/page/plan/PlanPage.dart
View file @
955bbd5d
...
...
@@ -64,7 +64,9 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
@override
void
initState
()
{
if
(
RouterCenterImpl
().
findMainRouter
().
isWithNative
()
&&
super
.
initState
();
if
(
bool
.
fromEnvironment
(
"dart.vm.product"
)
&&
Platform
.
isIOS
&&
CacheManager
.
getInstance
().
get
(
MEMORY_CACHE
).
get
(
BASE_URL
)
==
null
)
{
func
=
(
str
)
{
if
(
str
==
"init"
)
{
...
...
@@ -72,10 +74,8 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
}
};
SimpleEventBus
.
instance
().
resignEvent
(
"clueModel|Plan|PlanPage"
,
func
);
}
else
{
_model
.
init
(
needCache:
true
);
}
super
.
initState
(
);
_model
.
init
(
needCache:
true
);
planBarView
=
PlanBarView
(
_model
.
managerLive
,
clickIndex
,
hideAllMenuListener
);
}
...
...
lib/MainRouter/manager/MainManager.dart
View file @
955bbd5d
...
...
@@ -74,20 +74,20 @@ class MainManager {
innerSetData
(
map
,
USER_AGENT
);
innerSetData
(
map
,
BASE_URL
);
if
(
map
[
BASE_URL
]
!=
null
)
{
DioUtil
.
getInstance
();
DioUtil
.
setDefOptions
(
baseUrl:
"
${map[BASE_URL]}
/"
,
agent:
map
[
USER_AGENT
]);
DioUtil
.
getInstance
().
changeOpt
();
DioUtil
.
getInstance
();
if
(
bool
.
fromEnvironment
(
"dart.vm.product"
))
{
if
(
map
[
BASE_URL
]
!=
null
&&
map
[
BASE_URL
]
!=
Api
.
getInstance
().
getBaseUrl
())
{
CacheManager
.
getInstance
().
get
(
MEMORY_CACHE
).
save
(
URL_ISCHANE
,
"yes"
);
DioUtil
.
setDefOptions
(
baseUrl:
"
${map[BASE_URL]}
/"
,
agent:
map
[
USER_AGENT
]);
DioUtil
.
getInstance
().
changeOpt
();
SimpleEventBus
.
instance
()
.
notifyListener
(
"clueModel|Plan|PlanPage"
,
"init"
);
}
}
SimpleEventBus
.
instance
().
notifyListener
(
"clueModel|Plan|PlanPage"
,
"init"
);
// if (map[COOKIE] == null) {
// CacheManager.getInstance().get(MEMORY_CACHE).save(COOKIE,
// "_gm_token=1da6071594101423; csrftoken=rUrkkYYMOVZfIIQnU2IH09QIGmsfe8tE; sessionid=uz7f70uap76r6og48znci5l2hbr9vm5c; _gtid=5af9a5deba8511ea8d4082a085c393c93393");
// } else {
innerSetData
(
map
,
COOKIE
);
// }
if
(
map
[
USER_ID
]
==
null
||
"
${map[USER_ID]}
"
.
isEmpty
)
{
CacheManager
.
getInstance
().
get
(
MEMORY_CACHE
).
save
(
USER_ID
,
null
);
}
...
...
lib/MainRouter/page/proxy/NetProxyPage.dart
View file @
955bbd5d
...
...
@@ -27,9 +27,9 @@ class NetProxyState extends BaseState<NetProxyPage> {
appBar:
baseAppBar
(
centerTitle:
true
,
backClick:
()
{
if
(
RouterCenterImpl
().
findMainRouter
().
isWithNative
())
{
if
(
RouterCenterImpl
().
findMainRouter
().
isWithNative
())
{
FlutterBoost
.
singleton
.
closeCurrent
();
}
else
{
}
else
{
Navigator
.
of
(
context
).
pop
();
}
},
...
...
@@ -50,9 +50,10 @@ class NetProxyState extends BaseState<NetProxyPage> {
InkWell
(
onTap:
()
{
MainApiImpl
.
getInstance
()
.
isOk
(
DioUtil
.
getInstance
().
getDio
())
.
listen
((
event
)
{}).
onError
((
error
){
print
(
"LSYQQ
${error.toString()}
"
);
.
getCity
(
DioUtil
.
getInstance
().
getDio
())
.
listen
((
event
)
{})
.
onError
((
error
)
{
print
(
"LSYQQ
${error.toString()}
"
);
});
},
child:
Container
(
...
...
lib/MainRouter/service/remote/api/MainApi.dart
View file @
955bbd5d
...
...
@@ -4,10 +4,14 @@
**/
import
'package:flutter_common/Annotations/anno/Get.dart'
;
import
'package:flutter_common/Annotations/anno/ServiceCenter.dart'
;
import
'package:gm_flutter/MainRouter/service/remote/entity/CityBean.dart'
;
import
'package:gm_flutter/MainRouter/service/remote/entity/TestBean.dart'
;
@ServiceCenter
()
abstract
class
MainApi
{
@Get
(
"api/demo/test"
)
TestBean
isOk
();
@Get
(
"api/city/located"
)
CityBean
getCity
();
}
\ No newline at end of file
lib/MainRouter/service/remote/api/MainApi.serv.dart
View file @
955bbd5d
...
...
@@ -15,6 +15,7 @@ import 'package:dio/dio.dart';
import
'package:flutter/foundation.dart'
;
import
'package:gm_flutter/MainRouter/service/remote/entity/TestBean.dart'
;
import
'package:gm_flutter/MainRouter/service/remote/entity/CityBean.dart'
;
const
bool
inProduction
=
const
bool
.
fromEnvironment
(
"dart.vm.product"
);
...
...
@@ -45,6 +46,19 @@ class MainApiImpl {
});
}
Stream
<
CityBean
>
getCity
(
Dio
_dio
,
)
{
return
Stream
.
fromFuture
(
get
(
_dio
,
'api/city/located'
)).
flatMap
((
value
)
{
if
(
value
!=
null
&&
(
value
.
statusCode
>=
200
&&
value
.
statusCode
<
300
))
{
return
Stream
.
fromFuture
(
compute
(
parseCityBean
,
value
.
toString
()));
}
else
{
throw
Exception
(
"--未知网络错误--"
);
}
});
}
///==================base method==================
Future
<
Response
>
get
(
Dio
_dio
,
url
,
{
data
,
options
,
cancelToken
})
async
{
...
...
@@ -185,3 +199,7 @@ class MainApiImpl {
TestBean
parseTestBean
(
String
value
)
{
return
TestBean
.
fromJson
(
json
.
decode
(
value
));
}
CityBean
parseCityBean
(
String
value
)
{
return
CityBean
.
fromJson
(
json
.
decode
(
value
));
}
lib/MainRouter/service/remote/entity/CityBean.dart
0 → 100644
View file @
955bbd5d
/*
* @author lsy
* @date 2020/7/14
**/
class
CityBean
{
String
message
;
Extra
extra
;
Data
data
;
int
error
;
CityBean
({
this
.
message
,
this
.
extra
,
this
.
data
,
this
.
error
});
CityBean
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
message
=
json
[
'message'
];
extra
=
json
[
'extra'
]
!=
null
?
new
Extra
.
fromJson
(
json
[
'extra'
])
:
null
;
data
=
json
[
'data'
]
!=
null
?
new
Data
.
fromJson
(
json
[
'data'
])
:
null
;
error
=
json
[
'error'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'message'
]
=
this
.
message
;
if
(
this
.
extra
!=
null
)
{
data
[
'extra'
]
=
this
.
extra
.
toJson
();
}
if
(
this
.
data
!=
null
)
{
data
[
'data'
]
=
this
.
data
.
toJson
();
}
data
[
'error'
]
=
this
.
error
;
return
data
;
}
}
class
Extra
{
Extra
();
Extra
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
return
data
;
}
}
class
Data
{
String
cityId
;
String
cityName
;
Data
({
this
.
cityId
,
this
.
cityName
});
Data
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
cityId
=
json
[
'city_id'
];
cityName
=
json
[
'city_name'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'city_id'
]
=
this
.
cityId
;
data
[
'city_name'
]
=
this
.
cityName
;
return
data
;
}
}
lib/commonModel/App.dart
View file @
955bbd5d
...
...
@@ -2,30 +2,31 @@
* @author lsy
* @date 2020/7/6
**/
const
String
APP_NAME
=
"app_name"
;
const
String
VERSION
=
"version"
;
const
String
PLATFORM
=
"platform"
;
const
String
DEVICE_ID
=
"device_id"
;
const
String
OS_VERSION
=
"os_version"
;
const
String
MODEL
=
"model"
;
const
String
SCREEN
=
"screen"
;
const
String
LAT
=
"lat"
;
const
String
LNG
=
"lng"
;
const
String
CHANNEL
=
"channel"
;
const
String
MANUFACTURER
=
"manufacturer"
;
const
String
UUID
=
"uuid"
;
const
String
ANDROID_DEVICE_ID
=
"android_device_id"
;
const
String
CURRENT_CITY_ID
=
"current_city_id"
;
const
String
RELEASE
=
"release"
;
const
String
IDFA
=
"idfa"
;
const
String
IDFV
=
"idfv"
;
const
String
IS_WIFI
=
"is_WiFi"
;
const
String
HARDWARE_MODEL
=
"hardware_model"
;
const
String
APP_NAME
=
"app_name"
;
const
String
VERSION
=
"version"
;
const
String
PLATFORM
=
"platform"
;
const
String
DEVICE_ID
=
"device_id"
;
const
String
OS_VERSION
=
"os_version"
;
const
String
MODEL
=
"model"
;
const
String
SCREEN
=
"screen"
;
const
String
LAT
=
"lat"
;
const
String
LNG
=
"lng"
;
const
String
CHANNEL
=
"channel"
;
const
String
MANUFACTURER
=
"manufacturer"
;
const
String
UUID
=
"uuid"
;
const
String
ANDROID_DEVICE_ID
=
"android_device_id"
;
const
String
CURRENT_CITY_ID
=
"current_city_id"
;
const
String
RELEASE
=
"release"
;
const
String
IDFA
=
"idfa"
;
const
String
IDFV
=
"idfv"
;
const
String
IS_WIFI
=
"is_WiFi"
;
const
String
HARDWARE_MODEL
=
"hardware_model"
;
//head
const
String
USER_AGENT
=
"User-Agent"
;
const
String
COOKIE
=
"cookie"
;
const
String
USER_AGENT
=
"User-Agent"
;
const
String
COOKIE
=
"cookie"
;
//user
const
String
USER_ID
=
"user_id"
;
const
String
BASE_URL
=
"base_url"
;
const
String
USER_ID
=
"user_id"
;
const
String
BASE_URL
=
"base_url"
;
const
String
URL_ISCHANE
=
"URL_ISCHANE"
;
lib/commonModel/net/Api.dart
View file @
955bbd5d
...
...
@@ -21,6 +21,7 @@ const String APP_HOST_RELEASE = "https://backend.igengmei.com";
//const String APP_HOST_DEBUG = "http://doctor.paas-merchant.env";
// const String APP_HOST_DEBUG = "https://x6cgr5y5-gengmei.mock.coding.io";
const
String
APP_HOST_DEBUG
=
"http://backend.paas-merchant.env"
;
//const String APP_HOST_DEBUG = "https://backend.igengmei.com";
//const String APP_HOST_DEBUG = "http://janus.paas-merchant.env";
/**
...
...
@@ -41,7 +42,7 @@ class Api {
}
String
getBaseUrl
()
{
if
(
!
isDebug
)
{
if
(
bool
.
fromEnvironment
(
"dart.vm.product"
)
)
{
return
APP_HOST_RELEASE
;
}
else
{
return
APP_HOST_DEBUG
;
...
...
lib/commonModel/net/DioUtil.dart
View file @
955bbd5d
...
...
@@ -72,7 +72,7 @@ class DioUtil {
headers
[
'User-Agent'
]
=
agent
;
}
_options
.
headers
=
headers
;
print
(
"ISEMPTY ??
${baseUrl}
"
);
print
(
"ISEMPTY ??
${baseUrl}
${Api.getInstance().getBaseUrl()}
"
);
_options
.
baseUrl
=
baseUrl
??
"
${Api.getInstance().getBaseUrl()}
/"
;
}
}
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