删除了shipAccount中默认的bizId
This commit is contained in:
parent
13bd23414d
commit
061c0bb2cf
|
|
@ -18,10 +18,10 @@ declare const List: <T extends keyof EntityDict>(props: ReactComponentProps<Enti
|
|||
data: RowWithActions<EntityDict, T>[];
|
||||
loading: boolean;
|
||||
tablePagination?: React.ReactNode;
|
||||
rowSelection?: import("antd/es/table/interface").TableRowSelection<RowWithActions<EntityDict, T>> | undefined;
|
||||
rowSelection?: any;
|
||||
hideHeader?: boolean | undefined;
|
||||
disableSerialNumber?: boolean | undefined;
|
||||
size?: "small" | "middle" | "large" | undefined;
|
||||
size?: "small" | "large" | "middle" | undefined;
|
||||
scroll?: ({
|
||||
x?: string | number | true | undefined;
|
||||
y?: string | number | undefined;
|
||||
|
|
@ -46,21 +46,16 @@ declare const ListPro: <T extends keyof EntityDict>(props: {
|
|||
data: RowWithActions<EntityDict, T>[];
|
||||
loading?: boolean | undefined;
|
||||
tablePagination?: any;
|
||||
rowSelection?: import("antd/es/table/interface").TableRowSelection<RowWithActions<EntityDict, T>> | undefined;
|
||||
rowSelection?: any;
|
||||
disableSerialNumber?: boolean | undefined;
|
||||
size?: "small" | "middle" | "large" | undefined;
|
||||
scroll?: ({
|
||||
x?: string | number | true | undefined;
|
||||
y?: string | number | undefined;
|
||||
} & {
|
||||
scrollToFirstRowOnChange?: boolean | undefined;
|
||||
}) | undefined;
|
||||
size?: "small" | "large" | "middle" | undefined;
|
||||
scroll?: any;
|
||||
empty?: any;
|
||||
opWidth?: number | undefined;
|
||||
oakPath?: string | undefined;
|
||||
}) => React.ReactElement;
|
||||
declare const Detail: <T extends keyof EntityDict>(props: ReactComponentProps<EntityDict, T, false, {
|
||||
column?: number | Record<import("antd").Breakpoint, number> | undefined;
|
||||
column?: number | Record<Breakpoint, number> | undefined;
|
||||
entity: T;
|
||||
attributes: OakAbsAttrDef[];
|
||||
data: Partial<EntityDict[T]["Schema"]>;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,3 @@
|
|||
/**
|
||||
* 抽象组件在业务层根据EntityDict的重新声明
|
||||
* by Xc 20230807
|
||||
*/
|
||||
import AbsFilterPanel from 'oak-frontend-base/es/components/filterPanel';
|
||||
import AbsList from 'oak-frontend-base/es/components/list';
|
||||
import AbsListPro from 'oak-frontend-base/es/components/listPro';
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
{
|
||||
"help": {
|
||||
"bizId": "如果设置了面单Id,在下快递单时就会默认使用这个Id,但仍然可以在下单时传入新的面单Id来覆盖。如果没有设置,在下单时也不传入,则按微信小程序物流的文档,对顺丰和德邦会使用散单Id,其余物流报错。见https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/business/introduction.html",
|
||||
"disabled": "小程序支付的物流能力默认必须开启,如果您申请的小程序是特殊行业,已向微信申请取消物流能力,在此可以关闭",
|
||||
"sort": "小程序关联物流默认拥有最高的优先级,不需要调整"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,13 +11,6 @@ export default function render(props) {
|
|||
wpProductId: value,
|
||||
});
|
||||
}}/> : <Input disabled={true} value={wechatMpShip.wpProduct.application.name}/>}
|
||||
</Form.Item>
|
||||
<Form.Item label={t('wechatMpShip:attr.bizId')} help={t('help.bizId')}>
|
||||
<Input value={wechatMpShip.bizId || ''} onChange={({ currentTarget }) => {
|
||||
update({
|
||||
bizId: currentTarget.value,
|
||||
});
|
||||
}}/>
|
||||
</Form.Item>
|
||||
<Form.Item label={t('wechatMpShip:attr.disabled')} help={t('help.disabled')}>
|
||||
<Switch value={!!wechatMpShip.disabled} onChange={(v) => {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ export default function render(props) {
|
|||
setUpsertId(ele.id);
|
||||
}}/>}>
|
||||
<Detail key={idx} column={1} bordered entity="wechatMpShip" attributes={[
|
||||
"bizId",
|
||||
"disabled",
|
||||
"sort",
|
||||
]} data={ele}/>
|
||||
|
|
|
|||
|
|
@ -332,7 +332,6 @@ const i18ns = [
|
|||
position: "src/components/ship/wechatMpShip/upsert",
|
||||
data: {
|
||||
"help": {
|
||||
"bizId": "如果设置了面单Id,在下快递单时就会默认使用这个Id,但仍然可以在下单时传入新的面单Id来覆盖。如果没有设置,在下单时也不传入,则按微信小程序物流的文档,对顺丰和德邦会使用散单Id,其余物流报错。见https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/business/introduction.html",
|
||||
"disabled": "小程序支付的物流能力默认必须开启,如果您申请的小程序是特殊行业,已向微信申请取消物流能力,在此可以关闭",
|
||||
"sort": "小程序关联物流默认拥有最高的优先级,不需要调整"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import { String, Int, Decimal } from 'oak-domain/lib/types/DataType';
|
|||
import { EntityShape } from 'oak-domain/lib/types/Entity';
|
||||
import { EntityDesc } from 'oak-domain/lib/types';
|
||||
export interface Schema extends EntityShape {
|
||||
bizId?: String<128>;
|
||||
sort: Decimal<12, 8>;
|
||||
phatom1?: Int<8>;
|
||||
phatom2?: String<64>;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ export const entityDesc = {
|
|||
attr: {
|
||||
phatom1: '备用属性一',
|
||||
phatom2: '备用属性二',
|
||||
bizId: '面单Id',
|
||||
sort: '排序',
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ export const entityDesc = {
|
|||
zh_CN: {
|
||||
name: '微信小程序快递帐号',
|
||||
attr: {
|
||||
bizId: '面单Id',
|
||||
sort: '排序',
|
||||
phatom1: '备用属性一',
|
||||
phatom2: '备用属性二',
|
||||
|
|
|
|||
|
|
@ -1,12 +1,6 @@
|
|||
import { genericActions as actions } from "oak-domain/lib/actions/action";
|
||||
export const desc = {
|
||||
attributes: {
|
||||
bizId: {
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 128
|
||||
}
|
||||
},
|
||||
sort: {
|
||||
notNull: true,
|
||||
type: "decimal",
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
import { Q_DateValue, Q_NumberValue, Q_StringValue, NodeId, ExprOp, ExpressionKey } from "oak-domain/lib/types/Demand";
|
||||
import { MakeAction as OakMakeAction, EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { GenericAction } from "oak-domain/lib/actions/action";
|
||||
import { String, Decimal, Int } from "oak-domain/lib/types/DataType";
|
||||
import { Decimal, Int, String } from "oak-domain/lib/types/DataType";
|
||||
export type OpSchema = EntityShape & {
|
||||
bizId?: String<128> | null;
|
||||
sort: Decimal<12, 8>;
|
||||
phatom1?: Int<8> | null;
|
||||
phatom2?: String<64> | null;
|
||||
|
|
@ -16,7 +15,6 @@ export type OpFilter = {
|
|||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_NumberValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
bizId: Q_StringValue;
|
||||
sort: Q_NumberValue;
|
||||
phatom1: Q_NumberValue;
|
||||
phatom2: Q_StringValue;
|
||||
|
|
@ -28,7 +26,6 @@ export type OpProjection = {
|
|||
$$createAt$$?: number;
|
||||
$$updateAt$$?: number;
|
||||
$$seq$$?: number;
|
||||
bizId?: number;
|
||||
sort?: number;
|
||||
phatom1?: number;
|
||||
phatom2?: number;
|
||||
|
|
@ -38,7 +35,6 @@ export type OpSortAttr = Partial<{
|
|||
$$createAt$$: number;
|
||||
$$seq$$: number;
|
||||
$$updateAt$$: number;
|
||||
bizId: number;
|
||||
sort: number;
|
||||
phatom1: number;
|
||||
phatom2: number;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
"attr": {
|
||||
"phatom1": "备用属性一",
|
||||
"phatom2": "备用属性二",
|
||||
"bizId": "面单Id",
|
||||
"sort": "排序"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,6 @@
|
|||
import { genericActions as actions } from "oak-domain/lib/actions/action";
|
||||
export const desc = {
|
||||
attributes: {
|
||||
bizId: {
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 128
|
||||
}
|
||||
},
|
||||
sort: {
|
||||
notNull: true,
|
||||
type: "decimal",
|
||||
|
|
|
|||
|
|
@ -2,9 +2,8 @@ import { ForeignKey } from "oak-domain/lib/types/DataType";
|
|||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, NodeId, ExprOp, ExpressionKey } from "oak-domain/lib/types/Demand";
|
||||
import { MakeAction as OakMakeAction, EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { GenericAction } from "oak-domain/lib/actions/action";
|
||||
import { String, Decimal, Int, Boolean } from "oak-domain/lib/types/DataType";
|
||||
import { Decimal, Int, String, Boolean } from "oak-domain/lib/types/DataType";
|
||||
export type OpSchema = EntityShape & {
|
||||
bizId?: String<128> | null;
|
||||
sort: Decimal<12, 8>;
|
||||
phatom1?: Int<8> | null;
|
||||
phatom2?: String<64> | null;
|
||||
|
|
@ -20,7 +19,6 @@ export type OpFilter = {
|
|||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_NumberValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
bizId: Q_StringValue;
|
||||
sort: Q_NumberValue;
|
||||
phatom1: Q_NumberValue;
|
||||
phatom2: Q_StringValue;
|
||||
|
|
@ -35,7 +33,6 @@ export type OpProjection = {
|
|||
$$createAt$$?: number;
|
||||
$$updateAt$$?: number;
|
||||
$$seq$$?: number;
|
||||
bizId?: number;
|
||||
sort?: number;
|
||||
phatom1?: number;
|
||||
phatom2?: number;
|
||||
|
|
@ -48,7 +45,6 @@ export type OpSortAttr = Partial<{
|
|||
$$createAt$$: number;
|
||||
$$seq$$: number;
|
||||
$$updateAt$$: number;
|
||||
bizId: number;
|
||||
sort: number;
|
||||
phatom1: number;
|
||||
phatom2: number;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
"name": "微信小程序快递帐号",
|
||||
"attr": {
|
||||
"bizId": "面单Id",
|
||||
"sort": "排序",
|
||||
"phatom1": "备用属性一",
|
||||
"phatom2": "备用属性二",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
import { EntityDict } from '../../oak-app-domain';
|
||||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity';
|
||||
import ShipClazz from '../../types/ShipClazz';
|
||||
import { BRC } from '../../types/RuntimeCxt';
|
||||
import { StorageSchema } from 'oak-domain/lib/types/Storage';
|
||||
type ShipClazzConstructor = (entityId: string, context: BRC) => Promise<ShipClazz>;
|
||||
export declare function registerShipClazzEntity<ED extends EntityDict & BaseEntityDict, T extends keyof ED>(entity: T, clazzConstructor: ShipClazzConstructor, schema: StorageSchema<ED>): void;
|
||||
export declare function getShipClazz(ship: EntityDict['ship']['OpSchema'], context: BRC): Promise<ShipClazz>;
|
||||
export {};
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
import assert from 'assert';
|
||||
let MODULE_USED = false;
|
||||
const ShipClazzDict = {};
|
||||
const ShipClazzEntityDict = {};
|
||||
export function registerShipClazzEntity(entity, clazzConstructor, schema) {
|
||||
assert(!MODULE_USED);
|
||||
assert(!ShipClazzEntityDict.hasOwnProperty(entity));
|
||||
const { attributes } = schema[entity];
|
||||
assert(attributes.bizId && attributes.bizId.type === 'varchar');
|
||||
assert(attributes.sort && attributes.sort.type === 'decimal');
|
||||
ShipClazzEntityDict[entity] = clazzConstructor;
|
||||
}
|
||||
export async function getShipClazz(ship, context) {
|
||||
if (!MODULE_USED) {
|
||||
MODULE_USED = true;
|
||||
}
|
||||
const { entity, entityId } = ship;
|
||||
const key = `${entity}.${entityId}`;
|
||||
if (ShipClazzDict[key]) {
|
||||
return ShipClazzDict[key];
|
||||
}
|
||||
const clazz = await ShipClazzEntityDict[entity](entityId, context);
|
||||
ShipClazzDict[key] = clazz;
|
||||
return clazz;
|
||||
}
|
||||
|
|
@ -334,7 +334,6 @@ const i18ns = [
|
|||
position: "src/components/ship/wechatMpShip/upsert",
|
||||
data: {
|
||||
"help": {
|
||||
"bizId": "如果设置了面单Id,在下快递单时就会默认使用这个Id,但仍然可以在下单时传入新的面单Id来覆盖。如果没有设置,在下单时也不传入,则按微信小程序物流的文档,对顺丰和德邦会使用散单Id,其余物流报错。见https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/business/introduction.html",
|
||||
"disabled": "小程序支付的物流能力默认必须开启,如果您申请的小程序是特殊行业,已向微信申请取消物流能力,在此可以关闭",
|
||||
"sort": "小程序关联物流默认拥有最高的优先级,不需要调整"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import { String, Int, Decimal } from 'oak-domain/lib/types/DataType';
|
|||
import { EntityShape } from 'oak-domain/lib/types/Entity';
|
||||
import { EntityDesc } from 'oak-domain/lib/types';
|
||||
export interface Schema extends EntityShape {
|
||||
bizId?: String<128>;
|
||||
sort: Decimal<12, 8>;
|
||||
phatom1?: Int<8>;
|
||||
phatom2?: String<64>;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ exports.entityDesc = {
|
|||
attr: {
|
||||
phatom1: '备用属性一',
|
||||
phatom2: '备用属性二',
|
||||
bizId: '面单Id',
|
||||
sort: '排序',
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ exports.entityDesc = {
|
|||
zh_CN: {
|
||||
name: '微信小程序快递帐号',
|
||||
attr: {
|
||||
bizId: '面单Id',
|
||||
sort: '排序',
|
||||
phatom1: '备用属性一',
|
||||
phatom2: '备用属性二',
|
||||
|
|
|
|||
|
|
@ -4,12 +4,6 @@ exports.desc = void 0;
|
|||
const action_1 = require("oak-domain/lib/actions/action");
|
||||
exports.desc = {
|
||||
attributes: {
|
||||
bizId: {
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 128
|
||||
}
|
||||
},
|
||||
sort: {
|
||||
notNull: true,
|
||||
type: "decimal",
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
import { Q_DateValue, Q_NumberValue, Q_StringValue, NodeId, ExprOp, ExpressionKey } from "oak-domain/lib/types/Demand";
|
||||
import { MakeAction as OakMakeAction, EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { GenericAction } from "oak-domain/lib/actions/action";
|
||||
import { String, Decimal, Int } from "oak-domain/lib/types/DataType";
|
||||
import { Decimal, Int, String } from "oak-domain/lib/types/DataType";
|
||||
export type OpSchema = EntityShape & {
|
||||
bizId?: String<128> | null;
|
||||
sort: Decimal<12, 8>;
|
||||
phatom1?: Int<8> | null;
|
||||
phatom2?: String<64> | null;
|
||||
|
|
@ -16,7 +15,6 @@ export type OpFilter = {
|
|||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_NumberValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
bizId: Q_StringValue;
|
||||
sort: Q_NumberValue;
|
||||
phatom1: Q_NumberValue;
|
||||
phatom2: Q_StringValue;
|
||||
|
|
@ -28,7 +26,6 @@ export type OpProjection = {
|
|||
$$createAt$$?: number;
|
||||
$$updateAt$$?: number;
|
||||
$$seq$$?: number;
|
||||
bizId?: number;
|
||||
sort?: number;
|
||||
phatom1?: number;
|
||||
phatom2?: number;
|
||||
|
|
@ -38,7 +35,6 @@ export type OpSortAttr = Partial<{
|
|||
$$createAt$$: number;
|
||||
$$seq$$: number;
|
||||
$$updateAt$$: number;
|
||||
bizId: number;
|
||||
sort: number;
|
||||
phatom1: number;
|
||||
phatom2: number;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
"attr": {
|
||||
"phatom1": "备用属性一",
|
||||
"phatom2": "备用属性二",
|
||||
"bizId": "面单Id",
|
||||
"sort": "排序"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,12 +4,6 @@ exports.desc = void 0;
|
|||
const action_1 = require("oak-domain/lib/actions/action");
|
||||
exports.desc = {
|
||||
attributes: {
|
||||
bizId: {
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 128
|
||||
}
|
||||
},
|
||||
sort: {
|
||||
notNull: true,
|
||||
type: "decimal",
|
||||
|
|
|
|||
|
|
@ -2,9 +2,8 @@ import { ForeignKey } from "oak-domain/lib/types/DataType";
|
|||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, NodeId, ExprOp, ExpressionKey } from "oak-domain/lib/types/Demand";
|
||||
import { MakeAction as OakMakeAction, EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { GenericAction } from "oak-domain/lib/actions/action";
|
||||
import { String, Decimal, Int, Boolean } from "oak-domain/lib/types/DataType";
|
||||
import { Decimal, Int, String, Boolean } from "oak-domain/lib/types/DataType";
|
||||
export type OpSchema = EntityShape & {
|
||||
bizId?: String<128> | null;
|
||||
sort: Decimal<12, 8>;
|
||||
phatom1?: Int<8> | null;
|
||||
phatom2?: String<64> | null;
|
||||
|
|
@ -20,7 +19,6 @@ export type OpFilter = {
|
|||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_NumberValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
bizId: Q_StringValue;
|
||||
sort: Q_NumberValue;
|
||||
phatom1: Q_NumberValue;
|
||||
phatom2: Q_StringValue;
|
||||
|
|
@ -35,7 +33,6 @@ export type OpProjection = {
|
|||
$$createAt$$?: number;
|
||||
$$updateAt$$?: number;
|
||||
$$seq$$?: number;
|
||||
bizId?: number;
|
||||
sort?: number;
|
||||
phatom1?: number;
|
||||
phatom2?: number;
|
||||
|
|
@ -48,7 +45,6 @@ export type OpSortAttr = Partial<{
|
|||
$$createAt$$: number;
|
||||
$$seq$$: number;
|
||||
$$updateAt$$: number;
|
||||
bizId: number;
|
||||
sort: number;
|
||||
phatom1: number;
|
||||
phatom2: number;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
"name": "微信小程序快递帐号",
|
||||
"attr": {
|
||||
"bizId": "面单Id",
|
||||
"sort": "排序",
|
||||
"phatom1": "备用属性一",
|
||||
"phatom2": "备用属性二",
|
||||
|
|
|
|||
|
|
@ -6,6 +6,6 @@ import { BRC } from '../types/RuntimeCxt';
|
|||
* @param context
|
||||
* @param refunds
|
||||
*/
|
||||
export declare function updateWithdrawState(context: BRC, id: string): Promise<0 | 1>;
|
||||
export declare function updateWithdrawState(context: BRC, id: string): Promise<1 | 0>;
|
||||
declare const triggers: Trigger<EntityDict, 'withdraw', BRC>[];
|
||||
export default triggers;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
import { EntityDict } from '../../oak-app-domain';
|
||||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity';
|
||||
import ShipClazz from '../../types/ShipClazz';
|
||||
import { BRC } from '../../types/RuntimeCxt';
|
||||
import { StorageSchema } from 'oak-domain/lib/types/Storage';
|
||||
type ShipClazzConstructor = (entityId: string, context: BRC) => Promise<ShipClazz>;
|
||||
export declare function registerShipClazzEntity<ED extends EntityDict & BaseEntityDict, T extends keyof ED>(entity: T, clazzConstructor: ShipClazzConstructor, schema: StorageSchema<ED>): void;
|
||||
export declare function getShipClazz(ship: EntityDict['ship']['OpSchema'], context: BRC): Promise<ShipClazz>;
|
||||
export {};
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getShipClazz = exports.registerShipClazzEntity = void 0;
|
||||
const tslib_1 = require("tslib");
|
||||
const assert_1 = tslib_1.__importDefault(require("assert"));
|
||||
let MODULE_USED = false;
|
||||
const ShipClazzDict = {};
|
||||
const ShipClazzEntityDict = {};
|
||||
function registerShipClazzEntity(entity, clazzConstructor, schema) {
|
||||
(0, assert_1.default)(!MODULE_USED);
|
||||
(0, assert_1.default)(!ShipClazzEntityDict.hasOwnProperty(entity));
|
||||
const { attributes } = schema[entity];
|
||||
(0, assert_1.default)(attributes.bizId && attributes.bizId.type === 'varchar');
|
||||
(0, assert_1.default)(attributes.sort && attributes.sort.type === 'decimal');
|
||||
ShipClazzEntityDict[entity] = clazzConstructor;
|
||||
}
|
||||
exports.registerShipClazzEntity = registerShipClazzEntity;
|
||||
async function getShipClazz(ship, context) {
|
||||
if (!MODULE_USED) {
|
||||
MODULE_USED = true;
|
||||
}
|
||||
const { entity, entityId } = ship;
|
||||
const key = `${entity}.${entityId}`;
|
||||
if (ShipClazzDict[key]) {
|
||||
return ShipClazzDict[key];
|
||||
}
|
||||
const clazz = await ShipClazzEntityDict[entity](entityId, context);
|
||||
ShipClazzDict[key] = clazz;
|
||||
return clazz;
|
||||
}
|
||||
exports.getShipClazz = getShipClazz;
|
||||
|
|
@ -2,9 +2,6 @@
|
|||
* 抽象组件在业务层根据EntityDict的重新声明
|
||||
* by Xc 20230807
|
||||
*/
|
||||
|
||||
|
||||
|
||||
// @ts-nocheck
|
||||
import React from 'react';
|
||||
import { EntityDict } from '../oak-app-domain';
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
{
|
||||
"help": {
|
||||
"bizId": "如果设置了面单Id,在下快递单时就会默认使用这个Id,但仍然可以在下单时传入新的面单Id来覆盖。如果没有设置,在下单时也不传入,则按微信小程序物流的文档,对顺丰和德邦会使用散单Id,其余物流报错。见https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/business/introduction.html",
|
||||
"disabled": "小程序支付的物流能力默认必须开启,如果您申请的小程序是特殊行业,已向微信申请取消物流能力,在此可以关闭",
|
||||
"sort": "小程序关联物流默认拥有最高的优先级,不需要调整"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,19 +37,6 @@ export default function render(props: WebComponentProps<EntityDict, 'wechatMpShi
|
|||
/>
|
||||
}
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t('wechatMpShip:attr.bizId')}
|
||||
help={t('help.bizId')}
|
||||
>
|
||||
<Input
|
||||
value={wechatMpShip.bizId || ''}
|
||||
onChange={({ currentTarget }) => {
|
||||
update({
|
||||
bizId: currentTarget.value!,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t('wechatMpShip:attr.disabled')}
|
||||
help={t('help.disabled')}
|
||||
|
|
|
|||
|
|
@ -76,7 +76,6 @@ export default function render(props: WebComponentProps<EntityDict, 'wechatMpShi
|
|||
bordered
|
||||
entity="wechatMpShip"
|
||||
attributes={[
|
||||
"bizId",
|
||||
"disabled",
|
||||
"sort",
|
||||
]}
|
||||
|
|
|
|||
|
|
@ -334,7 +334,6 @@ const i18ns: I18n[] = [
|
|||
position: "src/components/ship/wechatMpShip/upsert",
|
||||
data: {
|
||||
"help": {
|
||||
"bizId": "如果设置了面单Id,在下快递单时就会默认使用这个Id,但仍然可以在下单时传入新的面单Id来覆盖。如果没有设置,在下单时也不传入,则按微信小程序物流的文档,对顺丰和德邦会使用散单Id,其余物流报错。见https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/business/introduction.html",
|
||||
"disabled": "小程序支付的物流能力默认必须开启,如果您申请的小程序是特殊行业,已向微信申请取消物流能力,在此可以关闭",
|
||||
"sort": "小程序关联物流默认拥有最高的优先级,不需要调整"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import { EntityShape } from 'oak-domain/lib/types/Entity';
|
|||
import { EntityDesc, ActionDef } from 'oak-domain/lib/types';
|
||||
|
||||
export interface Schema extends EntityShape {
|
||||
bizId?: String<128>; // 全局的面单id,可以不设置,在下单的时候传业务逻辑中的bizId来代替
|
||||
sort: Decimal<12, 8>; // 优先级高的会被优先使用来下快递
|
||||
phatom1?: Int<8>;
|
||||
phatom2?: String<64>;
|
||||
|
|
@ -25,7 +24,6 @@ export const entityDesc: EntityDesc<Schema> = {
|
|||
attr: {
|
||||
phatom1: '备用属性一',
|
||||
phatom2: '备用属性二',
|
||||
bizId: '面单Id',
|
||||
sort: '排序',
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ export const entityDesc: EntityDesc<Schema> = {
|
|||
zh_CN: {
|
||||
name: '微信小程序快递帐号',
|
||||
attr: {
|
||||
bizId: '面单Id',
|
||||
sort: '排序',
|
||||
phatom1: '备用属性一',
|
||||
phatom2: '备用属性二',
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
import { EntityDict } from '../../oak-app-domain';
|
||||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity';
|
||||
import ShipClazz from '../../types/ShipClazz';
|
||||
import { BRC } from '../../types/RuntimeCxt';
|
||||
import assert from 'assert';
|
||||
import { StorageSchema } from 'oak-domain/lib/types/Storage';
|
||||
let MODULE_USED = false;
|
||||
|
||||
type ShipClazzConstructor = (entityId: string, context: BRC) => Promise<ShipClazz>;
|
||||
const ShipClazzDict: Record<string, ShipClazz> = {};
|
||||
const ShipClazzEntityDict: Record<string, ShipClazzConstructor> = {};
|
||||
|
||||
export function registerShipClazzEntity<ED extends EntityDict & BaseEntityDict, T extends keyof ED>(
|
||||
entity: T,
|
||||
clazzConstructor: ShipClazzConstructor,
|
||||
schema: StorageSchema<ED>
|
||||
) {
|
||||
assert(!MODULE_USED);
|
||||
assert(!ShipClazzEntityDict.hasOwnProperty(entity));
|
||||
|
||||
const { attributes } = schema[entity];
|
||||
assert(attributes.bizId && attributes.bizId.type === 'varchar');
|
||||
assert(attributes.sort && attributes.sort.type === 'decimal');
|
||||
|
||||
ShipClazzEntityDict[entity as string] = clazzConstructor;
|
||||
}
|
||||
|
||||
|
||||
export async function getShipClazz(ship: EntityDict['ship']['OpSchema'], context: BRC) {
|
||||
if (!MODULE_USED) {
|
||||
MODULE_USED = true;
|
||||
}
|
||||
|
||||
const { entity, entityId } = ship;
|
||||
const key = `${entity}.${entityId}`;
|
||||
|
||||
if (ShipClazzDict[key]) {
|
||||
return ShipClazzDict[key];
|
||||
}
|
||||
|
||||
const clazz = await ShipClazzEntityDict[entity!](entityId!, context);
|
||||
ShipClazzDict[key] = clazz;
|
||||
|
||||
return clazz;
|
||||
}
|
||||
Loading…
Reference in New Issue