Commit dbab6213 by Sixong.Zhu

update

parent a19ba6d9
Showing with 3 additions and 12 deletions
......@@ -12,31 +12,22 @@ export class BenefitInvoker {
private static readonly subProject = 'welfare_v2';
private static readonly unsetupError = '服务尚未初始化';
private static sdk: UniplatSdk | null = null;
private static org = 0;
private static entrance = '';
public static setup(sdk: UniplatSdk, org: number, entrance: string) {
public static setup(sdk: UniplatSdk) {
this.sdk = sdk;
this.org = org;
this.entrance = entrance;
return this;
}
public static get<T>(service: BenefitServiceName, api: BenefitApiName) {
if (this.sdk) {
return this.sdk.domainService(this.subProject, service, api).request<{}, {}, T>('get', {
headers: { CurrentOrg: this.org, Entrance: this.entrance }
});
return this.sdk.domainService(this.subProject, service, api).request<{}, {}, T>('get');
}
return Promise.reject(this.unsetupError);
}
public static post<T>(service: BenefitServiceName, api: BenefitApiName, data?: any) {
if (this.sdk) {
return this.sdk.domainService(this.subProject, service, api).request<{}, {}, T>('post', {
data,
headers: { CurrentOrg: this.org, Entrance: this.entrance }
});
return this.sdk.domainService(this.subProject, service, api).request<{}, {}, T>('post', { data });
}
return Promise.reject(this.unsetupError);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment