王亚玲 2 years ago
commit 0e0fc1052b

@ -23,19 +23,19 @@ class API {
static String get baseURL => '$host'; static String get baseURL => '$host';
static _Manager manager = _Manager(); static _App app = _App();
static _Pay pay = _Pay(); static _Pay pay = _Pay();
} }
class _Manager { class _App {
String get login => '/manage/login'; String get login => '/app/login';
String get logout => '/manage/login/logout'; String get logout => '/app/login/logout';
String get captcha => '/manage/captcha'; String get captcha => '/app/captcha';
String get info => '/manage/user/info'; String get info => '/app/user/info';
} }
class _Pay { class _Pay {
String get wxpay => '/manage/pay/wxpay'; String get wxpay => '/app/pay/wxpay';
String get alipay => '/manage/pay/alipay'; String get alipay => '/app/pay/alipay';
String get wxCallback => '/callback/wxpay/notify'; String get wxCallback => '/callback/wxpay/notify';
String get aliCallback => '/callback/alipay/notify'; String get aliCallback => '/callback/alipay/notify';
} }

@ -44,7 +44,7 @@ class UserProvider extends ChangeNotifier {
} }
Future updateUserInfo() async { Future updateUserInfo() async {
var base = await apiClient.request(API.manager.info); var base = await apiClient.request(API.app.info);
if (base.code == 0) { if (base.code == 0) {
_userInfo = UserInfoModel.fromJson(base.data); _userInfo = UserInfoModel.fromJson(base.data);
} else { } else {

@ -128,7 +128,7 @@ class _LoginPageState extends State<LoginPage> {
}else if(!_chooseAgreement){ }else if(!_chooseAgreement){
BotToast.showText(text: "请同意并勾选隐私政策"); BotToast.showText(text: "请同意并勾选隐私政策");
}else{ }else{
var base = await apiClient.request(API.manager.login, var base = await apiClient.request(API.app.login,
data: {'phone': _phoneController.text, 'code': _smsCodeController.text}); data: {'phone': _phoneController.text, 'code': _smsCodeController.text});
if (base.code == 0) { if (base.code == 0) {
await UserTool.userProvider.setToken(base.data['token']); await UserTool.userProvider.setToken(base.data['token']);
@ -208,7 +208,7 @@ class _LoginPageState extends State<LoginPage> {
onTap: !_getCodeEnable onTap: !_getCodeEnable
? () {} ? () {}
: () async { : () async {
await apiClient.request(API.manager.captcha, data: { await apiClient.request(API.app.captcha, data: {
'phone': _phoneController.text, 'phone': _phoneController.text,
}); });
_beginCountDown(); _beginCountDown();

@ -64,7 +64,7 @@ class _UserPageState extends State<UserPage> {
border: false, border: false,
onTap: () async{ onTap: () async{
var cancel = CloudToast.loading; var cancel = CloudToast.loading;
var base = await apiClient.request(API.manager.logout, showMessage: true); var base = await apiClient.request(API.app.logout, showMessage: true);
if (base.code == 0) { if (base.code == 0) {
UserTool.userProvider.logout(); UserTool.userProvider.logout();
Get.offAll(const HomePage()); Get.offAll(const HomePage());

Loading…
Cancel
Save