|
|
@@ -0,0 +1,149 @@
|
|
|
+package com.sheep.gamegroup.view.activity;
|
|
|
+
|
|
|
+import android.app.Activity;
|
|
|
+import android.text.TextUtils;
|
|
|
+import android.view.View;
|
|
|
+import android.widget.EditText;
|
|
|
+import android.widget.TextView;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.sheep.gamegroup.di.components.DaggerCommitWxCodeMakeMoneyComponent;
|
|
|
+import com.sheep.gamegroup.di.components.DaggerCommitWxMakeMoneyComponent;
|
|
|
+import com.sheep.gamegroup.di.modules.CommitWxCodeMakeMoneyModule;
|
|
|
+import com.sheep.gamegroup.di.modules.CommitWxMakeMoneyModule;
|
|
|
+import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
|
+import com.sheep.gamegroup.model.entity.WXOnHookAccount;
|
|
|
+import com.sheep.gamegroup.presenter.CommitWxCodeMakeMoneyContract;
|
|
|
+import com.sheep.gamegroup.presenter.CommitWxCodeMakeMoneyPresenter;
|
|
|
+import com.sheep.gamegroup.presenter.CommitWxMakeMoneyContract;
|
|
|
+import com.sheep.gamegroup.presenter.CommitWxMakeMoneyPresenter;
|
|
|
+import com.sheep.gamegroup.util.Jump2View;
|
|
|
+import com.sheep.jiuyan.samllsheep.BuildConfig;
|
|
|
+import com.sheep.jiuyan.samllsheep.R;
|
|
|
+import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
|
+import com.sheep.jiuyan.samllsheep.base.BaseActivity;
|
|
|
+import com.sheep.jiuyan.samllsheep.utils.G;
|
|
|
+import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
|
|
|
+
|
|
|
+import javax.inject.Inject;
|
|
|
+
|
|
|
+import butterknife.BindView;
|
|
|
+import butterknife.ButterKnife;
|
|
|
+import butterknife.OnClick;
|
|
|
+
|
|
|
+/**
|
|
|
+ * Created by realicing on 2018/3/23.
|
|
|
+ * realicing@sina.com
|
|
|
+ * 提交微信验证码
|
|
|
+ */
|
|
|
+
|
|
|
+public class CommitWxCodeAct extends BaseActivity implements CommitWxCodeMakeMoneyContract.View{
|
|
|
+ public static final int ALTER_CODE = 0;//修改验证码
|
|
|
+ public static final int ALTER_INFO = 1;//修改验证码
|
|
|
+ @BindView(R.id.tv_wx_commit)
|
|
|
+ TextView tv_wx_commit;
|
|
|
+ @BindView(R.id.et_wx_account)
|
|
|
+ EditText et_wx_account;
|
|
|
+ @BindView(R.id.et_wx_pwd)
|
|
|
+ EditText et_wx_pwd;
|
|
|
+ private int id;
|
|
|
+ private int type;
|
|
|
+
|
|
|
+ @OnClick({R.id.tv_wx_commit})
|
|
|
+ public void onViewClicked(View view) {
|
|
|
+ switch (view.getId()) {
|
|
|
+ case R.id.tv_wx_commit:
|
|
|
+ String account = et_wx_account.getText().toString();
|
|
|
+ String password = et_wx_pwd.getText().toString();
|
|
|
+ if(TextUtils.isEmpty(account)){
|
|
|
+ G.showToast("微信账号不能为空");
|
|
|
+ } else if(TextUtils.isEmpty(password)){
|
|
|
+ switch (type){
|
|
|
+ case ALTER_CODE:
|
|
|
+ G.showToast("微信验证码不能为空");
|
|
|
+ break;
|
|
|
+ case ALTER_INFO:
|
|
|
+ G.showToast("微信密码不能为空");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ } else if(presenter != null) {
|
|
|
+ showProgress();
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ switch (type){
|
|
|
+ case ALTER_CODE:
|
|
|
+ jsonObject.put("verification_code", password);
|
|
|
+ presenter.putWebchat(id, jsonObject);
|
|
|
+ break;
|
|
|
+ case ALTER_INFO:
|
|
|
+ jsonObject.put("account", account);
|
|
|
+ jsonObject.put("password", password);
|
|
|
+ presenter.putWebchat(id, jsonObject);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if(BuildConfig.DEBUG) G.showToast("功能不正常");
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ @Inject
|
|
|
+ CommitWxCodeMakeMoneyPresenter presenter;
|
|
|
+
|
|
|
+ private Activity activity;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected int getLayoutId() {
|
|
|
+ return R.layout.commit_wx_make_money;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void initView() {
|
|
|
+ ButterKnife.bind(this);
|
|
|
+ activity = this;
|
|
|
+ id = getIntent().getIntExtra("id", 0);
|
|
|
+ type = getIntent().getIntExtra("type", 0);
|
|
|
+ String account = getIntent().getStringExtra("account");
|
|
|
+ et_wx_account.setText(account);
|
|
|
+ String title = "提交验证码";
|
|
|
+ switch (type){
|
|
|
+ case ALTER_CODE:
|
|
|
+ et_wx_account.setEnabled(false);
|
|
|
+ et_wx_pwd.setHint("请输入微信验证码");
|
|
|
+ break;
|
|
|
+ case ALTER_INFO:
|
|
|
+ title = "修改挂机微信信息";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ TitleBarUtils.getInstance()
|
|
|
+ .setTitle(activity, title)
|
|
|
+ .setTitleFinish(activity);
|
|
|
+ DaggerCommitWxCodeMakeMoneyComponent.builder()
|
|
|
+ .netComponent(SheepApp.get(this).getNetComponent())
|
|
|
+ .commitWxCodeMakeMoneyModule(new CommitWxCodeMakeMoneyModule(this))
|
|
|
+ .build()
|
|
|
+ .inject(this);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void initListener() {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void initData() {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void putWebchatUpdataView(BaseMessage baseMessage) {
|
|
|
+ hideProgress();
|
|
|
+ G.showToast(baseMessage.getData().toString());//提示信息在data里面
|
|
|
+ Jump2View.getInstance().goLyingView(this, null);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void failPutWebchat2View(BaseMessage baseMessage) {
|
|
|
+ hideProgress();
|
|
|
+ G.showToast(baseMessage);
|
|
|
+ }
|
|
|
+}
|