app/src/main/java/cn/flightfeather/thirdapp/CommonApplication.java
@@ -16,7 +16,11 @@
import cn.flightfeather.thirdapp.bean.entity.Userinfo;
import cn.flightfeather.thirdapp.common.net.RetrofitFactory;
import cn.flightfeather.thirdapp.util.GlobalConfig;
import cn.flightfeather.thirdapp.util.crashreport.MyCrashHandler;
import cn.flightfeather.thirdapp.util.notification.MyNotificationChannel;
import cn.flightfeather.thirdapp.util.push.PushService;
import cn.flightfeather.thirdapp.util.tbs.Tbs;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
@@ -26,18 +30,17 @@
 */
public class CommonApplication extends Application {
//    private  final String ROOTURL="http://106.14.187.51:8801/supervision/";
    public final String ROOT_URL ="http://192.168.0.200:8080/";
    public final String ROOT_URL_IMAGE ="http://192.168.0.200:8080/images/";
//    public final String ROOT_URL ="http://192.168.0.200:8080/";
//    public final String ROOT_URL_IMAGE ="http://192.168.0.200:8080/images/";
    public final String ROOT_URL ="http://192.168.0.146:8080/";
    public final String ROOT_URL_IMAGE ="http://192.168.0.146:8080/images/";
    public final String ROOT_URL_RELEASE = "http://47.100.191.150:9005/";
    public final String ROOT_URL_RELEASE_IMAGE = "http://47.100.191.150:9005/images/";
    private Retrofit retrofit;
    private Retrofit retrofitImage;
    private DaoSession daoSession;
    private Userinfo currentUser;
    private boolean debugMode = false;
    private boolean released = true;
    private UserinfoDao userinfoDao;
    private final boolean released = true;
    //在程序打开时联网获取预置数据
    private boolean loadPreDataWhenOpen = true;
@@ -52,6 +55,15 @@
        //初始化网络请求
        RetrofitFactory.init(this);
        //x5内核初始化
        Tbs.Companion.init(this);
        //Android8.0后注册通知通道
        MyNotificationChannel.Companion.init(this);
        //初始化移动推送
        PushService.Companion.init(this);
        if (instance == null) {
            instance = this;
        }
@@ -62,8 +74,7 @@
    }
    /**
     * 2018.11.07 by riku 获取数据传输接口调用的根地址
     * @return
     * 获取数据传输接口调用的根地址
     */
    public Retrofit getRetrofit(){
@@ -91,8 +102,7 @@
    }
    /**
     * 2018.11.07 by riku 获取图片传输接口调用的根地址
     * @return
     * 获取图片传输接口调用的根地址
     */
    public Retrofit getRetrofitImage(){
@@ -117,13 +127,13 @@
    /**
     * 获取数据库Session
     * @return
     */
    public DaoSession getDaoSession() {
        if (daoSession ==null) {
            File path = new File(Environment.getExternalStorageDirectory(), "FlightFeather/third_new.db");
            if(!path.exists())
                path.getParentFile().mkdirs();
            //创建数据库shop.db"
            DaoMaster.DevOpenHelper helper = new DaoMaster.DevOpenHelper(getApplicationContext(), path.getAbsolutePath(), null);
            //获取可写数据库
@@ -139,30 +149,29 @@
        return daoSession;
    }
    public boolean isDebugMode() {
        return debugMode;
    }
    /**
     * 2018.11.07 by riku  获取当前用户对象
     * @return
     * 获取当前用户对象
     */
    public Userinfo getCurrentUser() {
        if (currentUser ==null){
            userinfoDao = this.getDaoSession().getUserinfoDao();
            currentUser = userinfoDao.queryBuilder().unique();
            UserinfoDao userinfoDao = this.getDaoSession().getUserinfoDao();
            String userId = GlobalConfig.getInstance().getUserId();
            if (userId.equals(GlobalConfig.DEFAULT_USER)) {
                currentUser = userinfoDao.queryBuilder().unique();
            } else {
                currentUser = userinfoDao.queryBuilder().where(UserinfoDao.Properties.Guid.eq(userId)).unique();
            }
        }
        return currentUser;
    }
    public void setCurrentUser(Userinfo currentUser) {
        GlobalConfig.getInstance().setUserId(currentUser.getGuid());
        this.currentUser = currentUser;
    }
    /**
     * 2018.11.07 by riku  app启动时判断是否加载初始化数据完成
     * @return
     * app启动时判断是否加载初始化数据完成
     */
    public boolean isLoadPreDataWhenOpen() {
        return loadPreDataWhenOpen;