All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.zhengzhanpeng.itchat4j.core.Core Maven / Gradle / Ivy

There is a newer version: 1.0.3
Show newest version
package cn.zhengzhanpeng.itchat4j.core;

import cn.zhengzhanpeng.itchat4j.beans.BaseMsg;
import cn.zhengzhanpeng.itchat4j.utils.MyHttpClient;
import cn.zhengzhanpeng.itchat4j.utils.enums.parameters.BaseParaEnum;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Getter
@Setter
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class Core {

	private static Core instance;

	public static Core getInstance() {
		if (instance == null) {
			synchronized (Core.class) {
				instance = new Core();
			}
		}
		return instance;
	}

    private boolean alive = false;
	private int memberCount = 0;

	private String indexUrl;

	private String userName;
	private String nickName;
	private List msgList = new ArrayList();

	private JSONObject userSelf; // 登陆账号自身信息
	private List memberList = new ArrayList(); // 好友+群聊+公众号+特殊账号
	private List contactList = new ArrayList();// 好友
	private List groupList = new ArrayList();; // 群
	private Map groupMemeberMap = new HashMap(); // 群聊成员字典
	private List publicUsersList = new ArrayList();;// 公众号/服务号
	private List specialUsersList = new ArrayList();;// 特殊账号
	private List groupIdList = new ArrayList(); // 群ID列表
	private List groupNickNameList = new ArrayList(); // 群NickName列表

	private Map userInfoMap = new HashMap();

	private Map loginInfo = new HashMap<>();
    private MyHttpClient myHttpClient = MyHttpClient.getInstance();
    private String uuid = null;

    private boolean useHotReload = false;
    private String hotReloadDir = "itchat.pkl";
    private int receivingRetryCount = 5;

	private long lastNormalRetcodeTime;

	/**
	 * 请求参数
	 */
	public Map getParamMap() {
        return new HashMap(1) {

			private static final long serialVersionUID = 1L;

			{
                Map map = new HashMap<>();
				for (BaseParaEnum baseRequest : BaseParaEnum.values()) {
					map.put(baseRequest.para(), getLoginInfo().get(baseRequest.value()).toString());
				}
				put("BaseRequest", map);
			}
		};
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy