wx2tg-puppet 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -26,6 +26,14 @@ __decorate([
|
|
|
26
26
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
27
27
|
__metadata("design:type", String)
|
|
28
28
|
], Config.prototype, "wxid", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
31
|
+
__metadata("design:type", String)
|
|
32
|
+
], Config.prototype, "deviceId", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], Config.prototype, "DeviceName", void 0);
|
|
29
37
|
exports.Config = Config = __decorate([
|
|
30
38
|
(0, typeorm_1.Entity)()
|
|
31
39
|
], Config);
|
package/dist/index.js
CHANGED
|
@@ -51,9 +51,10 @@ class WxBot extends events_1.EventEmitter {
|
|
|
51
51
|
fetchAndShowQRCode() {
|
|
52
52
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53
53
|
try {
|
|
54
|
+
const config = yield config_service_1.configService.get();
|
|
54
55
|
const response = yield LoginApi_1.loginApi.GetQR({
|
|
55
|
-
"DeviceID": "",
|
|
56
|
-
"DeviceName": "",
|
|
56
|
+
"DeviceID": (config === null || config === void 0 ? void 0 : config.deviceId) || "",
|
|
57
|
+
"DeviceName": (config === null || config === void 0 ? void 0 : config.DeviceName) || "",
|
|
57
58
|
"OSModel": "",
|
|
58
59
|
"Proxy": {
|
|
59
60
|
"ProxyIp": "",
|
|
@@ -107,7 +108,10 @@ class WxBot extends events_1.EventEmitter {
|
|
|
107
108
|
const statusData = statusResp.data;
|
|
108
109
|
if (statusData.Success) {
|
|
109
110
|
if (statusData.Message === '登陆成功') {
|
|
110
|
-
yield config_service_1.configService.save(
|
|
111
|
+
yield config_service_1.configService.save({
|
|
112
|
+
uuid: this.uuid,
|
|
113
|
+
wxid: statusData.Data.acctSectResp.userName,
|
|
114
|
+
});
|
|
111
115
|
this.loginSuccess(statusData.Data.acctSectResp.userName);
|
|
112
116
|
if (this.interval)
|
|
113
117
|
clearInterval(this.interval);
|
|
@@ -165,6 +169,14 @@ class WxBot extends events_1.EventEmitter {
|
|
|
165
169
|
return;
|
|
166
170
|
}
|
|
167
171
|
console.log('好友列表获取成功,开始更新联系人信息');
|
|
172
|
+
// 设置设备信息
|
|
173
|
+
const cacheInfo = yield LoginApi_1.loginApi.GetCacheInfo(userName);
|
|
174
|
+
if (cacheInfo.data.Message === '成功') {
|
|
175
|
+
yield config_service_1.configService.save({
|
|
176
|
+
deviceId: cacheInfo.data.Data.Deviceid_str,
|
|
177
|
+
DeviceName: cacheInfo.data.Data.DeviceName,
|
|
178
|
+
});
|
|
179
|
+
}
|
|
168
180
|
// 获取详情
|
|
169
181
|
const data = res.data;
|
|
170
182
|
data.Data.ContactUsernameList.forEach((contact) => {
|
|
@@ -2,7 +2,7 @@ import { Config } from '../entities/config.entity';
|
|
|
2
2
|
declare class ConfigService {
|
|
3
3
|
private get repo();
|
|
4
4
|
get(): Promise<Config | null>;
|
|
5
|
-
save(
|
|
5
|
+
save(config: Partial<Config>): Promise<Config>;
|
|
6
6
|
}
|
|
7
7
|
export declare const configService: ConfigService;
|
|
8
8
|
export {};
|
|
@@ -21,17 +21,17 @@ class ConfigService {
|
|
|
21
21
|
return this.repo.findOne({ where: {} });
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
save(
|
|
24
|
+
save(config) {
|
|
25
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
let
|
|
27
|
-
if (
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
let existingConfig = yield this.get();
|
|
27
|
+
if (existingConfig) {
|
|
28
|
+
Object.assign(existingConfig, config);
|
|
29
|
+
return this.repo.save(existingConfig);
|
|
30
30
|
}
|
|
31
31
|
else {
|
|
32
|
-
|
|
32
|
+
const newConfig = this.repo.create(config);
|
|
33
|
+
return this.repo.save(newConfig);
|
|
33
34
|
}
|
|
34
|
-
return this.repo.save(config);
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
}
|