You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
2.2 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/*
* ====================================================
* package : constants
* author : Created by nansi.
* time : 2019/5/16 10:02 AM
* remark :
* ====================================================
*/
import 'package:recook/constants/api.dart';
import 'package:recook/manager/user_manager.dart';
import 'package:recook/utils/user_level_tool.dart';
class AppConfig {
static String versionNumber;
static bool debug;
static bool needEncrypt;
static bool showCommission;
///后台控制显示
static bool showExtraCommission = false;
static const String WX_APP_ID = "wx21724a42aebe20cc";
static const String WX_APP_SECRET = "83f8932eb742257316e3168ba9e920dc";
static const String WX_APP_MINIPRO_USERNAME = "gh_295d15c0ef68";
static initial({
bool dev = true,
bool useEncrypt = true,
bool canShowCommission = true,
}) {
debug = dev;
needEncrypt = useEncrypt;
showCommission = canShowCommission;
Api.toggleEnvironment(debug);
}
static setDebug(bool isDebug) {
if (debug == isDebug) {
return;
}
debug = isDebug;
Api.toggleEnvironment(debug);
}
static setEncrypt(bool isEncrypt) {
if (needEncrypt == isEncrypt) {
return;
}
needEncrypt = isEncrypt;
}
// static setShowCommission(bool canShowCommission) {
// if (showCommission == canShowCommission) {
// return;
// }
// showCommission = canShowCommission;
// }
///佣金控制显示
///
///首先判断showExtraCommission该值由后台控制显示
///
///其次未登陆和一般会员用户无法显示该值
static bool getShowCommission() {
// return true;
if (showExtraCommission) {
return true;
} else {
if ((!UserManager.instance.haveLogin ||
UserLevelTool.currentRoleLevelEnum() == UserRoleLevel.Vip ||
UserLevelTool.currentRoleLevelEnum() == UserRoleLevel.None)) {
return false;
}
}
return showCommission;
}
static bool get commissionByRoleLevel {
if ((!UserManager.instance.haveLogin ||
UserLevelTool.currentRoleLevelEnum() == UserRoleLevel.Vip ||
UserLevelTool.currentRoleLevelEnum() == UserRoleLevel.None)) {
return false;
} else
return true;
}
}