edit
This commit is contained in:
@ -5,7 +5,7 @@ import { BaseService } from '../core/base.service';
|
||||
import { EACacheService } from './../core/cache.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class EAEnvironmentService extends BaseService {
|
||||
constructor(public injector: Injector, private eaCacheSrv: EACacheService) {
|
||||
@ -15,12 +15,13 @@ export class EAEnvironmentService extends BaseService {
|
||||
/**
|
||||
* 环境信息
|
||||
*/
|
||||
public get env(): { appId: string; tenantId: string } {
|
||||
public get env(): { appId: string; tenantId: string; enterpriseId: string } {
|
||||
const cacheEnv: any = this.eaCacheSrv.get(cacheConf.env);
|
||||
// 附加环境变量
|
||||
const env: { appId: string; tenantId: string } = {
|
||||
const env: { appId: string; tenantId: string; enterpriseId: string } = {
|
||||
appId: cacheEnv?.appId || sysConf.appId,
|
||||
tenantId: cacheEnv?.tenantId || sysConf.tenantId,
|
||||
enterpriseId: cacheEnv?.enterpriseId || sysConf.enterpriseId
|
||||
};
|
||||
return env;
|
||||
}
|
||||
|
||||
@ -135,6 +135,11 @@ export class EAUserService extends BaseService {
|
||||
*/
|
||||
async loadUserInfo() {
|
||||
return this.asyncRequest(this.$api_get_user_by_token).then(res => {
|
||||
this.cacheSrv.set(cacheConf.env, {
|
||||
appId: sysConf.appId,
|
||||
tenantId: res?.tenantId || sysConf.tenantId,
|
||||
enterpriseId: res?.enterpriseId || sysConf.enterpriseId
|
||||
});
|
||||
this.cacheSrv.set(cacheConf.user, res);
|
||||
this.settings.setUser(res);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user