// Path: app/src/main/java/com/mj/weather/weather/model/dp/dao/UserDao.java
// public class UserDao {
// 
//     /**
//      * 保存用户数据
//      *
//      * @param username
//      * @param password
//      * @param rspLogin
//      */
//     public static void saveUserData(String username, String password, UserBean.RspLogin rspLogin) {
//         User user = DataSupport.findFirst(User.class);
//         if (user == null) {
//             user = new User();
//         }
//         user.setUsername(username);
//         user.setPassword(password);
//         user.setToken(rspLogin.result.token);
//         user.setUid(rspLogin.result.uid);
//         user.save();
//     }
// 
// }
// 
// Path: app/src/main/java/com/mj/weather/weather/model/http/ApiClient.java
// public class ApiClient {
// 
//     /**
//      * HeService
//      */
//     public static HeService heService;
//     public static UserService userService;
// 
//     public static void init() {
//         heService = initService(HeService.class, HeProtocol.host);
//         userService = initService(UserService.class, UserProtocol.host);
//     }
// 
//     private static <T> T initService(Class<T> clazz, String host) {
//         Retrofit retrofit = new Retrofit.Builder()
//                 .baseUrl(host)
//                 .addConverterFactory(GsonConverterFactory.create())
//                 .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
//                 .build();
//         return retrofit.create(clazz);
//     }
// 
// 
// }
// 
// Path: app/src/main/java/com/mj/weather/weather/model/http/UserProtocol.java
// public class UserProtocol {
//     public static final String host = "http://apicloud.mob.com";
// 
//     public static final String key = "1b0e55b47d644";
// 
//     public static final String port_register = "/user/rigister";
//     public static final String port_login = "/user/login";
//     public static final String port_profile_put = "/user/profile/put";
//     public static final String port_profile_query = "/user/profile/query";
//     public static final String port_password_change = "/user/password/change";
//     public static final String port_profile_del = "/user/profile/del";
//     public static final String port_data_put = "/user/data/put";
//     public static final String port_data_query = "/user/data/query";
//     public static final String port_data_del = "/user/data/del";
//     public static final String port_password_retrieve = "/user/password/retrieve";
// 
// }
// 
// Path: app/src/main/java/com/mj/weather/weather/model/http/entity/UserBean.java
// public class UserBean {
// 
//     public static class Result {
//         public String uid;
//         public String token;
//     }
// 
//     public static class RspRegister {
//         public String retCode;
//         public String msg;
//         public String uid;
//     }
// 
//     public static class RspLogin {
//         public String retCode;
//         public String msg;
//         public Result result;
//     }
// 
//     public static class RspProfilePut {
//         public String retCode;
//         public String msg;
//     }
// 
//     public static class RspProfileQuery {
//         public String retCode;
//         public String msg;
//         public String result;
//     }
// 
//     public static class RspProfileDel {
//         public String retCode;
//         public String msg;
//     }
// 
//     public static class RspDataPut {
//         public String retCode;
//         public String msg;
//     }
// 
//     public static class RspDataQuery {
//         public String retCode;
//         public String msg;
//         public String result;
//     }
// 
//     public static class RspDataDel {
//         public String retCode;
//         public String msg;
//     }
// 
//     public static class RspPasswordChange {
//         public String retCode;
//         public String msg;
//     }
// 
//     public static class RspPasswordRetrieve {
//         public String retCode;
//         public String msg;
//     }
// }


import com.mj.weather.weather.model.dp.dao.UserDao;
import com.mj.weather.weather.model.http.ApiClient;
import com.mj.weather.weather.model.http.UserProtocol;
import com.mj.weather.weather.model.http.entity.UserBean;
import io.reactivex.Observable;
package com.mj.weather.weather.model.repository;



/**
 * Created by MengJie on 2017/6/19.
 */
public class UserRepository {


    /**
     * 注册
     *
     * @param username
     * @param password
     * @param email
     * @return
     */
    public Observable<UserBean.RspRegister> register(String username, String password, String email) {
        //判断网络

        //网络
// Path: app/src/main/java/com/mj/weather/weather/model/dp/dao/UserDao.java
// public class UserDao {
// 
//     /**
//      * 保存用户数据
//      *
//      * @param username
//      * @param password
//      * @param rspLogin
//      */
//     public static void saveUserData(String username, String password, UserBean.RspLogin rspLogin) {
//         User user = DataSupport.findFirst(User.class);
//         if (user == null) {
//             user = new User();
//         }
//         user.setUsername(username);
//         user.setPassword(password);
//         user.setToken(rspLogin.result.token);
//         user.setUid(rspLogin.result.uid);
//         user.save();
//     }
// 
// }
// 
// Path: app/src/main/java/com/mj/weather/weather/model/http/ApiClient.java
// public class ApiClient {
// 
//     /**
//      * HeService
//      */
//     public static HeService heService;
//     public static UserService userService;
// 
//     public static void init() {
//         heService = initService(HeService.class, HeProtocol.host);
//         userService = initService(UserService.class, UserProtocol.host);
//     }
// 
//     private static <T> T initService(Class<T> clazz, String host) {
//         Retrofit retrofit = new Retrofit.Builder()
//                 .baseUrl(host)
//                 .addConverterFactory(GsonConverterFactory.create())
//                 .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
//                 .build();
//         return retrofit.create(clazz);
//     }
// 
// 
// }
// 
// Path: app/src/main/java/com/mj/weather/weather/model/http/UserProtocol.java
// public class UserProtocol {
//     public static final String host = "http://apicloud.mob.com";
// 
//     public static final String key = "1b0e55b47d644";
// 
//     public static final String port_register = "/user/rigister";
//     public static final String port_login = "/user/login";
//     public static final String port_profile_put = "/user/profile/put";
//     public static final String port_profile_query = "/user/profile/query";
//     public static final String port_password_change = "/user/password/change";
//     public static final String port_profile_del = "/user/profile/del";
//     public static final String port_data_put = "/user/data/put";
//     public static final String port_data_query = "/user/data/query";
//     public static final String port_data_del = "/user/data/del";
//     public static final String port_password_retrieve = "/user/password/retrieve";
// 
// }
// 
// Path: app/src/main/java/com/mj/weather/weather/model/http/entity/UserBean.java
// public class UserBean {
// 
//     public static class Result {
//         public String uid;
//         public String token;
//     }
// 
//     public static class RspRegister {
//         public String retCode;
//         public String msg;
//         public String uid;
//     }
// 
//     public static class RspLogin {
//         public String retCode;
//         public String msg;
//         public Result result;
//     }
// 
//     public static class RspProfilePut {
//         public String retCode;
//         public String msg;
//     }
// 
//     public static class RspProfileQuery {
//         public String retCode;
//         public String msg;
//         public String result;
//     }
// 
//     public static class RspProfileDel {
//         public String retCode;
//         public String msg;
//     }
// 
//     public static class RspDataPut {
//         public String retCode;
//         public String msg;
//     }
// 
//     public static class RspDataQuery {
//         public String retCode;
//         public String msg;
//         public String result;
//     }
// 
//     public static class RspDataDel {
//         public String retCode;
//         public String msg;
//     }
// 
//     public static class RspPasswordChange {
//         public String retCode;
//         public String msg;
//     }
// 
//     public static class RspPasswordRetrieve {
//         public String retCode;
//         public String msg;
//     }
// }


// Path: app/src/main/java/com/mj/weather/weather/model/repository/UserRepository.java
import com.mj.weather.weather.model.dp.dao.UserDao;
import com.mj.weather.weather.model.http.ApiClient;
import com.mj.weather.weather.model.http.UserProtocol;
import com.mj.weather.weather.model.http.entity.UserBean;
import io.reactivex.Observable;

package com.mj.weather.weather.model.repository;



/**
 * Created by MengJie on 2017/6/19.
 */
public class UserRepository {


    /**
     * 注册
     *
     * @param username
     * @param password
     * @param email
     * @return
     */
    public Observable<UserBean.RspRegister> register(String username, String password, String email) {
        //判断网络

        //网络
        Observable<UserBean.RspRegister> rspRegister = ApiClient.userService.register(UserProtocol.key, username, password, email);