diff --git a/es/checkers/pay.js b/es/checkers/pay.js index 8206cee2..29ddf22b 100644 --- a/es/checkers/pay.js +++ b/es/checkers/pay.js @@ -1,5 +1,4 @@ import { OakAttrNotNullException, OakInputIllegalException } from 'oak-domain/lib/types'; -import { pipeline } from 'oak-domain/lib/utils/executor'; import assert from 'assert'; const checkers = [ { @@ -112,32 +111,35 @@ const checkers = [ } } }, - { + /* { // 如果在开始支付或者继续支付过程中,paid达到了price,pay的状态可以改为paid entity: 'pay', type: 'logical', action: ['continuePaying', 'startPaying'], // priority: CHECKER_MAX_PRIORITY - 1, // 要超过action矩阵定义的赋state值 checker: (operation, context) => { - const { data, filter } = operation; + const { data, filter } = operation as EntityDict['pay']['Update']; assert(filter && typeof filter.id === 'string'); const { paid } = data || {}; if (paid) { - return pipeline(() => context.select('pay', { - data: { - id: 1, - paid: 1, - price: 1, - }, - }, {}), (pays) => { - const [pay] = pays; - const { paid: payPaid, price } = pay; - if (payPaid + paid === price) { - data.iState === 'paid'; + return pipeline( + () => context.select('pay', { + data: { + id: 1, + paid: 1, + price: 1, + }, + }, {}), + (pays: EntityDict['pay']['OpSchema'][]) => { + const [pay] = pays; + const { paid: payPaid, price } = pay; + if (payPaid + paid === price) { + data.iState === 'paid'; + } } - }); + ) } } - } + } */ ]; export default checkers; diff --git a/es/components/AbstractComponents.d.ts b/es/components/AbstractComponents.d.ts index 499939d7..0c48143a 100644 --- a/es/components/AbstractComponents.d.ts +++ b/es/components/AbstractComponents.d.ts @@ -61,14 +61,14 @@ declare const Detail: (props: ReactComponentProps; title?: string | undefined; bordered?: boolean | undefined; - layout?: "vertical" | "horizontal" | undefined; + layout?: "horizontal" | "vertical" | undefined; }>) => React.ReactElement; declare const Upsert: (props: ReactComponentProps; entity: T; attributes: OakAbsAttrUpsertDef[]; data: EntityDict[T]["Schema"]; - layout: "vertical" | "horizontal"; + layout: "horizontal" | "vertical"; mode: "default" | "card"; }>) => React.ReactElement; export { FilterPanel, List, ListPro, Detail, Upsert, ReactComponentProps, ColumnProps, RowWithActions, OakExtraActionProps, OakAbsAttrDef, onActionFnDef, }; diff --git a/es/components/order/pay/index.js b/es/components/order/pay/index.js index 2fc9ca0b..26bd7a1c 100644 --- a/es/components/order/pay/index.js +++ b/es/components/order/pay/index.js @@ -130,7 +130,8 @@ export default OakComponent({ entity: 'account', entityId: accountId, price: accountPrice, - autoStart: !!autoStartPay, + // account类型的pay自动开始 + autoStart: true, }); rest = rest - accountPrice; } diff --git a/es/components/ship/system/web.pc.js b/es/components/ship/system/web.pc.js index f250359e..c8332c00 100644 --- a/es/components/ship/system/web.pc.js +++ b/es/components/ship/system/web.pc.js @@ -9,9 +9,8 @@ export function registerShipSettingComponent(entity, component) { assert(!ShipSettingComponentDict[entity]); ShipSettingComponentDict[entity] = component; } -function renderShipEntity(props) { - const { oakId, oakFullpath } = props.data; - const { t, execute, clean } = props.methods; +function RenderShipEntity(props) { + const { oakId, oakFullpath, t } = props; const entities = Object.keys(ShipSettingComponentDict); if (oakId && oakFullpath && entities.length) { return ( { @@ -63,13 +62,12 @@ function renderShipEntity(props) { export default function render(props) { const { oakFullpath, oakId } = props.data; const { t } = props.methods; - const E = renderShipEntity(props); if (oakFullpath && oakId) { return (, }, { key: '2', diff --git a/es/components/ship/wechatMpShip/locales/zh-CN.json b/es/components/ship/wechatMpShip/locales/zh-CN.json index 05e029d6..8c7d3245 100644 --- a/es/components/ship/wechatMpShip/locales/zh-CN.json +++ b/es/components/ship/wechatMpShip/locales/zh-CN.json @@ -1,7 +1,7 @@ { "appName": "关联小程序", "help": { - "intro": "小程序关联物流的优先级最高,只要通过该小程序下单就会默认启用" + "intro": "小程序物流能力参见文档https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/business/introduction.html,必须有相应的小程序方可启用" }, "warning": { "disabled": "注意,小程序要求大部分支付必须与物流进行绑定,若是关闭,可能会造成资金无法正常结转", diff --git a/es/components/ship/wechatMpShip/upsert/index.js b/es/components/ship/wechatMpShip/upsert/index.js index 255ad95d..a24eefcd 100644 --- a/es/components/ship/wechatMpShip/upsert/index.js +++ b/es/components/ship/wechatMpShip/upsert/index.js @@ -10,7 +10,6 @@ export default OakComponent({ name: 1, }, }, - bizId: 1, sort: 1, }, isList: false, diff --git a/es/components/ship/wechatMpShip/upsert/web.pc.js b/es/components/ship/wechatMpShip/upsert/web.pc.js index d77aaf94..1c3d09f6 100644 --- a/es/components/ship/wechatMpShip/upsert/web.pc.js +++ b/es/components/ship/wechatMpShip/upsert/web.pc.js @@ -10,7 +10,7 @@ export default function render(props) { update({ wpProductId: value, }); - }}/> : } + }}/> : } { diff --git a/es/configuration/relation.js b/es/configuration/relation.js index 90fbcb71..3d67699b 100644 --- a/es/configuration/relation.js +++ b/es/configuration/relation.js @@ -6,6 +6,7 @@ export const selectFreeEntities = [ 'withdrawChannel', 'wpAccount', 'shipCompany', + 'shipService', ]; export const updateFreeDict = {}; export default { diff --git a/es/data/i18n.js b/es/data/i18n.js index 38d2d19f..2988c1c1 100644 --- a/es/data/i18n.js +++ b/es/data/i18n.js @@ -318,7 +318,7 @@ const i18ns = [ data: { "appName": "关联小程序", "help": { - "intro": "小程序关联物流的优先级最高,只要通过该小程序下单就会默认启用" + "intro": "小程序物流能力参见文档https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/business/introduction.html,必须有相应的小程序方可启用" }, "warning": { "disabled": "注意,小程序要求大部分支付必须与物流进行绑定,若是关闭,可能会造成资金无法正常结转", diff --git a/es/entities/WechatMpShip.js b/es/entities/WechatMpShip.js index 46ccb36f..971f78ce 100644 --- a/es/entities/WechatMpShip.js +++ b/es/entities/WechatMpShip.js @@ -2,7 +2,7 @@ export const entityDesc = { locales: { zh_CN: { - name: '微信小程序快递帐号', + name: '微信小程序物流接口', attr: { sort: '排序', phatom1: '备用属性一', diff --git a/es/triggers/pay.js b/es/triggers/pay.js index c1b66bde..3ce15516 100644 --- a/es/triggers/pay.js +++ b/es/triggers/pay.js @@ -290,7 +290,7 @@ const triggers = [ { name: '当pay的状态发生变化时,修改相应的order的状态或者deposit的状态,同时尝试向订阅者推送', entity: 'pay', - action: ['startPaying', 'succeedPaying', 'continuePaying', 'close', 'startRefunding', + action: ['startPaying', 'succeedPaying', 'close', 'startRefunding', 'refundAll', 'refundPartially'], when: 'after', asRoot: true, @@ -644,9 +644,17 @@ const triggers = [ { entity: 'pay', name: '当有pay支付成功时,尝试将account类型的pay完成', - action: ['startPaying', 'continuePaying', 'succeedPaying'], + action: ['startPaying', 'succeedPaying'], attributes: ['paid'], + /** + * 只有account类型的pay在startPaying的时候就会修改paid,因此这里的触发情况实际上是: + * 1)account类型的pay进行startPaying + * 2) 非account类型的pay进行succeedPaying + * + * by Xc 2025/03/05 + */ when: 'after', + priority: 99, fn: async ({ operation }, context, option) => { const { filter } = operation; const ids = getRelevantIds(filter); @@ -711,26 +719,3 @@ const triggers = [ } as SelectTriggerAfter, */ ]; export default triggers; -// export const optionalTriggers: Trigger[] = [ -// { -// name: '当生成pay后,自动开始支付流程', -// entity: 'pay', -// action: 'create', -// when: 'commit', -// asRoot: true, -// fn: async ({ ids }, context, option) => { -// assert(ids.length === 1); -// const [id] = ids; -// await context.operate('pay', { -// id: await generateNewIdAsync(), -// action: 'startPaying', -// data: { -// }, -// filter: { -// id, -// } -// }, option); -// return; -// }, -// } -// ] diff --git a/es/triggers/withdraw.d.ts b/es/triggers/withdraw.d.ts index 979a44c8..e69f8d6e 100644 --- a/es/triggers/withdraw.d.ts +++ b/es/triggers/withdraw.d.ts @@ -6,6 +6,6 @@ import { BRC } from '../types/RuntimeCxt'; * @param context * @param refunds */ -export declare function updateWithdrawState(context: BRC, id: string): Promise<1 | 0>; +export declare function updateWithdrawState(context: BRC, id: string): Promise<0 | 1>; declare const triggers: Trigger[]; export default triggers; diff --git a/es/utils/ship.js b/es/utils/ship.js index 946dd736..33a1e3fc 100644 --- a/es/utils/ship.js +++ b/es/utils/ship.js @@ -7,12 +7,15 @@ export const fullShipProjection = { id: 1, type: 1, iState: 1, - shipCompanyId: 1, - shipCompany: { + shipService: { id: 1, name: 1, - abbr: 1, - wechatMpName: 1, + shipCompany: { + id: 1, + name: 1, + abbr: 1, + wechatMpName: 1, + } }, serial: 1, deposit$ship: { diff --git a/lib/checkers/pay.js b/lib/checkers/pay.js index bc4567ca..ad2942ff 100644 --- a/lib/checkers/pay.js +++ b/lib/checkers/pay.js @@ -2,7 +2,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const types_1 = require("oak-domain/lib/types"); -const executor_1 = require("oak-domain/lib/utils/executor"); const assert_1 = tslib_1.__importDefault(require("assert")); const checkers = [ { @@ -115,32 +114,35 @@ const checkers = [ } } }, - { + /* { // 如果在开始支付或者继续支付过程中,paid达到了price,pay的状态可以改为paid entity: 'pay', type: 'logical', action: ['continuePaying', 'startPaying'], // priority: CHECKER_MAX_PRIORITY - 1, // 要超过action矩阵定义的赋state值 checker: (operation, context) => { - const { data, filter } = operation; - (0, assert_1.default)(filter && typeof filter.id === 'string'); + const { data, filter } = operation as EntityDict['pay']['Update']; + assert(filter && typeof filter.id === 'string'); const { paid } = data || {}; if (paid) { - return (0, executor_1.pipeline)(() => context.select('pay', { - data: { - id: 1, - paid: 1, - price: 1, - }, - }, {}), (pays) => { - const [pay] = pays; - const { paid: payPaid, price } = pay; - if (payPaid + paid === price) { - data.iState === 'paid'; + return pipeline( + () => context.select('pay', { + data: { + id: 1, + paid: 1, + price: 1, + }, + }, {}), + (pays: EntityDict['pay']['OpSchema'][]) => { + const [pay] = pays; + const { paid: payPaid, price } = pay; + if (payPaid + paid === price) { + data.iState === 'paid'; + } } - }); + ) } } - } + } */ ]; exports.default = checkers; diff --git a/lib/configuration/relation.js b/lib/configuration/relation.js index 285ca36b..83c39094 100644 --- a/lib/configuration/relation.js +++ b/lib/configuration/relation.js @@ -9,6 +9,7 @@ exports.selectFreeEntities = [ 'withdrawChannel', 'wpAccount', 'shipCompany', + 'shipService', ]; exports.updateFreeDict = {}; exports.default = { diff --git a/lib/data/i18n.js b/lib/data/i18n.js index ce5bf5ab..b009ecf0 100644 --- a/lib/data/i18n.js +++ b/lib/data/i18n.js @@ -320,7 +320,7 @@ const i18ns = [ data: { "appName": "关联小程序", "help": { - "intro": "小程序关联物流的优先级最高,只要通过该小程序下单就会默认启用" + "intro": "小程序物流能力参见文档https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/business/introduction.html,必须有相应的小程序方可启用" }, "warning": { "disabled": "注意,小程序要求大部分支付必须与物流进行绑定,若是关闭,可能会造成资金无法正常结转", diff --git a/lib/entities/WechatMpShip.js b/lib/entities/WechatMpShip.js index cb3e0c74..3ff57e6f 100644 --- a/lib/entities/WechatMpShip.js +++ b/lib/entities/WechatMpShip.js @@ -5,7 +5,7 @@ exports.entityDesc = void 0; exports.entityDesc = { locales: { zh_CN: { - name: '微信小程序快递帐号', + name: '微信小程序物流接口', attr: { sort: '排序', phatom1: '备用属性一', diff --git a/lib/triggers/pay.js b/lib/triggers/pay.js index bb0d9196..ae56b0f4 100644 --- a/lib/triggers/pay.js +++ b/lib/triggers/pay.js @@ -293,7 +293,7 @@ const triggers = [ { name: '当pay的状态发生变化时,修改相应的order的状态或者deposit的状态,同时尝试向订阅者推送', entity: 'pay', - action: ['startPaying', 'succeedPaying', 'continuePaying', 'close', 'startRefunding', + action: ['startPaying', 'succeedPaying', 'close', 'startRefunding', 'refundAll', 'refundPartially'], when: 'after', asRoot: true, @@ -647,9 +647,17 @@ const triggers = [ { entity: 'pay', name: '当有pay支付成功时,尝试将account类型的pay完成', - action: ['startPaying', 'continuePaying', 'succeedPaying'], + action: ['startPaying', 'succeedPaying'], attributes: ['paid'], + /** + * 只有account类型的pay在startPaying的时候就会修改paid,因此这里的触发情况实际上是: + * 1)account类型的pay进行startPaying + * 2) 非account类型的pay进行succeedPaying + * + * by Xc 2025/03/05 + */ when: 'after', + priority: 99, fn: async ({ operation }, context, option) => { const { filter } = operation; const ids = (0, filter_1.getRelevantIds)(filter); @@ -714,26 +722,3 @@ const triggers = [ } as SelectTriggerAfter, */ ]; exports.default = triggers; -// export const optionalTriggers: Trigger[] = [ -// { -// name: '当生成pay后,自动开始支付流程', -// entity: 'pay', -// action: 'create', -// when: 'commit', -// asRoot: true, -// fn: async ({ ids }, context, option) => { -// assert(ids.length === 1); -// const [id] = ids; -// await context.operate('pay', { -// id: await generateNewIdAsync(), -// action: 'startPaying', -// data: { -// }, -// filter: { -// id, -// } -// }, option); -// return; -// }, -// } -// ] diff --git a/lib/triggers/withdraw.d.ts b/lib/triggers/withdraw.d.ts index 979a44c8..e69f8d6e 100644 --- a/lib/triggers/withdraw.d.ts +++ b/lib/triggers/withdraw.d.ts @@ -6,6 +6,6 @@ import { BRC } from '../types/RuntimeCxt'; * @param context * @param refunds */ -export declare function updateWithdrawState(context: BRC, id: string): Promise<1 | 0>; +export declare function updateWithdrawState(context: BRC, id: string): Promise<0 | 1>; declare const triggers: Trigger[]; export default triggers; diff --git a/lib/utils/ship.js b/lib/utils/ship.js index a90f05ef..9ded6ad1 100644 --- a/lib/utils/ship.js +++ b/lib/utils/ship.js @@ -11,12 +11,15 @@ exports.fullShipProjection = { id: 1, type: 1, iState: 1, - shipCompanyId: 1, - shipCompany: { + shipService: { id: 1, name: 1, - abbr: 1, - wechatMpName: 1, + shipCompany: { + id: 1, + name: 1, + abbr: 1, + wechatMpName: 1, + } }, serial: 1, deposit$ship: { diff --git a/src/checkers/pay.ts b/src/checkers/pay.ts index c20b2991..af5c6c2a 100644 --- a/src/checkers/pay.ts +++ b/src/checkers/pay.ts @@ -125,7 +125,7 @@ const checkers: Checker[] = [ } } }, - { + /* { // 如果在开始支付或者继续支付过程中,paid达到了price,pay的状态可以改为paid entity: 'pay', type: 'logical', @@ -154,7 +154,7 @@ const checkers: Checker[] = [ ) } } - } + } */ ]; export default checkers; diff --git a/src/components/order/pay/index.ts b/src/components/order/pay/index.ts index 51e20c75..a367f706 100644 --- a/src/components/order/pay/index.ts +++ b/src/components/order/pay/index.ts @@ -134,7 +134,8 @@ export default OakComponent({ entity: 'account', entityId: accountId, price: accountPrice, - autoStart: !!autoStartPay, + // account类型的pay自动开始 + autoStart: true, }); rest = rest - accountPrice; } diff --git a/src/components/ship/wechatMpShip/locales/zh-CN.json b/src/components/ship/wechatMpShip/locales/zh-CN.json index 93fa02e0..6b3892a7 100644 --- a/src/components/ship/wechatMpShip/locales/zh-CN.json +++ b/src/components/ship/wechatMpShip/locales/zh-CN.json @@ -1,7 +1,7 @@ { "appName": "关联小程序", "help": { - "intro": "小程序关联物流的优先级最高,只要通过该小程序下单就会默认启用" + "intro": "小程序物流能力参见文档https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/business/introduction.html,必须有相应的小程序方可启用" }, "warning": { "disabled": "注意,小程序要求大部分支付必须与物流进行绑定,若是关闭,可能会造成资金无法正常结转", diff --git a/src/configuration/relation.ts b/src/configuration/relation.ts index 7b8f6126..9d4e23ae 100644 --- a/src/configuration/relation.ts +++ b/src/configuration/relation.ts @@ -11,6 +11,7 @@ export const selectFreeEntities = [ 'withdrawChannel', 'wpAccount', 'shipCompany', + 'shipService', ]; export const updateFreeDict: UpdateFreeDict = { diff --git a/src/data/i18n.ts b/src/data/i18n.ts index dd37bb96..5fd7808f 100644 --- a/src/data/i18n.ts +++ b/src/data/i18n.ts @@ -320,7 +320,7 @@ const i18ns: I18n[] = [ data: { "appName": "关联小程序", "help": { - "intro": "小程序关联物流的优先级最高,只要通过该小程序下单就会默认启用" + "intro": "小程序物流能力参见文档https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/business/introduction.html,必须有相应的小程序方可启用" }, "warning": { "disabled": "注意,小程序要求大部分支付必须与物流进行绑定,若是关闭,可能会造成资金无法正常结转", diff --git a/src/entities/WechatMpShip.ts b/src/entities/WechatMpShip.ts index 15040a9a..91980f6b 100644 --- a/src/entities/WechatMpShip.ts +++ b/src/entities/WechatMpShip.ts @@ -18,7 +18,7 @@ export interface Schema extends AbstractShipAccount { export const entityDesc: EntityDesc = { locales: { zh_CN: { - name: '微信小程序快递帐号', + name: '微信小程序物流接口', attr: { sort: '排序', phatom1: '备用属性一', diff --git a/src/triggers/pay.ts b/src/triggers/pay.ts index 0c7f6311..ca75ce8b 100644 --- a/src/triggers/pay.ts +++ b/src/triggers/pay.ts @@ -315,7 +315,7 @@ const triggers: Trigger[] = [ { name: '当pay的状态发生变化时,修改相应的order的状态或者deposit的状态,同时尝试向订阅者推送', entity: 'pay', - action: ['startPaying', 'succeedPaying', 'continuePaying', 'close', 'startRefunding', + action: ['startPaying', 'succeedPaying', 'close', 'startRefunding', 'refundAll', 'refundPartially'], when: 'after', asRoot: true, @@ -702,9 +702,17 @@ const triggers: Trigger[] = [ { entity: 'pay', name: '当有pay支付成功时,尝试将account类型的pay完成', - action: ['startPaying', 'continuePaying', 'succeedPaying'], + action: ['startPaying', 'succeedPaying'], attributes: ['paid'], + /** + * 只有account类型的pay在startPaying的时候就会修改paid,因此这里的触发情况实际上是: + * 1)account类型的pay进行startPaying + * 2) 非account类型的pay进行succeedPaying + * + * by Xc 2025/03/05 + */ when: 'after', + priority: 99, fn: async ({ operation }, context, option) => { const { filter } = operation; const ids = getRelevantIds(filter!); @@ -773,29 +781,4 @@ const triggers: Trigger[] = [ } as SelectTriggerAfter, */ ]; -export default triggers; - -// export const optionalTriggers: Trigger[] = [ -// { -// name: '当生成pay后,自动开始支付流程', -// entity: 'pay', -// action: 'create', -// when: 'commit', -// asRoot: true, -// fn: async ({ ids }, context, option) => { -// assert(ids.length === 1); -// const [id] = ids; -// await context.operate('pay', { -// id: await generateNewIdAsync(), -// action: 'startPaying', -// data: { -// }, -// filter: { -// id, -// } -// }, option); - -// return; -// }, -// } -// ] \ No newline at end of file +export default triggers; \ No newline at end of file diff --git a/src/utils/ship.ts b/src/utils/ship.ts index 717a2845..bb888d06 100644 --- a/src/utils/ship.ts +++ b/src/utils/ship.ts @@ -12,12 +12,15 @@ export const fullShipProjection: EntityDict['ship']['Projection'] = { id: 1, type: 1, iState: 1, - shipCompanyId: 1, - shipCompany: { + shipService: { id: 1, name: 1, - abbr: 1, - wechatMpName: 1, + shipCompany: { + id: 1, + name: 1, + abbr: 1, + wechatMpName: 1, + } }, serial: 1, deposit$ship: {