public void handleMessage(Message msg) { switch (msg.arg1) { case 0: try { JSONObject jsonObject = new JSONObject(msg.obj.toString()); if (jsonObject.has("status")) { String status = jsonObject.getString("status"); if (status.equals("1")) { UserInfo model = UserInfo.getInstance(); String data = jsonObject.getString("data"); JSONObject jsonObject1 = new JSONObject(data); model.setName(jsonObject1.getString("user_name")); SysApplication.getInstance().addUserInfo(model); finish(); } else { // getWXUserUrl = getWXUserUrl+access_token+"&openid="+openid; // getHttpThread(getWXUserUrl, 2, handler).start(); } } else { tv.setText("status is null" + msg.obj.toString()); } } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } break; case 1: List<Map<String, String>> list = StringManager.getListMapByJson(msg.obj.toString()); Map<String, String> map = list.get(0); access_token = map.get("access_token"); openid = map.get("openid"); HashMap<String, String> paramsmap = new HashMap<String, String>(); paramsmap.put("type", "user"); paramsmap.put("part", "wxlogin"); paramsmap.put("wxopen_id", openid); DataService client1 = new DataService(handler, 0, paramsmap); client1.start(); // tv.setText(access_token); break; // case 2: // List<Map<String, String>> listmap = // StringManager.getListMapByJson(msg.obj.toString()); // Map<String, String> userinfomap = listmap.get(0); // HashMap<String, String> paramsmap1 = new HashMap<String, String>(); // paramsmap1.put("type", "user"); // paramsmap1.put("part", "insert_wechat"); // // paramsmap1.put("username", userinfomap.get("nickname")); // paramsmap1.put("wx_openid", userinfomap.get("openid")); // client = new DataService(handler, 3, paramsmap1); // client.start(); // break; case 3: // tv.setText("baocun chenggong"); break; default: break; } };
private String openhuifu() { String signature = "payaccounts.php:" + System.currentTimeMillis() / 1000 + ":hxpay"; UserInfo userInfo = new UserInfo(); try { userInfo.signature = RegExpValidator.encodeBase64( UtiEncrypt.encryptAES(RegExpValidator.encodeBase64(signature.getBytes())).getBytes()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } userInfo.version = SppaConstant.APP_VERSION; userInfo.userID = userID; userInfo.loginname = loginname; userInfo.platformID = SppaConstant.ANDROID; userInfo.udid = SppaConstant.getDeviceInfo(ActRegisterSucceed.this); String url = "http://testinterface.8518.com/app/ceb/payaccounts.php?" + "&userID=" + userInfo.userID + "&platformID=" + userInfo.platformID + "&version=" + userInfo.version + "&signature=" + userInfo.signature + "&loginname=" + userInfo.loginname + "&udid=" + userInfo.udid; return url; }
void share() { sp = getSharedPreferences("USERID", 0); userID = sp.getString("userID", "0"); String signature = "sharefriend.php:" + System.currentTimeMillis() / 1000 + ":hxpay"; UserInfo userInfo = new UserInfo(); try { userInfo.signature = RegExpValidator.encodeBase64( UtiEncrypt.encryptAES(RegExpValidator.encodeBase64(signature.getBytes())).getBytes()); } catch (Exception e) { e.printStackTrace(); } userInfo.type = "0"; // 注册分享 userInfo.version = SppaConstant.APP_VERSION; userInfo.userID = userID; userInfo.platformID = SppaConstant.ANDROID; userInfo.udid = SppaConstant.getDeviceInfo(this); if (SppaConstant.isNetworkAvailable(this)) { new ShareTask().execute(userInfo); } }
void getAccountCenter() { sp = getSharedPreferences("USERID", 0); userID = sp.getString("userID", "0"); String signature = "accountcenter.php:" + System.currentTimeMillis() / 1000 + ":hxpay"; UserInfo userInfo = new UserInfo(); try { userInfo.signature = RegExpValidator.encodeBase64( UtiEncrypt.encryptAES(RegExpValidator.encodeBase64(signature.getBytes())).getBytes()); } catch (Exception e) { e.printStackTrace(); } userInfo.version = SppaConstant.APP_VERSION; userInfo.userID = userID; userInfo.platformID = SppaConstant.ANDROID; userInfo.udid = SppaConstant.getDeviceInfo(this); new AccountCenterTask().execute(userInfo); }