/** 初始化页面 */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.affirm_bind); ViewUtils.inject(this); t = T.getInstance(); bank.setText(t.getBankname()); for (int i = 0; i < banks.length; i++) { if (bank.getText().toString().equals(banks[i])) { bankimage.setImageResource(BANKIMG[i]); } } name.setText(t.getName()); number.setText(t.getCard()); phone.setText(USER.USERPHONE); }
/** 向服务器发送用户信息 */ private void send() { timetemp = System.currentTimeMillis() + AllUtils.getRandom(); RequestParams params = new RequestParams(); params.addBodyParameter("myToken", USER.USERTOKEN); params.addBodyParameter("bankName", t.getId()); params.addBodyParameter("bankBranchName", t.getZ()); params.addBodyParameter("province", t.getP()); params.addBodyParameter("market", t.getW()); params.addBodyParameter("username", t.getName()); params.addBodyParameter("fbankNo", "1"); params.addBodyParameter("bankNumber", t.getCard()); params.addBodyParameter("timestamp", timetemp); String temp = t.getZ() + t.getId() + t.getCard() + "1" + t.getW() + t.getP() + t.getName(); System.out.println(temp); params.addBodyParameter( "hashCode", AllUtils.Md5( USER.USERTOKEN + temp + timetemp + AllUtils.readPrivateKeyFile(getBaseContext()))); HttpUtils http = new HttpUtils(15000); http.send( HttpRequest.HttpMethod.POST, URL + METHOD, params, new RequestCallBack<String>() { @Override public void onStart() { AllUtils.startProgressDialog(AffirmBind.this, "发送中"); } @Override public void onSuccess(ResponseInfo<String> responseInfo) { AllUtils.stopProgressDialog(); System.out.println("结果" + responseInfo.result); content = AllUtils.getJson(responseInfo.result, new String[] {"resultCode"}).get(0); if ("2".equals(content)) { Toast.makeText(getBaseContext(), "添加成功", Toast.LENGTH_SHORT).show(); startActivity( new Intent(AffirmBind.this, Addbank.class) .setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)); finish(); } else if ("1".equals(content)) { Toast.makeText(getBaseContext(), "登陆状态出错!请重新登录", Toast.LENGTH_SHORT).show(); } else if ("3".equals(content)) { Toast.makeText(getBaseContext(), "保存失败", Toast.LENGTH_SHORT).show(); } else if ("4".equals(content)) { Toast.makeText(getBaseContext(), "名字不能为空", Toast.LENGTH_SHORT).show(); } else if ("5".equals(content)) { Toast.makeText(getBaseContext(), "市选择错误", Toast.LENGTH_SHORT).show(); } else if ("6".equals(content)) { Toast.makeText(getBaseContext(), "省份选择错误", Toast.LENGTH_SHORT).show(); } else if ("7".equals(content)) { Toast.makeText(getBaseContext(), "支行不能为空", Toast.LENGTH_SHORT).show(); } else if ("8".equals(content)) { Toast.makeText(getBaseContext(), "开户行不能为空", Toast.LENGTH_SHORT).show(); } else if ("9".equals(content)) { Toast.makeText(getBaseContext(), "银行卡已被添加", Toast.LENGTH_SHORT).show(); } else if ("10".equals(content)) { Toast.makeText(getBaseContext(), "卡号不存在", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(getBaseContext(), "错误:" + content, Toast.LENGTH_SHORT).show(); } } @Override public void onFailure(HttpException error, String msg) { AllUtils.stopProgressDialog(); AllUtils.toast(getBaseContext(), msg); } }); }