mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-24 17:38:40 -06:00
adjusts in redis
This commit is contained in:
parent
76552f6ae5
commit
5d951a96b5
@ -72,7 +72,7 @@ export class RedisCache {
|
|||||||
try {
|
try {
|
||||||
this.logger.verbose('setData: ' + field);
|
this.logger.verbose('setData: ' + field);
|
||||||
const json = JSON.stringify(data, BufferJSON.replacer);
|
const json = JSON.stringify(data, BufferJSON.replacer);
|
||||||
await this.client.hSet(`${this.redisEnv.PREFIX_KEY}-${this.instanceName}`, field, json);
|
await this.client.hSet(this.redisEnv.PREFIX_KEY + ':' + this.instanceName, field, json);
|
||||||
return true;
|
return true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.logger.error(error);
|
this.logger.error(error);
|
||||||
@ -83,7 +83,7 @@ export class RedisCache {
|
|||||||
public async getData(field: string): Promise<any | null> {
|
public async getData(field: string): Promise<any | null> {
|
||||||
try {
|
try {
|
||||||
this.logger.verbose('getData: ' + field);
|
this.logger.verbose('getData: ' + field);
|
||||||
const data = await this.client.hGet(`${this.redisEnv.PREFIX_KEY}-${this.instanceName}`, field);
|
const data = await this.client.hGet(this.redisEnv.PREFIX_KEY + ':' + this.instanceName, field);
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
this.logger.verbose('getData: ' + field + ' success');
|
this.logger.verbose('getData: ' + field + ' success');
|
||||||
@ -101,7 +101,7 @@ export class RedisCache {
|
|||||||
public async removeData(field: string): Promise<boolean> {
|
public async removeData(field: string): Promise<boolean> {
|
||||||
try {
|
try {
|
||||||
this.logger.verbose('removeData: ' + field);
|
this.logger.verbose('removeData: ' + field);
|
||||||
await this.client.hDel(`${this.redisEnv.PREFIX_KEY}-${this.instanceName}`, field);
|
await this.client.hDel(this.redisEnv.PREFIX_KEY + ':' + this.instanceName, field);
|
||||||
return true;
|
return true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.logger.error(error);
|
this.logger.error(error);
|
||||||
@ -111,7 +111,7 @@ export class RedisCache {
|
|||||||
|
|
||||||
public async delAll(hash?: string): Promise<boolean> {
|
public async delAll(hash?: string): Promise<boolean> {
|
||||||
try {
|
try {
|
||||||
const targetHash = hash || `${this.redisEnv.PREFIX_KEY}-${this.instanceName}`;
|
const targetHash = hash || this.redisEnv.PREFIX_KEY + ':' + this.instanceName;
|
||||||
this.logger.verbose('instance delAll: ' + targetHash);
|
this.logger.verbose('instance delAll: ' + targetHash);
|
||||||
const result = await this.client.del(targetHash);
|
const result = await this.client.del(targetHash);
|
||||||
return !!result;
|
return !!result;
|
||||||
|
@ -641,8 +641,8 @@ export class InstanceController {
|
|||||||
const instance = this.waMonitor.waInstances[instanceName];
|
const instance = this.waMonitor.waInstances[instanceName];
|
||||||
|
|
||||||
console.log('mobileCode', mobileCode);
|
console.log('mobileCode', mobileCode);
|
||||||
return await instance.receiveMobileCode(mobileCode);
|
await instance.receiveMobileCode(mobileCode);
|
||||||
// return { status: 'SUCCESS', error: false, response: { message: 'Mobile code registered' } };
|
return { status: 'SUCCESS', error: false, response: { message: 'Mobile code registered' } };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.logger.error(error);
|
this.logger.error(error);
|
||||||
}
|
}
|
||||||
|
@ -634,15 +634,16 @@ export class BaileysStartupService extends WAStartupService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async receiveMobileCode(code: string) {
|
public async receiveMobileCode(code: string) {
|
||||||
await this.client
|
console.log('code', code);
|
||||||
.register(code.replace(/["']/g, '').trim().toLowerCase())
|
// await this.client
|
||||||
.then(async (response) => {
|
// .register(code.replace(/["']/g, '').trim().toLowerCase())
|
||||||
this.logger.verbose('Registration code received successfully');
|
// .then(async (response) => {
|
||||||
console.log(response);
|
// this.logger.verbose('Registration code received successfully');
|
||||||
})
|
// console.log(response);
|
||||||
.catch((error) => {
|
// })
|
||||||
this.logger.error(error);
|
// .catch((error) => {
|
||||||
});
|
// this.logger.error(error);
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
public async reloadConnection(): Promise<WASocket> {
|
public async reloadConnection(): Promise<WASocket> {
|
||||||
|
Loading…
Reference in New Issue
Block a user