Prechádzať zdrojové kódy

用户登录方式调整

zengjiebin 7 rokov pred
rodič
commit
56791a9308

+ 19 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/UserEntity.java

@@ -67,6 +67,8 @@ public class UserEntity implements Serializable {
     private int is_agent;//0不是代理 1是代理
     @Column(name = "certification_count")
     private int certification_count;//实名认证次数
+    @Column(name = "must_bind_mobile")
+    private int must_bind_mobile;//是否必须绑定手机号 0不是 1是
 
     public String getWx_nickname() {
         return wx_nickname;
@@ -276,6 +278,15 @@ public class UserEntity implements Serializable {
         this.certification_count = certification_count;
     }
 
+    public int getMust_bind_mobile() {
+        return must_bind_mobile;
+    }
+
+    public void setMust_bind_mobile(int must_bind_mobile) {
+        this.must_bind_mobile = must_bind_mobile;
+    }
+
+
 
 
 
@@ -296,4 +307,12 @@ public class UserEntity implements Serializable {
     public boolean notCertification() {
         return TextUtils.isEmpty(getReal_name()) || TextUtils.isEmpty(getId_number()) || TextUtils.isEmpty(getBank_card_mobile()) || TextUtils.isEmpty(getBank_card());
     }
+
+    /**
+     * 老用户选择绑定手机号
+     * @return
+     */
+    public boolean canBindMobile(){
+        return must_bind_mobile == 0 && TextUtils.isEmpty(mobile);
+    }
 }

+ 2 - 2
app/src/main/java/com/sheep/gamegroup/model/util/SheepSubscriber.java

@@ -73,8 +73,8 @@ public abstract class SheepSubscriber<T> extends Subscriber<T> {
                 }
                 //未绑定手机号
                 if(throwable.code == 302 && baseMessage.getCode() == 30001){
-//                    Jump2View.getInstance().goBindPhone(SheepApp.mContext,baseMessage.getCode());
-//                    return;
+                    Jump2View.getInstance().goBindPhone(SheepApp.mContext, baseMessage.getCode());
+                    return;
                 }else if(baseMessage.getCode() == 1002){
                     Jump2View.getInstance().gotoLoginAgain();
                 }

+ 0 - 1
app/src/main/java/com/sheep/gamegroup/util/CommonUtil.java

@@ -1004,7 +1004,6 @@ public class CommonUtil {
                 .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
                     @Override
                     public void onError(BaseMessage baseMessage) {
-                        G.showToast(baseMessage.getMsg() + "");
                         if (action1 != null)
                             action1.call(null);
 

+ 0 - 25
app/src/main/java/com/sheep/gamegroup/util/ConnectAddress.java

@@ -51,26 +51,6 @@ public enum ConnectAddress {
         public String getName() {
             return "测试服";
         }
-    },sheeptestjiguang {
-
-        @Override
-        public String getAppUrl() {
-            return "http://test.sheep.kfzs.com/";
-        }
-        @Override
-        public String getName() {
-            return "测试服极光";
-        }
-    },sheepupdate {
-
-        @Override
-        public String getAppUrl() {
-            return "http://test.sheep.kfzs.com/";
-        }
-        @Override
-        public String getName() {
-            return "升级正式版本";
-        }
     },sheep {
 
         @Override
@@ -109,18 +89,13 @@ public enum ConnectAddress {
     public int getVersionType() {
         switch (this){
             case sheep:
-            case sheepupdate:
                 return 1;
-            case sheeptestjiguang:
-                return 2;
             default:
                 return 0;
         }
     }
     public String getPackageName() {
         switch (this){
-            case sheeptestjiguang:
-                return "com.sheep.jiuyan.samllsheep.test";
             default:
                 return "com.sheep.jiuyan.samllsheep";
         }

+ 29 - 5
app/src/main/java/com/sheep/gamegroup/util/Jump2View.java

@@ -240,12 +240,21 @@ public class Jump2View {
 //            @Override
 //            public void call(String msg) {
 //                if(msg == null || TextUtils.equals(msg, "404")) {
-                    checkLabel(activity, new Action1<BaseMessage>() {
+                    CommonUtil.getInstance().updateUserInfo(new Action1<UserEntity>() {
                         @Override
-                        public void call(BaseMessage baseMessage) {
-                            final Intent intent = new Intent(activity, ActMain.class);
-                            activity.startActivity(intent);
-                            activity.finish();
+                        public void call(UserEntity userEntity) {
+                            if(userEntity != null && userEntity.canBindMobile() && !hasShowBindPhone(userEntity)){//老用户没有绑定手机号,且没有展示过绑定手机号界面
+                                Jump2View.getInstance().goBindPhone(activity, 1);
+                                return;
+                            }
+                            checkLabel(activity, new Action1<BaseMessage>() {
+                                @Override
+                                public void call(BaseMessage baseMessage) {
+                                    final Intent intent = new Intent(activity, ActMain.class);
+                                    activity.startActivity(intent);
+                                    activity.finish();
+                                }
+                            });
                         }
                     });
 //                }else {
@@ -257,6 +266,21 @@ public class Jump2View {
     }
 
     /**
+     * 该用户 显示过绑定手机号的界面
+     * @param userEntity
+     * @return
+     */
+    private boolean hasShowBindPhone(UserEntity userEntity) {
+        String string = ACache.get(SheepApp.getInstance()).getAsString(userEntity.getOpen_id());
+        if(string == null){
+            //因为只显示一次,所以直接保存值
+            ACache.get(SheepApp.getInstance()).put(userEntity.getOpen_id(), userEntity.getNickname());
+            return false;
+        }
+        return !BuildConfig.DEBUG;
+    }
+
+    /**
      * 跳到手机登录页面
      * @param context
      * @param o:  0:登录,1:旧手机号,2:新手机号

+ 36 - 11
app/src/main/java/com/sheep/gamegroup/view/activity/ChangeTelAct.java

@@ -68,13 +68,15 @@ public class ChangeTelAct extends BaseActivity implements PhoneContract.View{
     LinearLayout changePhoneLayout;
     @BindView(R.id.no_bind_tel_img)
     ImageView no_bind_tel_img;
+    @BindView(R.id.phone_icon_iv)
+    ImageView phone_icon_iv;
+    @BindView(R.id.code_icon_iv)
+    ImageView code_icon_iv;
 
     @Inject
     PhonePresenter presenter;
 
     private Activity activity;
-    private final int CHANGGE_CLICK = 0;//切换手机按钮点击后
-    private final int OLD_PHONE_CLICK = 1;//旧手机获取验证码后
 
     private int oldOrNew;   //1,绑定过   0,未绑定过
 
@@ -103,32 +105,51 @@ public class ChangeTelAct extends BaseActivity implements PhoneContract.View{
     public void initView() {
         activity = this;
         GlideImageLoader.setImage(no_bind_tel_img, "http://cdngame.kuaifazs.com/no_bind_tel_img.png");
+        GlideImageLoader.setImage(phone_icon_iv, "http://cdngame.kuaifazs.com/phone_icon_iv.png");
+        GlideImageLoader.setImage(code_icon_iv, "http://cdngame.kuaifazs.com/code_icon_iv.png");
         DaggerChangePhoneComponent.builder()
                 .netComponent(SheepApp.get(activity).getNetComponent())
                 .phoneModule(new PhoneModule(this))
                 .build()
                 .inject(this);
         where_from = getIntent().getIntExtra("where_from", 0);
-        TitleBarUtils.getInstance()
+        TitleBarUtils titleBarUtils = TitleBarUtils.getInstance()
                 .setTitle(this, noticeStr)
                 .setTitleFinish(this, new View.OnClickListener() {
                     @Override
                     public void onClick(View v) {
-                        if(where_from > 0){
-                            Jump2View.getInstance()
-                                    .gotoLoginAgain();
+                        switch (where_from){
+                            case 1:
+                                Jump2View.getInstance().goHomePageView(ChangeTelAct.this, null);
+                                break;
+                            case 30001:
+                                Jump2View.getInstance().gotoLoginAgain();
+                                break;
                         }
                         finish();
                     }
                 });
+        switch (where_from){
+            case 1://用户可以跳过
+                titleBarUtils.setRightBotton(this, "跳过", 0, new View.OnClickListener() {
+                    @Override
+                    public void onClick(View view) {
+                        Jump2View.getInstance().goHomePageView(ChangeTelAct.this, null);
+                        finish();
+                    }
+                });
+                break;
+            case 30001:
+                break;
+        }
         try {
             userEntity = MyDbManager.getInstance()
                     .dbFindUser();
         } catch (DbException e) {
             e.printStackTrace();
         }
-        mobiles = SpUtils.getPhone(activity);
-        if(mobiles != null && !TextUtils.isEmpty(mobiles)){//提示
+        mobiles = userEntity != null ? userEntity.getMobile() : SpUtils.getPhone(activity);
+        if(!TextUtils.isEmpty(mobiles)){//提示
             oldOrNew = 1;
             showChangeLayout.setVisibility(View.VISIBLE);
             changePhoneLayout.setVisibility(View.GONE);
@@ -360,9 +381,13 @@ public class ChangeTelAct extends BaseActivity implements PhoneContract.View{
     @Override
     public void bindTelSuccess(BaseMessage o) {
         G.showToast(o.getMsg()+"");
-        if(where_from > 0){
-            Jump2View.getInstance()
-                    .goLoginView(activity, o);
+        switch (where_from){
+            case 1:
+                Jump2View.getInstance().goHomePageView(this, null);
+                break;
+            case 30001:
+                Jump2View.getInstance().goLoginView(activity, o);
+                break;
         }
         finish();
     }

+ 66 - 44
app/src/main/res/layout/change_tel_layout.xml

@@ -2,20 +2,21 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:orientation="vertical"
-    android:background="@color/bg_gray">
+    android:background="@color/bg_gray"
+    android:orientation="vertical">
 
-    <include
-        layout="@layout/title"/>
+    <include layout="@layout/title" />
 
     <ScrollView
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:scrollbars="none">
+
         <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:orientation="vertical">
+
             <LinearLayout
                 android:id="@+id/show_change_layout"
                 android:layout_width="match_parent"
@@ -28,37 +29,38 @@
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:layout_gravity="center_horizontal"
+                    android:layout_marginBottom="5dp"
                     android:layout_marginLeft="@dimen/content_padding_100"
                     android:layout_marginRight="@dimen/content_padding_100"
-                    android:layout_marginTop="@dimen/content_padding_35"
-                    android:layout_marginBottom="5dp"/>
+                    android:layout_marginTop="@dimen/content_padding_35" />
 
                 <TextView
                     android:id="@+id/tel_tv"
+                    style="@style/txt_style_12"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:text=""
-                    style="@style/txt_style_12"
+                    android:layout_gravity="center"
                     android:layout_marginTop="@dimen/content_padding_30"
-                    android:layout_gravity="center"/>
+                    android:text="" />
+
                 <TextView
+                    style="@style/txt_style_12"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:text="@string/no_bind_tel_notice_text"
-                    style="@style/txt_style_12"
-                    android:layout_marginTop="@dimen/content_padding_10"
+                    android:layout_gravity="center"
                     android:layout_marginBottom="@dimen/content_padding_10"
-                    android:layout_gravity="center"/>
+                    android:layout_marginTop="@dimen/content_padding_10"
+                    android:text="@string/no_bind_tel_notice_text" />
 
 
                 <LinearLayout
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:orientation="horizontal"
+                    android:layout_marginBottom="@dimen/content_padding_small"
                     android:layout_marginLeft="18dp"
                     android:layout_marginRight="18dp"
                     android:layout_marginTop="@dimen/content_padding_big"
-                    android:layout_marginBottom="@dimen/content_padding_small">
+                    android:orientation="horizontal">
 
                     <android.support.v7.widget.AppCompatEditText
                         android:id="@+id/phone_et_code_old"
@@ -68,9 +70,10 @@
                         android:layout_weight="2"
                         android:hint="请输入验证码"
                         android:inputType="number"
-                        android:paddingLeft="@dimen/content_padding_big"
                         android:maxLength="6"
-                        android:textSize="@dimen/text_size_3"/>
+                        android:paddingLeft="@dimen/content_padding_big"
+                        android:textSize="@dimen/text_size_3" />
+
                     <TextView
                         android:id="@+id/phone_btn_code_old"
                         android:layout_width="0dp"
@@ -80,16 +83,17 @@
                         android:layout_weight="1"
                         android:gravity="center"
                         android:text="@string/get_captcha"
-                        android:textColor="@color/txt_bule"
-                        />
+                        android:textColor="@color/txt_bule" />
 
                 </LinearLayout>
+
                 <TextView
                     android:id="@+id/sure_change_tv"
                     style="@style/style_button"
-                    android:text="更换手机号"/>
+                    android:text="更换手机号" />
 
             </LinearLayout>
+
             <LinearLayout
                 android:id="@+id/change_phone_layout"
                 android:layout_width="match_parent"
@@ -100,47 +104,66 @@
                     android:id="@+id/phone_tip_tv"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
+                    android:layout_gravity="center_horizontal"
                     android:text="为了避免机器刷单,请绑定手机号后领取任务奖励"
                     android:textColor="@color/black_444444"
                     android:textSize="11dp"
-                    android:layout_gravity="center_horizontal"
-                    android:visibility="gone"/>
+                    android:visibility="gone" />
 
                 <LinearLayout
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
+                    android:layout_marginBottom="@dimen/content_padding_20"
                     android:layout_marginLeft="12dp"
                     android:layout_marginRight="12dp"
                     android:layout_marginTop="@dimen/content_padding_13"
-                    android:layout_marginBottom="@dimen/content_padding_20"
                     android:background="@drawable/x_shap_shadow_bg_rectgangle_white"
                     android:orientation="vertical">
-                    <android.support.v7.widget.AppCompatEditText
-                        android:id="@+id/phone_et_account"
-                        style="@style/edt_style"
-                        android:inputType="phone"
+
+                    <LinearLayout
                         android:layout_width="match_parent"
-                        android:layout_height="@dimen/edt_heigh_default"
-                        android:layout_centerVertical="true"
+                        android:layout_height="wrap_content"
                         android:layout_margin="@dimen/content_padding_small"
-                        android:hint="请输入要绑定的手机号"
-                        android:paddingLeft="@dimen/content_padding_big"
-                        android:maxLength="11"/>
+                        android:gravity="center_vertical"
+                        android:orientation="horizontal">
+                        <ImageView
+                            android:id="@+id/phone_icon_iv"
+                            android:layout_width="@dimen/icon_heigh_default"
+                            android:layout_height="@dimen/icon_heigh_default"
+                            android:layout_marginStart="9dp"
+                            android:src="@mipmap/icon"/>
+                        <android.support.v7.widget.AppCompatEditText
+                            android:id="@+id/phone_et_account"
+                            style="@style/edt_style"
+                            android:layout_width="match_parent"
+                            android:layout_height="@dimen/edt_heigh_default"
+                            android:hint="请输入要绑定的手机号"
+                            android:inputType="phone"
+                            android:maxLength="11"
+                            android:layout_marginStart="@dimen/content_padding_small"/>
+
+                    </LinearLayout>
 
                     <View
                         android:layout_width="match_parent"
                         android:layout_height="1px"
-                        android:background="@color/white_bg_line"
                         android:layout_marginLeft="15dp"
                         android:layout_marginRight="15dp"
-                        />
+                        android:background="@color/white_bg_line" />
+
                     <LinearLayout
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
                         android:layout_margin="@dimen/content_padding_small"
-                        android:orientation="horizontal"
-                        >
-
+                        android:gravity="center_vertical"
+                        android:orientation="horizontal">
+
+                        <ImageView
+                            android:id="@+id/code_icon_iv"
+                            android:layout_width="@dimen/icon_heigh_default"
+                            android:layout_height="@dimen/icon_heigh_default"
+                            android:layout_marginStart="9dp"
+                            android:src="@mipmap/icon"/>
                         <android.support.v7.widget.AppCompatEditText
                             android:id="@+id/phone_et_code"
                             style="@style/edt_style"
@@ -149,9 +172,10 @@
                             android:layout_weight="2"
                             android:hint="请输入验证码"
                             android:inputType="number"
-                            android:paddingLeft="@dimen/content_padding_big"
                             android:maxLength="6"
-                            android:textSize="@dimen/text_size_3"/>
+                            android:layout_marginStart="@dimen/content_padding_small"
+                            android:textSize="@dimen/text_size_3" />
+
                         <TextView
                             android:id="@+id/phone_btn_code"
                             android:layout_width="0dp"
@@ -161,18 +185,16 @@
                             android:layout_weight="1"
                             android:gravity="center"
                             android:text="@string/get_captcha"
-                            android:textColor="@color/txt_bule"
-                            />
+                            android:textColor="@color/txt_bule" />
 
                     </LinearLayout>
                 </LinearLayout>
 
 
-
                 <TextView
                     android:id="@+id/phone_sure_tv"
-                    android:text="确 定"
-                    style="@style/style_button"/>
+                    style="@style/style_button"
+                    android:text="确 定" />
 
             </LinearLayout>
         </LinearLayout>

+ 1 - 0
app/src/main/res/values/common.xml

@@ -32,6 +32,7 @@
     <!--一般layout的高度-->
     <dimen name="status_bar_height">24dp</dimen>
     <dimen name="edt_heigh_default">40dp</dimen>
+    <dimen name="icon_heigh_default">20dp</dimen>
 
     <!--下载按钮的style-->