格式化

This commit is contained in:
wuhan 2023-08-02 15:59:46 +08:00
parent a51f4d108f
commit c87d6af41b
2 changed files with 34 additions and 33 deletions

View File

@ -119,8 +119,8 @@ class ClientMapper {
//应用编码设置
async setAppCode(id, code, secretKey) {
const appCode= await this.getQueryAppCode(id)
if (appCode?.length){
const appCode = await this.getQueryAppCode(id);
if (appCode?.length) {
const arr = [];
let bool = false;
let str = 'update szja_app_info set ';
@ -139,15 +139,15 @@ class ClientMapper {
}
const data = await db(`${str} where finclip_id = ?`, [...arr, id]);
return data;
}else {
if (!id ||!code || !secretKey){
return false
} else {
if (!id || !code || !secretKey) {
return false;
}
let str='INSERT INTO szja_app_info (finclip_id, code, secret_key ) VALUES (?, ?, ? )'
const str =
'INSERT INTO szja_app_info (finclip_id, code, secret_key ) VALUES (?, ?, ? )';
const data = await db(str, [id, code, secretKey]);
return data;
}
}
/**
@ -196,19 +196,20 @@ class ClientMapper {
}
async setMPInfo(id, limitFlag, ssoAppKey, ssoAppSecret) {
const mpInfor=await this.getMpInfoById(id)
let str
if(!mpInfor?.length){
if (!id){
return false
const mpInfor = await this.getMpInfoById(id);
let str;
if (!mpInfor?.length) {
if (!id) {
return false;
}
if (!limitFlag){
limitFlag='000000'
if (!limitFlag) {
limitFlag = '000000';
}
str='INSERT INTO szja_mp_info (mp_id, limit_flag, sso_app_key, sso_app_secret ) VALUES (?, ?, ?, ? )'
str =
'INSERT INTO szja_mp_info (mp_id, limit_flag, sso_app_key, sso_app_secret ) VALUES (?, ?, ?, ? )';
const data = await db(str, [id, limitFlag, ssoAppKey, ssoAppSecret]);
return data;
}else {
} else {
str = 'update szja_mp_info set';
const arr = [];
let bool = false;

View File

@ -60,8 +60,8 @@ export class ClientService {
info.client_id,
);
return Base.success({
'clientId':info.client_id,
'clientSecret':info.client_secret
clientId: info.client_id,
clientSecret: info.client_secret,
});
} else {
// 初始化秘钥
@ -72,8 +72,8 @@ export class ClientService {
info.type = 0;
await clientMapper.addClientInfoByObj(info);
return Base.success({
'clientId':info.client_id,
'clientSecret':info.client_secret
clientId: info.client_id,
clientSecret: info.client_secret,
});
}
}
@ -83,9 +83,9 @@ export class ClientService {
* @param entName
*/
async queryEntList(entName) {
const data = await clientMapper.queryEntList(entName)
if (!data?.length){
return Base.error()
const data = await clientMapper.queryEntList(entName);
if (!data?.length) {
return Base.error();
}
return Base.success(data);
}
@ -111,7 +111,7 @@ export class ClientService {
return Base.success({
clientId: info.client_id,
clientSecret: info.client_secret,
encoding_key: info.encodingKey||'',
encoding_key: info.encodingKey || '',
});
} else {
// 初始化
@ -133,8 +133,8 @@ export class ClientService {
async queryEntAuth(entId) {
const queryEntAuth = await clientMapper.getQueryEntAuth(entId);
if (!queryEntAuth?.length){
return Base.error()
if (!queryEntAuth?.length) {
return Base.error();
}
const data = {
clientId: queryEntAuth[0].clientId,
@ -153,11 +153,11 @@ export class ClientService {
if (id) {
data = await clientMapper.getMpInfoById(id);
} else {
return Base.error('传参错误')
return Base.error('传参错误');
}
if (data?.length){
if (data?.length) {
return Base.success(data[0]);
}else {
} else {
return Base.error();
}
}
@ -294,8 +294,8 @@ export class ClientService {
*/
async queryAppCode(id) {
const data = await clientMapper.getQueryAppCode(id);
if(!data?.length){
return Base.error()
if (!data?.length) {
return Base.error();
}
return Base.success(data[0]);
}
@ -320,8 +320,8 @@ export class ClientService {
*/
async queryAreaInfo() {
const data = await clientMapper.getQueryAreaInfo();
if (!data?.length){
return Base.error()
if (!data?.length) {
return Base.error();
}
return Base.success(data[0]);
}