Service side POST [' email ', ' password ']; Normal registration to use this interface, the third party directly login can $api->post (' register ', ' Usercontroller@createuser '); POST [' email ', ' password ', ' Is_third '] POST [' uid ', ' Is_third '] $api->post (' login ', ' usercontroller@login '); $api->get (' users ', ' usercontroller@getusers '); Moving End [' name ', ' email ', ' password ', ' is_third ', ' gender ', ' birthday ']; @FormUrlEncoded @POST ("register") Observable<user> CreateUser (@Field ("name") string name, @Field ("email") string email, @Field ("password") string password, @Field ("Is_third") string Is_third, @Field ("gender") string gender, @Field ("Birthday") string birthday); local [' email ', ' password ', ' Is_third '] @FormUrlEncoded @POST ("Login") Observable<user> Login (@Field ("email") string email, @Field ("password") string password, @Field ("Is_third") String Is_third); Third [' uid ', ' Is_third '] @FormUrlEncoded @POST ("Login") Observable<user> Login (@Field ("UID") String uid, @Field ("Is_third") int is_third); Accountbean User Class @Table (name = account) public class Accountbean extends Model { Private final static int no_account = 0; @Expose @Column (name = "user_id") public int UserID ; @Column (name = "email") public String email; @ Column (name = "name") public String name; @Column (name = "Gender") &nbs p; public int gender; @Column (name = "Birthday") public String birthday @Column (name = "Is_third") public int isthird; Public Accountbean (user user) { This.userid = User.getid (); This.email = User.getemail (); This.birthday = User.getbirthday (); This.gender = User.getgender (); This.isthird = User.getisthird (); } public static void Cacheaccountinfo (user user) { Accountbean Accountbean = new Accountbean (user); Accountbean.save (); } public static void Logoutaccount () { Long id = Getaccountid (); if (ID!= no_account) { Accountbean.delete (Accountbean.class, id); } } public static Boolean Existaccountcache () { list<accountbean> accounts = getallaccounts (); Return (accounts.size () = = 1); } public static long Getaccountid () { if (Existaccountcache ()) { list<accountbean> accounts = getallaccounts (); Return Accounts.get (0). GetId (); } return no_account; } public static list<accountbean> getallaccounts () { Return to New Select (). from (Accountbean.class). Execute (); } } |