composeFileUrl修改了接口参数
This commit is contained in:
parent
beae8eb15a
commit
9ad45192fa
|
|
@ -548,7 +548,7 @@ async function setUserInfoFromWechat(user, userInfo, context) {
|
|||
}
|
||||
if (avatar &&
|
||||
(extraFile$entity?.length === 0 ||
|
||||
composeFileUrl(extraFile$entity[0], context) !== avatar)) {
|
||||
composeFileUrl(extraFile$entity[0], application) !== avatar)) {
|
||||
// 需要更新新的avatar extra file
|
||||
const extraFileOperations = [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import { BRC, FRC } from '../../types/RuntimeCxt';
|
||||
import { EntityDict } from '../../oak-app-domain';
|
||||
import Cos from '../../types/Cos';
|
||||
/**
|
||||
|
|
@ -7,4 +6,4 @@ import Cos from '../../types/Cos';
|
|||
*/
|
||||
export declare function registerCos<ED extends EntityDict>(clazz: new () => Cos<ED>): void;
|
||||
export declare function getCos<ED extends EntityDict>(origin: string): Cos<ED>;
|
||||
export declare function composeFileUrl<ED extends EntityDict>(extraFile: ED['extraFile']['OpSchema'], context: BRC<ED> | FRC<ED>, style?: string): any;
|
||||
export declare function composeFileUrl<ED extends EntityDict>(extraFile: ED['extraFile']['OpSchema'], application: ED['application']['Schema'], style?: string): string;
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ export function getCos(origin) {
|
|||
assert(CosDict.hasOwnProperty(origin));
|
||||
return CosDict[origin];
|
||||
}
|
||||
export function composeFileUrl(extraFile, context, style) {
|
||||
export function composeFileUrl(extraFile, application, style) {
|
||||
const { origin } = extraFile;
|
||||
const cos = CosDict[origin];
|
||||
return cos.composeFileUrl(extraFile, context, style);
|
||||
return cos.composeFileUrl(extraFile, application, style);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -553,7 +553,7 @@ async function setUserInfoFromWechat(user, userInfo, context) {
|
|||
}
|
||||
if (avatar &&
|
||||
(extraFile$entity?.length === 0 ||
|
||||
(0, cos_1.composeFileUrl)(extraFile$entity[0], context) !== avatar)) {
|
||||
(0, cos_1.composeFileUrl)(extraFile$entity[0], application) !== avatar)) {
|
||||
// 需要更新新的avatar extra file
|
||||
const extraFileOperations = [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import { BRC, FRC } from '../../types/RuntimeCxt';
|
||||
import { EntityDict } from '../../oak-app-domain';
|
||||
import Cos from '../../types/Cos';
|
||||
/**
|
||||
|
|
@ -7,4 +6,4 @@ import Cos from '../../types/Cos';
|
|||
*/
|
||||
export declare function registerCos<ED extends EntityDict>(clazz: new () => Cos<ED>): void;
|
||||
export declare function getCos<ED extends EntityDict>(origin: string): Cos<ED>;
|
||||
export declare function composeFileUrl<ED extends EntityDict>(extraFile: ED['extraFile']['OpSchema'], context: BRC<ED> | FRC<ED>, style?: string): any;
|
||||
export declare function composeFileUrl<ED extends EntityDict>(extraFile: ED['extraFile']['OpSchema'], application: ED['application']['Schema'], style?: string): string;
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ function getCos(origin) {
|
|||
return CosDict[origin];
|
||||
}
|
||||
exports.getCos = getCos;
|
||||
function composeFileUrl(extraFile, context, style) {
|
||||
function composeFileUrl(extraFile, application, style) {
|
||||
const { origin } = extraFile;
|
||||
const cos = CosDict[origin];
|
||||
return cos.composeFileUrl(extraFile, context, style);
|
||||
return cos.composeFileUrl(extraFile, application, style);
|
||||
}
|
||||
exports.composeFileUrl = composeFileUrl;
|
||||
|
|
|
|||
|
|
@ -744,7 +744,7 @@ async function setUserInfoFromWechat<ED extends EntityDict>(
|
|||
if (
|
||||
avatar &&
|
||||
(extraFile$entity?.length === 0 ||
|
||||
composeFileUrl<ED>(extraFile$entity![0], context) !== avatar)
|
||||
composeFileUrl<ED>(extraFile$entity![0], application as ED['application']['Schema']) !== avatar)
|
||||
) {
|
||||
// 需要更新新的avatar extra file
|
||||
const extraFileOperations: ExtraFileOperation['data'][] = [
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ const ctyun = new CTYun();
|
|||
const qiniu = new Qiniu();
|
||||
const wechat = new Wechat();
|
||||
|
||||
const CosDict: Record<string, any> = {
|
||||
const CosDict: Record<string, Cos<EntityDict>> = {
|
||||
[qiniu.name]: qiniu,
|
||||
[wechat.name]: wechat,
|
||||
[ctyun.name]: ctyun,
|
||||
|
|
@ -23,7 +23,7 @@ const CosDict: Record<string, any> = {
|
|||
*/
|
||||
export function registerCos<ED extends EntityDict>(clazz: new () => Cos<ED>) {
|
||||
const instance = new clazz();
|
||||
CosDict[instance.name] = instance;
|
||||
CosDict[instance.name] = instance as Cos<EntityDict>;
|
||||
}
|
||||
|
||||
export function getCos<ED extends EntityDict>(origin: string) {
|
||||
|
|
@ -33,10 +33,10 @@ export function getCos<ED extends EntityDict>(origin: string) {
|
|||
|
||||
export function composeFileUrl<ED extends EntityDict>(
|
||||
extraFile: ED['extraFile']['OpSchema'],
|
||||
context: BRC<ED> | FRC<ED>,
|
||||
application: ED['application']['Schema'],
|
||||
style?: string
|
||||
) {
|
||||
const { origin } = extraFile;
|
||||
const cos = CosDict[origin];
|
||||
return cos.composeFileUrl(extraFile, context as any, style);
|
||||
return cos.composeFileUrl(extraFile, application, style);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue