| | |
| | | import com.yeshi.fanli.dto.aitaoker.QrcodeLoginDTO;
|
| | | import com.yeshi.fanli.dto.aitaoker.RobotInfoDTO;
|
| | | import com.yeshi.fanli.dto.aitaoker.WeiXinGroupDTO;
|
| | | import com.yeshi.fanli.dto.suning.SuningGoodsInfo;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | |
| | | map.put("robot_id", robotId +"");
|
| | | map.put("uuid", wId);
|
| | | // 请求结果
|
| | | String result = baseRequest("itaoke.robot.check.maclogin", map);
|
| | | String result = baseRequest("itaoke.robot.async.mlogin", map);
|
| | | JSONObject resultJson = JSONObject.fromObject(result);
|
| | | resultJson = resultJson.optJSONObject("data");
|
| | | if (resultJson != null && !StringUtil.isNullOrEmpty(resultJson.optString("wcId"))) {
|
| | | Type type = new TypeToken<QrcodeLoginDTO>() {}.getType();
|
| | | return new Gson().fromJson(resultJson.toString(), type);
|
| | | if ("0000".equals(resultJson.optString("status"))) {
|
| | | resultJson = resultJson.optJSONObject("data");
|
| | | if (resultJson != null) {
|
| | | Type type = new TypeToken<QrcodeLoginDTO>() {}.getType();
|
| | | return new Gson().fromJson(resultJson.toString(), type);
|
| | | }
|
| | | }
|
| | | |
| | | return null;
|
| | | }
|
| | |
|
| | |
| | | // 请求结果
|
| | | String result = baseRequest("itaoke.robot.check.online", map);
|
| | | JSONObject resultJson = JSONObject.fromObject(result);
|
| | | if ("0000".equals(resultJson.optString("code"))) {
|
| | | if ("0000".equals(resultJson.optString("status"))) {
|
| | | return true;
|
| | | }
|
| | | return false;
|
| | |
| | | // 请求结果
|
| | | String result = baseRequest("itaoke.robot.force.offline", map);
|
| | | JSONObject resultJson = JSONObject.fromObject(result);
|
| | | if ("0000".equals(resultJson.optString("code"))) {
|
| | | if ("0000".equals(resultJson.optString("status"))) {
|
| | | return true;
|
| | | }
|
| | | return false;
|
| | |
| | |
|
| | |
|
| | | /**
|
| | | * 获取好友-群列表
|
| | | * 获取群列表
|
| | | * @param robotId
|
| | | * @return
|
| | | */
|
| | |
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("robot_id", robotId +"");
|
| | | // 请求结果
|
| | | String result = baseRequest("itaoke.robot.get.contract", map);
|
| | | String result = baseRequest("itaoke.robot.room.list", map);
|
| | | JSONObject resultJson = JSONObject.fromObject(result);
|
| | | if ("0000".equals(resultJson.optString("code"))) {
|
| | | resultJson = resultJson.optJSONObject("data");
|
| | | // 订阅号
|
| | | //JSONArray publicArray = resultJson.optJSONArray("public");
|
| | | |
| | | // 好友列表
|
| | | //JSONArray friendArray = resultJson.optJSONArray("friend");
|
| | | |
| | | // 群列表
|
| | | JSONArray groupArray = resultJson.optJSONArray("group");
|
| | | if ("0000".equals(resultJson.optString("status"))) {
|
| | | JSONArray groupArray = resultJson.optJSONArray("data");
|
| | | if (groupArray != null && groupArray.size() > 0) {
|
| | | List<WeiXinGroupDTO> listGroup = new ArrayList<>();
|
| | | Type type = new TypeToken<RobotInfoDTO>() {}.getType();
|
| | | Gson gson = new Gson();
|
| | | for (int i = 0 ;i < groupArray.size(); i ++) {
|
| | | listGroup.add(gson.fromJson(groupArray.get(i).toString(), type));
|
| | | }
|
| | | |
| | | Type type = new TypeToken<ArrayList<WeiXinGroupDTO>>() {
|
| | | }.getType();
|
| | | List<WeiXinGroupDTO> goodsList = new Gson().fromJson(groupArray.toString(), type);
|
| | | |
| | | return goodsList;
|
| | | }
|
| | | }
|
| | | return null;
|
| | |
| | | // 请求结果
|
| | | String result = baseRequest("itaoke.robot.macsend.circle", map);
|
| | | JSONObject resultJson = JSONObject.fromObject(result);
|
| | | if ("1000".equals(resultJson.optString("code"))) {
|
| | | if ("0000".equals(resultJson.optString("status"))) {
|
| | | resultJson = resultJson.optJSONObject("data");
|
| | | resultJson = resultJson.optJSONObject("object");
|
| | | return resultJson.optString("id");
|
| | | }
|
| | | return null;
|
| | |
| | | map.put("wx_id", wxId);
|
| | | map.put("msg_id", msgId);
|
| | | map.put("content", content);
|
| | | map.put("comment_id", "0");
|
| | | // 请求结果
|
| | | String result = baseRequest("itaoke.robot.macsend.circlecomment", map);
|
| | | JSONObject resultJson = JSONObject.fromObject(result);
|
| | | if ("1000".equals(resultJson.optString("code"))) {
|
| | | if ("0000".equals(resultJson.optString("status"))) {
|
| | | return true;
|
| | | }
|
| | | return false;
|
| | |
| | | // 请求结果
|
| | | String result = baseRequest("itaoke.robot.macsend.text", map);
|
| | | JSONObject resultJson = JSONObject.fromObject(result);
|
| | | if (resultJson.optInt("code") == 1000) {
|
| | | if ("0000".equals(resultJson.optString("status"))) {
|
| | | return true;
|
| | | }
|
| | | return false;
|