Commit da2f52b0 by Sixong.Zhu

u

parent 40c9fa73
Showing with 5 additions and 3 deletions
......@@ -12,22 +12,24 @@ export class BenefitInvoker {
private static readonly subProject = 'welfare_v2';
private static readonly unsetupError = '服务尚未初始化';
private static sdk: UniplatSdk | null = null;
private static org = 0;
public static setup(sdk: UniplatSdk) {
public static setup(sdk: UniplatSdk, org: number) {
this.sdk = sdk;
this.org = org;
return this;
}
public static get<T>(service: BenefitServiceName, api: BenefitApiName) {
if (this.sdk) {
return this.sdk.domainService(this.subProject, service, api).request<{}, {}, T>('get');
return this.sdk.domainService(this.subProject, service, api).request<{}, {}, T>('get', { headers: { CurrentOrg: this.org } });
}
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 });
return this.sdk.domainService(this.subProject, service, api).request<{}, {}, T>('post', { data, headers: { CurrentOrg: this.org } });
}
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