This commit is contained in:
lxy 2025-03-19 17:13:06 +08:00
parent 966118efee
commit fd0c83236d
163 changed files with 555 additions and 116 deletions

View File

@ -54,6 +54,52 @@ const checkers = [
data.receiveAt = now;
}
}
},
{
entity: 'ship',
type: 'row',
action: ['startReceiving', 'succeedReceiving'],
filter: {
shipOrder$ship: {
order: {
pay$order: {
$and: [{
wpProduct: {
needReceiving: true
}
}, {
iState: {
$ne: 'closed'
}
}]
}
}
}
}
},
{
entity: 'ship',
type: 'row',
action: 'receive',
filter: {
shipOrder$ship: {
'#sqp': 'all',
order: {
pay$order: {
'#sqp': 'not in',
$and: [{
wpProduct: {
needReceiving: true
}
}, {
iState: {
$ne: 'closed'
}
}]
}
}
}
}
}
];
export default checkers;

View File

@ -22,12 +22,7 @@ declare const List: <T extends keyof EntityDict>(props: ReactComponentProps<Enti
hideHeader?: boolean | undefined;
disableSerialNumber?: boolean | undefined;
size?: "small" | "middle" | "large" | undefined;
scroll?: ({
x?: string | number | true | undefined;
y?: string | number | undefined;
} & {
scrollToFirstRowOnChange?: boolean | undefined;
}) | undefined;
scroll?: any;
empty?: React.ReactNode;
opWidth?: number | undefined;
ellipsis?: boolean | undefined;

View File

@ -49,6 +49,7 @@ export type OpSortAttr = Partial<{
refundGapDays: number;
refundCompensateRatio: number;
needReceiving: number;
applicationId: number;
enabled: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;

View File

@ -58,6 +58,7 @@ export type OpSortAttr = Partial<{
withdrawTransferLossRatio: number;
price: number;
needReceiving: number;
systemId: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<Action | string>;

View File

@ -45,6 +45,7 @@ export type OpSortAttr = Partial<{
sort: number;
phatom1: number;
phatom2: number;
systemId: number;
disabled: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;

View File

@ -52,6 +52,7 @@ export type OpSortAttr = Partial<{
total: number;
avail: number;
refundable: number;
ofSystemId: number;
entity: number;
entityId: number;
ableState: number;

View File

@ -58,6 +58,7 @@ export type OpSortAttr = Partial<{
$$createAt$$: number;
$$seq$$: number;
$$updateAt$$: number;
accountId: number;
type: number;
totalPlus: number;
availPlus: number;

View File

@ -36,6 +36,8 @@ export type OpSortAttr = Partial<{
$$createAt$$: number;
$$seq$$: number;
$$updateAt$$: number;
relationId: number;
pathId: number;
deActions: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;

View File

@ -52,6 +52,7 @@ export type OpSortAttr = Partial<{
$$seq$$: number;
$$updateAt$$: number;
detail: number;
areaId: number;
phone: number;
name: number;
default: number;

View File

@ -133,10 +133,12 @@ export type OpSortAttr = Partial<{
name: number;
description: number;
type: number;
systemId: number;
style: number;
dangerousVersions: number;
warningVersions: number;
soaVersion: number;
domainId: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<GenericAction | string>;

View File

@ -36,6 +36,8 @@ export type OpSortAttr = Partial<{
$$createAt$$: number;
$$seq$$: number;
$$updateAt$$: number;
applicationId: number;
passportId: number;
isDefault: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;

View File

@ -47,6 +47,7 @@ export type OpSortAttr = Partial<{
name: number;
level: number;
depth: number;
parentId: number;
code: number;
center: number;
[k: string]: any;

View File

@ -38,6 +38,7 @@ export type OpSortAttr = Partial<{
$$updateAt$$: number;
name: number;
content: number;
articleMenuId: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<GenericAction | string>;

View File

@ -47,6 +47,7 @@ export type OpSortAttr = Partial<{
$$updateAt$$: number;
name: number;
isArticle: number;
parentId: number;
isLeaf: number;
entity: number;
entityId: number;

View File

@ -39,6 +39,7 @@ export type OpSortAttr = Partial<{
$$createAt$$: number;
$$seq$$: number;
$$updateAt$$: number;
userId: number;
prevPassword: number;
newPassword: number;
result: number;

View File

@ -47,6 +47,9 @@ export type OpSortAttr = Partial<{
$$updateAt$$: number;
price: number;
loss: number;
accountId: number;
creatorId: number;
shipId: number;
iState: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;

View File

@ -46,6 +46,7 @@ export type OpSortAttr = Partial<{
apiPath: number;
protocol: number;
port: number;
systemId: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<GenericAction | string>;

View File

@ -38,6 +38,7 @@ export type OpSortAttr = Partial<{
$$seq$$: number;
$$updateAt$$: number;
email: number;
userId: number;
ableState: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;

View File

@ -104,6 +104,7 @@ export type OpSortAttr = Partial<{
fileType: number;
isBridge: number;
uploadState: number;
applicationId: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<GenericAction | string>;

View File

@ -38,6 +38,7 @@ export type OpSortAttr = Partial<{
$$seq$$: number;
$$updateAt$$: number;
name: number;
userId: number;
ableState: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;

View File

@ -83,12 +83,14 @@ export type OpSortAttr = Partial<{
$$updateAt$$: number;
entity: number;
entityId: number;
userId: number;
type: number;
weight: number;
restriction: number;
title: number;
content: number;
router: number;
platformId: number;
channels: number;
iState: number;
visitState: number;

View File

@ -32,6 +32,8 @@ export type OpSortAttr = Partial<{
$$createAt$$: number;
$$seq$$: number;
$$updateAt$$: number;
messageId: number;
systemId: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<GenericAction | string>;

View File

@ -34,6 +34,7 @@ export type OpSortAttr = Partial<{
$$seq$$: number;
$$updateAt$$: number;
type: number;
templateId: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<GenericAction | string>;

View File

@ -34,6 +34,7 @@ export type OpSortAttr = Partial<{
$$seq$$: number;
$$updateAt$$: number;
type: number;
templateId: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<GenericAction | string>;

View File

@ -38,6 +38,7 @@ export type OpSortAttr = Partial<{
$$seq$$: number;
$$updateAt$$: number;
mobile: number;
userId: number;
ableState: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;

View File

@ -36,6 +36,7 @@ export type OpSortAttr = Partial<{
$$createAt$$: number;
$$seq$$: number;
$$updateAt$$: number;
modiId: number;
entity: number;
entityId: number;
[k: string]: any;

View File

@ -53,6 +53,8 @@ export type OpSortAttr = Partial<{
$$seq$$: number;
$$updateAt$$: number;
channel: number;
applicationId: number;
messageSystemId: number;
templateId: number;
iState: number;
[k: string]: any;

View File

@ -79,6 +79,7 @@ export type OpSortAttr = Partial<{
withdrawTransferLossRatio: number;
price: number;
needReceiving: number;
systemId: number;
type: number;
channel: number;
name: number;

View File

@ -58,8 +58,10 @@ export type OpSortAttr = Partial<{
$$seq$$: number;
$$updateAt$$: number;
action: number;
operatorId: number;
targetEntity: number;
bornAt: number;
logId: number;
iState: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;

View File

@ -36,6 +36,7 @@ export type OpSortAttr = Partial<{
$$createAt$$: number;
$$seq$$: number;
$$updateAt$$: number;
operId: number;
entity: number;
entityId: number;
[k: string]: any;

View File

@ -78,10 +78,13 @@ export type OpSortAttr = Partial<{
title: number;
desc: number;
timeoutAt: number;
creatorId: number;
entity: number;
entityId: number;
settled: number;
allowPartialPay: number;
systemId: number;
addressId: number;
payAt: number;
iState: number;
[k: string]: any;

View File

@ -59,6 +59,7 @@ export type OpSortAttr = Partial<{
$$createAt$$: number;
$$seq$$: number;
$$updateAt$$: number;
userId: number;
entity: number;
entityId: number;
showTip: number;

View File

@ -62,6 +62,7 @@ export type OpSortAttr = Partial<{
$$createAt$$: number;
$$seq$$: number;
$$updateAt$$: number;
systemId: number;
type: number;
enabled: number;
[k: string]: any;

View File

@ -102,7 +102,11 @@ export type OpSortAttr = Partial<{
successAt: number;
forbidRefundAt: number;
refundable: number;
depositId: number;
orderId: number;
externalId: number;
applicationId: number;
creatorId: number;
phantom1: number;
phantom2: number;
phantom3: number;

View File

@ -32,6 +32,8 @@ export type OpSortAttr = Partial<{
$$createAt$$: number;
$$seq$$: number;
$$updateAt$$: number;
userId: number;
sessionId: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<GenericAction | string>;

View File

@ -60,9 +60,12 @@ export type OpSortAttr = Partial<{
$$createAt$$: number;
$$seq$$: number;
$$updateAt$$: number;
withdrawId: number;
loss: number;
payId: number;
externalId: number;
price: number;
creatorId: number;
reason: number;
successAt: number;
iState: number;

View File

@ -35,6 +35,9 @@ export type OpSortAttr = Partial<{
$$createAt$$: number;
$$seq$$: number;
$$updateAt$$: number;
sourceRelationId: number;
pathId: number;
destRelationId: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<GenericAction | string>;

View File

@ -44,6 +44,7 @@ export type OpSortAttr = Partial<{
$$updateAt$$: number;
entity: number;
entityId: number;
userId: number;
lmts: number;
openId: number;
[k: string]: any;

View File

@ -58,6 +58,10 @@ export type OpSortAttr = Partial<{
$$createAt$$: number;
$$seq$$: number;
$$updateAt$$: number;
applicationId: number;
sessionId: number;
userId: number;
wechatUserId: number;
createTime: number;
type: number;
text: number;

View File

@ -39,7 +39,9 @@ export type OpSortAttr = Partial<{
$$createAt$$: number;
$$seq$$: number;
$$updateAt$$: number;
accountId: number;
price: number;
orderId: number;
iState: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;

View File

@ -77,6 +77,9 @@ export type OpSortAttr = Partial<{
$$seq$$: number;
$$updateAt$$: number;
type: number;
shipServiceId: number;
toId: number;
fromId: number;
entity: number;
entityId: number;
phantom1: number;

View File

@ -32,6 +32,8 @@ export type OpSortAttr = Partial<{
$$createAt$$: number;
$$seq$$: number;
$$updateAt$$: number;
shipId: number;
orderId: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<GenericAction | string>;

View File

@ -34,6 +34,7 @@ export type OpSortAttr = Partial<{
$$seq$$: number;
$$updateAt$$: number;
name: number;
shipCompanyId: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<GenericAction | string>;

View File

@ -32,6 +32,8 @@ export type OpSortAttr = Partial<{
$$createAt$$: number;
$$seq$$: number;
$$updateAt$$: number;
shipServiceId: number;
systemId: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<GenericAction | string>;

View File

@ -46,6 +46,7 @@ export type OpSortAttr = Partial<{
$$createAt$$: number;
$$seq$$: number;
$$updateAt$$: number;
systemId: number;
origin: number;
templateName: number;
templateCode: number;

View File

@ -34,6 +34,7 @@ export type OpSortAttr = Partial<{
$$seq$$: number;
$$updateAt$$: number;
name: number;
areaId: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<GenericAction | string>;

View File

@ -34,6 +34,7 @@ export type OpSortAttr = Partial<{
$$seq$$: number;
$$updateAt$$: number;
name: number;
areaId: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<GenericAction | string>;

View File

@ -32,6 +32,8 @@ export type OpSortAttr = Partial<{
$$createAt$$: number;
$$seq$$: number;
$$updateAt$$: number;
stationId: number;
subwayId: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<GenericAction | string>;

View File

@ -44,7 +44,9 @@ export type OpSortAttr = Partial<{
$$updateAt$$: number;
price: number;
externalId: number;
operatorId: number;
remark: number;
systemId: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<AppendOnlyAction | string>;

View File

@ -56,6 +56,10 @@ export type OpSortAttr = Partial<{
type: number;
entity: number;
entityId: number;
payId: number;
refundId: number;
withdrawTransferId: number;
sysAccountMoveId: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<AppendOnlyAction | string>;

View File

@ -79,6 +79,7 @@ export type OpSortAttr = Partial<{
name: number;
description: number;
config: number;
platformId: number;
folder: number;
oldestVersion: number;
super: number;

View File

@ -62,8 +62,11 @@ export type OpSortAttr = Partial<{
$$createAt$$: number;
$$seq$$: number;
$$updateAt$$: number;
applicationId: number;
entity: number;
entityId: number;
userId: number;
playerId: number;
disablesAt: number;
env: number;
refreshedAt: number;

View File

@ -74,6 +74,7 @@ export type OpSortAttr = Partial<{
name: number;
nickname: number;
password: number;
refId: number;
passwordSha1: number;
birth: number;
gender: number;

View File

@ -42,7 +42,11 @@ export type OpSortAttr = Partial<{
$$createAt$$: number;
$$seq$$: number;
$$updateAt$$: number;
uegId: number;
userId: number;
relationId: number;
claimEntityId: number;
userRelationId: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<GenericAction | string>;

View File

@ -93,6 +93,7 @@ export type OpSortAttr = Partial<{
ruleOnRow: number;
multiple: number;
remark: number;
granterId: number;
qrCodeType: number;
expiresAt: number;
expired: number;

View File

@ -39,6 +39,8 @@ export type OpSortAttr = Partial<{
$$createAt$$: number;
$$seq$$: number;
$$updateAt$$: number;
userId: number;
relationId: number;
entity: number;
entityId: number;
[k: string]: any;

View File

@ -32,6 +32,8 @@ export type OpSortAttr = Partial<{
$$createAt$$: number;
$$seq$$: number;
$$updateAt$$: number;
userId: number;
systemId: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<GenericAction | string>;

View File

@ -42,6 +42,8 @@ export type OpSortAttr = Partial<{
$$createAt$$: number;
$$seq$$: number;
$$updateAt$$: number;
wechatPublicTagId: number;
wechatUserId: number;
sync: number;
syncAt: number;
iState: number;

View File

@ -52,12 +52,14 @@ export type OpSortAttr = Partial<{
$$createAt$$: number;
$$seq$$: number;
$$updateAt$$: number;
userId: number;
type: number;
successed: number;
remark: number;
qrCodeType: number;
expiresAt: number;
expired: number;
wechatUserId: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<Action | string>;

View File

@ -50,6 +50,8 @@ export type OpSortAttr = Partial<{
$$updateAt$$: number;
menuId: number;
menuConfig: number;
applicationId: number;
wechatPublicTagId: number;
iState: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;

View File

@ -53,6 +53,7 @@ export type OpSortAttr = Partial<{
$$createAt$$: number;
$$seq$$: number;
$$updateAt$$: number;
messageId: number;
jump_wxa: number;
openlink: number;
expireType: number;

View File

@ -48,7 +48,9 @@ export type OpSortAttr = Partial<{
sort: number;
phatom1: number;
phatom2: number;
systemId: number;
disabled: number;
applicationId: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<GenericAction | string>;

View File

@ -38,6 +38,7 @@ export type OpSortAttr = Partial<{
$$updateAt$$: number;
payNotifyUrl: number;
refundNotifyUrl: number;
systemId: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<GenericAction | string>;

View File

@ -45,6 +45,7 @@ export type OpSortAttr = Partial<{
$$seq$$: number;
$$updateAt$$: number;
content: number;
applicationId: number;
type: number;
event: number;
[k: string]: any;

View File

@ -46,6 +46,7 @@ export type OpSortAttr = Partial<{
$$seq$$: number;
$$updateAt$$: number;
text: number;
applicationId: number;
wechatId: number;
sync: number;
syncAt: number;

View File

@ -88,6 +88,7 @@ export type OpSortAttr = Partial<{
url: number;
permanent: number;
buffer: number;
applicationId: number;
props: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;

View File

@ -64,6 +64,7 @@ export type OpSortAttr = Partial<{
$$createAt$$: number;
$$seq$$: number;
$$updateAt$$: number;
applicationId: number;
wechatId: number;
title: number;
primaryIndustry: number;

View File

@ -87,6 +87,8 @@ export type OpSortAttr = Partial<{
subscribed: number;
subscribedAt: number;
unsubscribedAt: number;
userId: number;
applicationId: number;
nickname: number;
avatar: number;
[k: string]: any;

View File

@ -54,10 +54,12 @@ export type OpSortAttr = Partial<{
$$createAt$$: number;
$$seq$$: number;
$$updateAt$$: number;
accountId: number;
price: number;
loss: number;
dealPrice: number;
dealLoss: number;
creatorId: number;
reason: number;
iState: number;
[k: string]: any;

View File

@ -60,6 +60,8 @@ export type OpSortAttr = Partial<{
org: number;
name: number;
code: number;
ofSystemId: number;
channelId: number;
entity: number;
entityId: number;
isDefault: number;

View File

@ -42,6 +42,7 @@ export type OpSortAttr = Partial<{
entity: number;
entityId: number;
enabled: number;
systemId: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<Action | string>;

View File

@ -58,8 +58,12 @@ export type OpSortAttr = Partial<{
$$seq$$: number;
$$updateAt$$: number;
iState: number;
withdrawId: number;
withdrawAccountId: number;
price: number;
loss: number;
operatorId: number;
creatorId: number;
externalId: number;
reason: number;
[k: string]: any;

View File

@ -76,6 +76,8 @@ export type OpSortAttr = Partial<{
withdrawTransferLossRatio: number;
price: number;
needReceiving: number;
systemId: number;
wechatPayId: number;
mchId: number;
publicKeyFilePath: number;
privateKeyFilePath: number;

View File

@ -55,7 +55,9 @@ export type OpSortAttr = Partial<{
refundGapDays: number;
refundCompensateRatio: number;
needReceiving: number;
applicationId: number;
enabled: number;
wpAccountId: number;
type: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;

View File

@ -8,7 +8,7 @@ const timers = [
filter: {
type: 'express',
iState: {
$nin: ['received', 'cancelled', 'rejected'],
$nin: ['received', 'cancelled', 'rejected', 'receiving'],
},
entity: {
$exists: true
@ -28,7 +28,7 @@ const timers = [
fn: async (context, data) => {
const results = [];
for (const ship of data) {
const result = await refreshtShipState(ship, context);
const result = await refreshtShipState(ship.id, context);
if (result) {
results.push(result);
}

View File

@ -86,6 +86,22 @@ const triggers = [
data: {
id: 1,
orderId: 1,
order: {
id: 1,
pay$order: {
$entity: 'pay',
data: {
id: 1,
meta: 1,
iState: 1,
entity: 1,
entityId: 1,
},
filter: {
iState: 'paid'
}
}
}
}
},
wechatMpShip: {
@ -103,10 +119,27 @@ const triggers = [
}
if (shipOrder$ship && shipOrder$ship.length > 0) {
//订单
const clazz = await getShipClazz(entity, entityId, context);
const { openId } = await clazz.getReceiverInfo(shipOrder$ship.map((ele) => ele.orderId), wechatMpShip?.applicationId, context);
if (openId) {
//当存在openId时调用小程序发货信息录入
const wpPayIds = ship.shipOrder$ship?.map((ele) => ele.order).map((order) => order.pay$order).flat().filter((pay) => pay?.entity === 'wpProduct').map((ele) => ele?.id);
let needUpload = false;
if (wpPayIds && wpPayIds.length > 0) {
const cnt = await context.count('pay', {
filter: {
id: {
$in: wpPayIds,
},
iState: {
$ne: 'closed',
},
wpProduct: {
needReceiving: true,
}
}
}, {});
if (cnt > 0) {
needUpload = true;
}
}
if (needUpload) {
await uploadShippingInfo(shipId, context);
return 1;
}
@ -204,12 +237,13 @@ const triggers = [
}
},
{
name: '当ship签收后调用小程序确认收货提醒',
name: '当物流类的ship签收后调用小程序确认收货提醒',
entity: 'ship',
action: 'receive',
when: 'commit',
asRoot: true,
filter: {
type: 'express',
receiveAt: {
$exists: true,
}

View File

@ -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<EntityDict, 'withdraw', BRC>[];
export default triggers;

2
es/utils/ship.d.ts vendored
View File

@ -26,7 +26,7 @@ export declare function getOrderShipState(context: BRC, shipId: string): Promise
* @param context
* @returns
*/
export declare function refreshtShipState(ship: EntityDict['ship']['Schema'], context: BRC): Promise<import("oak-domain/lib/types").OperationResult<EntityDict> | undefined>;
export declare function refreshtShipState(shipId: string, context: BRC): Promise<import("oak-domain/lib/types").OperationResult<EntityDict> | undefined>;
/**
*
*/

View File

@ -321,49 +321,68 @@ export async function getOrderShipState(context, shipId) {
* @param context
* @returns
*/
export async function refreshtShipState(ship, context) {
let ship2 = ship;
if (!ship2.iState || !ship2.entity || !ship2.entityId) {
const ships = await context.select('ship', {
data: shipProjection,
filter: {
id: ship.id,
export async function refreshtShipState(shipId, context) {
const ships = await context.select('ship', {
data: shipProjection,
filter: {
id: shipId,
}
}, {
blockTrigger: true,
forUpdate: true,
});
const ship = ships[0];
const { entity, entityId } = ship;
if (entity && entityId) {
const clazz = await getShipClazz(entity, entityId, context);
const { state, time } = await clazz.syncState(ship.id, context);
const wpPayIds = ship.shipOrder$ship?.map((ele) => ele.order).map((order) => order.pay$order).flat().filter((pay) => pay?.entity === 'wpProduct').map((ele) => ele?.id);
let needReceiving = false;
if (wpPayIds && wpPayIds.length > 0) {
const cnt = await context.count('pay', {
filter: {
id: {
$in: wpPayIds,
},
iState: {
$ne: 'closed',
},
wpProduct: {
needReceiving: true,
}
}
}, {});
if (cnt > 0) {
needReceiving = true;
}
}, {
blockTrigger: true,
forUpdate: true,
});
ship2 = ships[0];
}
const { entity, entityId } = ship2;
const clazz = await getShipClazz(entity, entityId, context);
const { state, time } = await clazz.syncState(ship2.id, context);
let action = undefined, updateData = {};
switch (state) {
case 'shipping': //已发货
action = 'ship';
break;
case 'received': //已收货
action = 'receive';
updateData = {
receiveAt: time
};
break;
case 'unknow': //不明
action = 'unknow';
break;
default:
action = undefined;
}
if (action && ship2.iState !== state) {
return await context.operate('ship', {
id: await generateNewIdAsync(),
action,
data: updateData,
filter: {
id: ship2.id,
}
}, {});
}
let action = undefined, updateData = {};
switch (state) {
case 'shipping': //已发货
action = 'ship';
break;
case 'received': //已收货
action = needReceiving ? 'startReceiving' : 'receive';
updateData = {
receiveAt: time
};
break;
case 'unknow': //不明
action = 'unknow';
break;
default:
action = undefined;
}
if (action && ship.iState !== state) {
return await context.operate('ship', {
id: await generateNewIdAsync(),
action,
data: updateData,
filter: {
id: ship.id,
}
}, {});
}
}
}
/**

View File

@ -250,7 +250,6 @@ export default class WechatMpShipDebug {
$entity: 'shipOrder',
data: {
orderId: 1,
order: {}
},
},
wechatMpShip: {
@ -315,7 +314,7 @@ export default class WechatMpShipDebug {
const data = await this.prepareGetOrder(shipId, context);
console.log('mock getPrintInfo to wechatMpShip, data:', data);
const mockData = 'PGh0bWw+PGhlYWQ+PC9oZWFkPjxib2R5PjxoMT5tb2NrIOmdouWNlTwvaDE+PC9ib2R5PjwvaHRtbD4=';
const mockHtml = decodeURIComponent(escape(window.atob(mockData)));
const mockHtml = Buffer.from(mockData, 'base64').toString();
return {
type: 'html',
data: mockHtml

View File

@ -72,7 +72,7 @@ export default class WechatMpShip extends DebugClazz {
const data = await this.prepareGetOrder(shipId, context);
const result = await instance.getExpressOrder(data);
const base64Html = result.print_html;
const html = decodeURIComponent(escape(window.atob(base64Html)));
const html = Buffer.from(base64Html, 'base64').toString();
return {
type: 'html',
data: html,

View File

@ -8,6 +8,7 @@ const watchers = [
filter: async () => {
const now = Date.now();
return {
type: 'express',
iState: 'shipping',
$$updateAt$$: {
$lte: now - QUERY_PAYING_STATE_GAP,
@ -18,7 +19,7 @@ const watchers = [
fn: async (context, data) => {
const results = [];
for (const ship of data) {
const result = await refreshtShipState(ship, context);
const result = await refreshtShipState(ship.id, context);
if (result) {
results.push(result);
}

View File

@ -56,6 +56,52 @@ const checkers = [
data.receiveAt = now;
}
}
},
{
entity: 'ship',
type: 'row',
action: ['startReceiving', 'succeedReceiving'],
filter: {
shipOrder$ship: {
order: {
pay$order: {
$and: [{
wpProduct: {
needReceiving: true
}
}, {
iState: {
$ne: 'closed'
}
}]
}
}
}
}
},
{
entity: 'ship',
type: 'row',
action: 'receive',
filter: {
shipOrder$ship: {
'#sqp': 'all',
order: {
pay$order: {
'#sqp': 'not in',
$and: [{
wpProduct: {
needReceiving: true
}
}, {
iState: {
$ne: 'closed'
}
}]
}
}
}
}
}
];
exports.default = checkers;

View File

@ -49,6 +49,7 @@ export type OpSortAttr = Partial<{
refundGapDays: number;
refundCompensateRatio: number;
needReceiving: number;
applicationId: number;
enabled: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;

View File

@ -58,6 +58,7 @@ export type OpSortAttr = Partial<{
withdrawTransferLossRatio: number;
price: number;
needReceiving: number;
systemId: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<Action | string>;

View File

@ -45,6 +45,7 @@ export type OpSortAttr = Partial<{
sort: number;
phatom1: number;
phatom2: number;
systemId: number;
disabled: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;

View File

@ -52,6 +52,7 @@ export type OpSortAttr = Partial<{
total: number;
avail: number;
refundable: number;
ofSystemId: number;
entity: number;
entityId: number;
ableState: number;

View File

@ -58,6 +58,7 @@ export type OpSortAttr = Partial<{
$$createAt$$: number;
$$seq$$: number;
$$updateAt$$: number;
accountId: number;
type: number;
totalPlus: number;
availPlus: number;

View File

@ -36,6 +36,8 @@ export type OpSortAttr = Partial<{
$$createAt$$: number;
$$seq$$: number;
$$updateAt$$: number;
relationId: number;
pathId: number;
deActions: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;

View File

@ -52,6 +52,7 @@ export type OpSortAttr = Partial<{
$$seq$$: number;
$$updateAt$$: number;
detail: number;
areaId: number;
phone: number;
name: number;
default: number;

View File

@ -133,10 +133,12 @@ export type OpSortAttr = Partial<{
name: number;
description: number;
type: number;
systemId: number;
style: number;
dangerousVersions: number;
warningVersions: number;
soaVersion: number;
domainId: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<GenericAction | string>;

View File

@ -36,6 +36,8 @@ export type OpSortAttr = Partial<{
$$createAt$$: number;
$$seq$$: number;
$$updateAt$$: number;
applicationId: number;
passportId: number;
isDefault: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;

View File

@ -47,6 +47,7 @@ export type OpSortAttr = Partial<{
name: number;
level: number;
depth: number;
parentId: number;
code: number;
center: number;
[k: string]: any;

View File

@ -38,6 +38,7 @@ export type OpSortAttr = Partial<{
$$updateAt$$: number;
name: number;
content: number;
articleMenuId: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<GenericAction | string>;

View File

@ -47,6 +47,7 @@ export type OpSortAttr = Partial<{
$$updateAt$$: number;
name: number;
isArticle: number;
parentId: number;
isLeaf: number;
entity: number;
entityId: number;

View File

@ -39,6 +39,7 @@ export type OpSortAttr = Partial<{
$$createAt$$: number;
$$seq$$: number;
$$updateAt$$: number;
userId: number;
prevPassword: number;
newPassword: number;
result: number;

View File

@ -47,6 +47,9 @@ export type OpSortAttr = Partial<{
$$updateAt$$: number;
price: number;
loss: number;
accountId: number;
creatorId: number;
shipId: number;
iState: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;

View File

@ -46,6 +46,7 @@ export type OpSortAttr = Partial<{
apiPath: number;
protocol: number;
port: number;
systemId: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<GenericAction | string>;

View File

@ -38,6 +38,7 @@ export type OpSortAttr = Partial<{
$$seq$$: number;
$$updateAt$$: number;
email: number;
userId: number;
ableState: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;

View File

@ -104,6 +104,7 @@ export type OpSortAttr = Partial<{
fileType: number;
isBridge: number;
uploadState: number;
applicationId: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<GenericAction | string>;

Some files were not shown because too many files have changed in this diff Show More