低级错误
This commit is contained in:
parent
ca093d38a3
commit
b8aabb4cac
|
|
@ -114,9 +114,10 @@ function setUserSubscribed(openId, eventKey, context) {
|
|||
// activeAt: now,
|
||||
};
|
||||
doUpdate = function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
||||
var wechatUser;
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
var wechatUser, _a, _b, _c;
|
||||
var _d;
|
||||
return tslib_1.__generator(this, function (_e) {
|
||||
switch (_e.label) {
|
||||
case 0:
|
||||
if (!(list && list.length > 0)) return [3 /*break*/, 2];
|
||||
(0, assert_1.default)(list.length === 1);
|
||||
|
|
@ -134,19 +135,24 @@ function setUserSubscribed(openId, eventKey, context) {
|
|||
id: wechatUser.id,
|
||||
},
|
||||
}, { dontCollect: true, dontCreateOper: true })];
|
||||
case 1: return [2 /*return*/, _a.sent()];
|
||||
case 1: return [2 /*return*/, _e.sent()];
|
||||
case 2:
|
||||
Object.assign(data, {
|
||||
subscribed: true,
|
||||
subscribedAt: now,
|
||||
applicationId: applicationId,
|
||||
openId: openId,
|
||||
});
|
||||
_b = (_a = Object).assign;
|
||||
_c = [data];
|
||||
_d = {};
|
||||
return [4 /*yield*/, (0, uuid_1.generateNewIdAsync)()];
|
||||
case 3:
|
||||
_b.apply(_a, _c.concat([(_d.id = _e.sent(),
|
||||
_d.subscribed = true,
|
||||
_d.subscribedAt = now,
|
||||
_d.applicationId = applicationId,
|
||||
_d.openId = openId,
|
||||
_d)]));
|
||||
return [4 /*yield*/, context.operate('wechatUser', {
|
||||
action: 'create',
|
||||
data: data,
|
||||
}, { dontCollect: true })];
|
||||
case 3:
|
||||
case 4:
|
||||
// 这里试着直接把user也创建出来,by Xc 20190720
|
||||
/**
|
||||
* 这里不能创建user,否则会出现一个weChatUser有openId和userId,却没有unionId
|
||||
|
|
@ -161,7 +167,7 @@ function setUserSubscribed(openId, eventKey, context) {
|
|||
return warden.insertEntity(tables.weChatUser, data, txn);
|
||||
}
|
||||
);*/
|
||||
return [2 /*return*/, _a.sent()];
|
||||
return [2 /*return*/, _e.sent()];
|
||||
}
|
||||
});
|
||||
}); };
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import { EntityDict } from '../general-app-domain';
|
|||
import { BRC } from '../types/RuntimeCxt';
|
||||
import { WechatPublicConfig } from '../entities/Application';
|
||||
import { WechatPublicEventData } from 'oak-external-sdk';
|
||||
import { expandUuidTo36Bytes } from 'oak-domain/lib/utils/uuid';
|
||||
import { expandUuidTo36Bytes, generateNewIdAsync } from 'oak-domain/lib/utils/uuid';
|
||||
import { composeDomainUrl } from '../utils/domain';
|
||||
|
||||
type VerifyQuery = {
|
||||
|
|
@ -151,6 +151,7 @@ async function setUserSubscribed(openId: string, eventKey: string, context: BRC)
|
|||
}
|
||||
|
||||
Object.assign(data, {
|
||||
id: await generateNewIdAsync(),
|
||||
subscribed: true,
|
||||
subscribedAt: now,
|
||||
applicationId,
|
||||
|
|
|
|||
Loading…
Reference in New Issue