绑定微信号 二维码
This commit is contained in:
parent
08ea90acd8
commit
8f2b10044e
|
|
@ -0,0 +1,15 @@
|
|||
import { Text, Datetime } from 'oak-domain/lib/types/DataType';
|
||||
import { EntityShape } from 'oak-domain/lib/types/Entity';
|
||||
import { Schema as User } from './User';
|
||||
import { Schema as WechatQrCode } from './WechatQrCode';
|
||||
import { QrCodeType } from '../types/Config';
|
||||
export interface Schema extends EntityShape {
|
||||
user?: User;
|
||||
type: 'bind' | 'login';
|
||||
successed: Boolean;
|
||||
remark?: Text;
|
||||
qrCodeType: QrCodeType;
|
||||
expiresAt?: Datetime;
|
||||
expired?: Boolean;
|
||||
codes: Array<WechatQrCode>;
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var indexes = [
|
||||
{
|
||||
name: 'index_uuid',
|
||||
attributes: [
|
||||
{
|
||||
name: 'expired',
|
||||
},
|
||||
{
|
||||
name: 'expiresAt',
|
||||
}
|
||||
],
|
||||
},
|
||||
];
|
||||
var locale = {
|
||||
zh_CN: {
|
||||
name: '绑定微信号',
|
||||
attr: {
|
||||
user: '用户',
|
||||
type: '类型',
|
||||
successed: '是否成功',
|
||||
remark: '备注',
|
||||
codes: '微信码',
|
||||
expired: '是否过期',
|
||||
expiresAt: '过期时间',
|
||||
qrCodeType: '二维码类型',
|
||||
},
|
||||
action: {
|
||||
success: '成功',
|
||||
},
|
||||
v: {
|
||||
type: {
|
||||
bind: '绑定',
|
||||
login: '登录',
|
||||
},
|
||||
qrCodeType: {
|
||||
webForWechatPublic: '网站引流到公众号',
|
||||
wechatMpDomainUrl: '小程序url码',
|
||||
wechatMpWxaCode: '小程序码',
|
||||
wechatPublic: '公众号关注码',
|
||||
wechatPublicForMp: '公众号跳转小程序码',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
@ -29,4 +29,5 @@ export declare const ActionDefDict: {
|
|||
userState: import("oak-domain/lib/types").ActionDef<string, string>;
|
||||
};
|
||||
userEntityGrant: {};
|
||||
wechatLogin: {};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ var Action_7 = require("./Notification/Action");
|
|||
var Action_8 = require("./Token/Action");
|
||||
var Action_9 = require("./User/Action");
|
||||
var Action_10 = require("./UserEntityGrant/Action");
|
||||
var Action_11 = require("./WechatLogin/Action");
|
||||
exports.ActionDefDict = {
|
||||
modi: Action_1.ActionDefDict,
|
||||
article: Action_2.ActionDefDict,
|
||||
|
|
@ -21,5 +22,6 @@ exports.ActionDefDict = {
|
|||
notification: Action_7.ActionDefDict,
|
||||
token: Action_8.ActionDefDict,
|
||||
user: Action_9.ActionDefDict,
|
||||
userEntityGrant: Action_10.ActionDefDict
|
||||
userEntityGrant: Action_10.ActionDefDict,
|
||||
wechatLogin: Action_11.ActionDefDict
|
||||
};
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import { EntityDef as System } from "./System/Schema";
|
|||
import { EntityDef as Token } from "./Token/Schema";
|
||||
import { EntityDef as UserSystem } from "./UserSystem/Schema";
|
||||
import { EntityDef as UserWechatPublicTag } from "./UserWechatPublicTag/Schema";
|
||||
import { EntityDef as WechatLogin } from "./WechatLogin/Schema";
|
||||
import { EntityDef as WechatPublicTag } from "./WechatPublicTag/Schema";
|
||||
import { EntityDef as WechatQrCode } from "./WechatQrCode/Schema";
|
||||
import { EntityDef as WechatUser } from "./WechatUser/Schema";
|
||||
|
|
@ -74,6 +75,7 @@ export declare type EntityDict = {
|
|||
token: Token;
|
||||
userSystem: UserSystem;
|
||||
userWechatPublicTag: UserWechatPublicTag;
|
||||
wechatLogin: WechatLogin;
|
||||
wechatPublicTag: WechatPublicTag;
|
||||
wechatQrCode: WechatQrCode;
|
||||
wechatUser: WechatUser;
|
||||
|
|
|
|||
|
|
@ -9,24 +9,26 @@ import * as User from "../User/Schema";
|
|||
import * as UserEntityGrant from "../UserEntityGrant/Schema";
|
||||
import * as UserSystem from "../UserSystem/Schema";
|
||||
import * as UserWechatPublicTag from "../UserWechatPublicTag/Schema";
|
||||
import * as WechatLogin from "../WechatLogin/Schema";
|
||||
import * as WechatPublicTag from "../WechatPublicTag/Schema";
|
||||
import * as WechatQrCode from "../WechatQrCode/Schema";
|
||||
import * as WechatUser from "../WechatUser/Schema";
|
||||
export declare type OpSchema = EntityShape & {
|
||||
modiId: ForeignKey<"modi">;
|
||||
entity: "user" | "userEntityGrant" | "userSystem" | "userWechatPublicTag" | "wechatPublicTag" | "wechatQrCode" | "wechatUser" | string;
|
||||
entity: "user" | "userEntityGrant" | "userSystem" | "userWechatPublicTag" | "wechatLogin" | "wechatPublicTag" | "wechatQrCode" | "wechatUser" | string;
|
||||
entityId: String<64>;
|
||||
};
|
||||
export declare type OpAttr = keyof OpSchema;
|
||||
export declare type Schema = EntityShape & {
|
||||
modiId: ForeignKey<"modi">;
|
||||
entity: "user" | "userEntityGrant" | "userSystem" | "userWechatPublicTag" | "wechatPublicTag" | "wechatQrCode" | "wechatUser" | string;
|
||||
entity: "user" | "userEntityGrant" | "userSystem" | "userWechatPublicTag" | "wechatLogin" | "wechatPublicTag" | "wechatQrCode" | "wechatUser" | string;
|
||||
entityId: String<64>;
|
||||
modi: Modi.Schema;
|
||||
user?: User.Schema;
|
||||
userEntityGrant?: UserEntityGrant.Schema;
|
||||
userSystem?: UserSystem.Schema;
|
||||
userWechatPublicTag?: UserWechatPublicTag.Schema;
|
||||
wechatLogin?: WechatLogin.Schema;
|
||||
wechatPublicTag?: WechatPublicTag.Schema;
|
||||
wechatQrCode?: WechatQrCode.Schema;
|
||||
wechatUser?: WechatUser.Schema;
|
||||
|
|
@ -46,11 +48,12 @@ declare type AttrFilter<E> = {
|
|||
userEntityGrant: UserEntityGrant.Filter;
|
||||
userSystem: UserSystem.Filter;
|
||||
userWechatPublicTag: UserWechatPublicTag.Filter;
|
||||
wechatLogin: WechatLogin.Filter;
|
||||
wechatPublicTag: WechatPublicTag.Filter;
|
||||
wechatQrCode: WechatQrCode.Filter;
|
||||
wechatUser: WechatUser.Filter;
|
||||
};
|
||||
export declare type Filter<E = Q_EnumValue<"user" | "userEntityGrant" | "userSystem" | "userWechatPublicTag" | "wechatPublicTag" | "wechatQrCode" | "wechatUser" | string>> = MakeFilter<AttrFilter<E> & ExprOp<OpAttr | string>>;
|
||||
export declare type Filter<E = Q_EnumValue<"user" | "userEntityGrant" | "userSystem" | "userWechatPublicTag" | "wechatLogin" | "wechatPublicTag" | "wechatQrCode" | "wechatUser" | string>> = MakeFilter<AttrFilter<E> & ExprOp<OpAttr | string>>;
|
||||
export declare type Projection = {
|
||||
"#id"?: NodeId;
|
||||
[k: string]: any;
|
||||
|
|
@ -66,6 +69,7 @@ export declare type Projection = {
|
|||
userEntityGrant?: UserEntityGrant.Projection;
|
||||
userSystem?: UserSystem.Projection;
|
||||
userWechatPublicTag?: UserWechatPublicTag.Projection;
|
||||
wechatLogin?: WechatLogin.Projection;
|
||||
wechatPublicTag?: WechatPublicTag.Projection;
|
||||
wechatQrCode?: WechatQrCode.Projection;
|
||||
wechatUser?: WechatUser.Projection;
|
||||
|
|
@ -88,6 +92,9 @@ declare type UserSystemIdProjection = OneOf<{
|
|||
declare type UserWechatPublicTagIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
declare type WechatLoginIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
declare type WechatPublicTagIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
|
|
@ -121,6 +128,8 @@ export declare type SortAttr = {
|
|||
userSystem: UserSystem.SortAttr;
|
||||
} | {
|
||||
userWechatPublicTag: UserWechatPublicTag.SortAttr;
|
||||
} | {
|
||||
wechatLogin: WechatLogin.SortAttr;
|
||||
} | {
|
||||
wechatPublicTag: WechatPublicTag.SortAttr;
|
||||
} | {
|
||||
|
|
@ -190,6 +199,17 @@ export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity"
|
|||
} | {
|
||||
entity: "userWechatPublicTag";
|
||||
entityId: String<64>;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
wechatLogin: WechatLogin.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "wechatLogin";
|
||||
entityId: String<64>;
|
||||
wechatLogin: WechatLogin.UpdateOperation;
|
||||
} | {
|
||||
entity: "wechatLogin";
|
||||
entityId: String<64>;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
|
|
@ -259,6 +279,10 @@ export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity"
|
|||
userWechatPublicTag?: UserWechatPublicTag.CreateSingleOperation | UserWechatPublicTag.UpdateOperation | UserWechatPublicTag.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
wechatLogin?: WechatLogin.CreateSingleOperation | WechatLogin.UpdateOperation | WechatLogin.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
wechatPublicTag?: WechatPublicTag.CreateSingleOperation | WechatPublicTag.UpdateOperation | WechatPublicTag.RemoveOperation;
|
||||
entityId?: never;
|
||||
|
|
@ -272,7 +296,7 @@ export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity"
|
|||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
entity?: ("user" | "userEntityGrant" | "userSystem" | "userWechatPublicTag" | "wechatPublicTag" | "wechatQrCode" | "wechatUser" | string) | null;
|
||||
entity?: ("user" | "userEntityGrant" | "userSystem" | "userWechatPublicTag" | "wechatLogin" | "wechatPublicTag" | "wechatQrCode" | "wechatUser" | string) | null;
|
||||
entityId?: String<64> | null;
|
||||
}) & {
|
||||
[k: string]: any;
|
||||
|
|
@ -288,6 +312,8 @@ export declare type RemoveOperationData = {} & (({
|
|||
userSystem?: UserSystem.UpdateOperation | UserSystem.RemoveOperation;
|
||||
} | {
|
||||
userWechatPublicTag?: UserWechatPublicTag.UpdateOperation | UserWechatPublicTag.RemoveOperation;
|
||||
} | {
|
||||
wechatLogin?: WechatLogin.UpdateOperation | WechatLogin.RemoveOperation;
|
||||
} | {
|
||||
wechatPublicTag?: WechatPublicTag.UpdateOperation | WechatPublicTag.RemoveOperation;
|
||||
} | {
|
||||
|
|
@ -304,6 +330,7 @@ export declare type UserIdSubQuery = Selection<UserIdProjection>;
|
|||
export declare type UserEntityGrantIdSubQuery = Selection<UserEntityGrantIdProjection>;
|
||||
export declare type UserSystemIdSubQuery = Selection<UserSystemIdProjection>;
|
||||
export declare type UserWechatPublicTagIdSubQuery = Selection<UserWechatPublicTagIdProjection>;
|
||||
export declare type WechatLoginIdSubQuery = Selection<WechatLoginIdProjection>;
|
||||
export declare type WechatPublicTagIdSubQuery = Selection<WechatPublicTagIdProjection>;
|
||||
export declare type WechatQrCodeIdSubQuery = Selection<WechatQrCodeIdProjection>;
|
||||
export declare type WechatUserIdSubQuery = Selection<WechatUserIdProjection>;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ exports.desc = {
|
|||
params: {
|
||||
length: 32
|
||||
},
|
||||
ref: ["user", "userEntityGrant", "userSystem", "userWechatPublicTag", "wechatPublicTag", "wechatQrCode", "wechatUser"]
|
||||
ref: ["user", "userEntityGrant", "userSystem", "userWechatPublicTag", "wechatLogin", "wechatPublicTag", "wechatQrCode", "wechatUser"]
|
||||
},
|
||||
entityId: {
|
||||
notNull: true,
|
||||
|
|
|
|||
|
|
@ -9,24 +9,26 @@ import * as User from "../User/Schema";
|
|||
import * as UserEntityGrant from "../UserEntityGrant/Schema";
|
||||
import * as UserSystem from "../UserSystem/Schema";
|
||||
import * as UserWechatPublicTag from "../UserWechatPublicTag/Schema";
|
||||
import * as WechatLogin from "../WechatLogin/Schema";
|
||||
import * as WechatPublicTag from "../WechatPublicTag/Schema";
|
||||
import * as WechatQrCode from "../WechatQrCode/Schema";
|
||||
import * as WechatUser from "../WechatUser/Schema";
|
||||
export declare type OpSchema = EntityShape & {
|
||||
operId: ForeignKey<"oper">;
|
||||
entity: "user" | "userEntityGrant" | "userSystem" | "userWechatPublicTag" | "wechatPublicTag" | "wechatQrCode" | "wechatUser" | string;
|
||||
entity: "user" | "userEntityGrant" | "userSystem" | "userWechatPublicTag" | "wechatLogin" | "wechatPublicTag" | "wechatQrCode" | "wechatUser" | string;
|
||||
entityId: String<64>;
|
||||
};
|
||||
export declare type OpAttr = keyof OpSchema;
|
||||
export declare type Schema = EntityShape & {
|
||||
operId: ForeignKey<"oper">;
|
||||
entity: "user" | "userEntityGrant" | "userSystem" | "userWechatPublicTag" | "wechatPublicTag" | "wechatQrCode" | "wechatUser" | string;
|
||||
entity: "user" | "userEntityGrant" | "userSystem" | "userWechatPublicTag" | "wechatLogin" | "wechatPublicTag" | "wechatQrCode" | "wechatUser" | string;
|
||||
entityId: String<64>;
|
||||
oper: Oper.Schema;
|
||||
user?: User.Schema;
|
||||
userEntityGrant?: UserEntityGrant.Schema;
|
||||
userSystem?: UserSystem.Schema;
|
||||
userWechatPublicTag?: UserWechatPublicTag.Schema;
|
||||
wechatLogin?: WechatLogin.Schema;
|
||||
wechatPublicTag?: WechatPublicTag.Schema;
|
||||
wechatQrCode?: WechatQrCode.Schema;
|
||||
wechatUser?: WechatUser.Schema;
|
||||
|
|
@ -46,11 +48,12 @@ declare type AttrFilter<E> = {
|
|||
userEntityGrant: UserEntityGrant.Filter;
|
||||
userSystem: UserSystem.Filter;
|
||||
userWechatPublicTag: UserWechatPublicTag.Filter;
|
||||
wechatLogin: WechatLogin.Filter;
|
||||
wechatPublicTag: WechatPublicTag.Filter;
|
||||
wechatQrCode: WechatQrCode.Filter;
|
||||
wechatUser: WechatUser.Filter;
|
||||
};
|
||||
export declare type Filter<E = Q_EnumValue<"user" | "userEntityGrant" | "userSystem" | "userWechatPublicTag" | "wechatPublicTag" | "wechatQrCode" | "wechatUser" | string>> = MakeFilter<AttrFilter<E> & ExprOp<OpAttr | string>>;
|
||||
export declare type Filter<E = Q_EnumValue<"user" | "userEntityGrant" | "userSystem" | "userWechatPublicTag" | "wechatLogin" | "wechatPublicTag" | "wechatQrCode" | "wechatUser" | string>> = MakeFilter<AttrFilter<E> & ExprOp<OpAttr | string>>;
|
||||
export declare type Projection = {
|
||||
"#id"?: NodeId;
|
||||
[k: string]: any;
|
||||
|
|
@ -66,6 +69,7 @@ export declare type Projection = {
|
|||
userEntityGrant?: UserEntityGrant.Projection;
|
||||
userSystem?: UserSystem.Projection;
|
||||
userWechatPublicTag?: UserWechatPublicTag.Projection;
|
||||
wechatLogin?: WechatLogin.Projection;
|
||||
wechatPublicTag?: WechatPublicTag.Projection;
|
||||
wechatQrCode?: WechatQrCode.Projection;
|
||||
wechatUser?: WechatUser.Projection;
|
||||
|
|
@ -88,6 +92,9 @@ declare type UserSystemIdProjection = OneOf<{
|
|||
declare type UserWechatPublicTagIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
declare type WechatLoginIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
declare type WechatPublicTagIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
|
|
@ -121,6 +128,8 @@ export declare type SortAttr = {
|
|||
userSystem: UserSystem.SortAttr;
|
||||
} | {
|
||||
userWechatPublicTag: UserWechatPublicTag.SortAttr;
|
||||
} | {
|
||||
wechatLogin: WechatLogin.SortAttr;
|
||||
} | {
|
||||
wechatPublicTag: WechatPublicTag.SortAttr;
|
||||
} | {
|
||||
|
|
@ -187,6 +196,17 @@ export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity"
|
|||
} | {
|
||||
entity: "userWechatPublicTag";
|
||||
entityId: String<64>;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
wechatLogin: WechatLogin.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "wechatLogin";
|
||||
entityId: String<64>;
|
||||
wechatLogin: WechatLogin.UpdateOperation;
|
||||
} | {
|
||||
entity: "wechatLogin";
|
||||
entityId: String<64>;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
|
|
@ -250,6 +270,10 @@ export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity"
|
|||
userWechatPublicTag?: UserWechatPublicTag.CreateSingleOperation | UserWechatPublicTag.UpdateOperation | UserWechatPublicTag.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
wechatLogin?: WechatLogin.CreateSingleOperation | WechatLogin.UpdateOperation | WechatLogin.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
wechatPublicTag?: WechatPublicTag.CreateSingleOperation | WechatPublicTag.UpdateOperation | WechatPublicTag.RemoveOperation;
|
||||
entityId?: never;
|
||||
|
|
@ -263,7 +287,7 @@ export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity"
|
|||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
entity?: ("user" | "userEntityGrant" | "userSystem" | "userWechatPublicTag" | "wechatPublicTag" | "wechatQrCode" | "wechatUser" | string) | null;
|
||||
entity?: ("user" | "userEntityGrant" | "userSystem" | "userWechatPublicTag" | "wechatLogin" | "wechatPublicTag" | "wechatQrCode" | "wechatUser" | string) | null;
|
||||
entityId?: String<64> | null;
|
||||
}) & {
|
||||
[k: string]: any;
|
||||
|
|
@ -277,6 +301,8 @@ export declare type RemoveOperationData = {} & ({
|
|||
userSystem?: UserSystem.UpdateOperation | UserSystem.RemoveOperation;
|
||||
} | {
|
||||
userWechatPublicTag?: UserWechatPublicTag.UpdateOperation | UserWechatPublicTag.RemoveOperation;
|
||||
} | {
|
||||
wechatLogin?: WechatLogin.UpdateOperation | WechatLogin.RemoveOperation;
|
||||
} | {
|
||||
wechatPublicTag?: WechatPublicTag.UpdateOperation | WechatPublicTag.RemoveOperation;
|
||||
} | {
|
||||
|
|
@ -293,6 +319,7 @@ export declare type UserIdSubQuery = Selection<UserIdProjection>;
|
|||
export declare type UserEntityGrantIdSubQuery = Selection<UserEntityGrantIdProjection>;
|
||||
export declare type UserSystemIdSubQuery = Selection<UserSystemIdProjection>;
|
||||
export declare type UserWechatPublicTagIdSubQuery = Selection<UserWechatPublicTagIdProjection>;
|
||||
export declare type WechatLoginIdSubQuery = Selection<WechatLoginIdProjection>;
|
||||
export declare type WechatPublicTagIdSubQuery = Selection<WechatPublicTagIdProjection>;
|
||||
export declare type WechatQrCodeIdSubQuery = Selection<WechatQrCodeIdProjection>;
|
||||
export declare type WechatUserIdSubQuery = Selection<WechatUserIdProjection>;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ exports.desc = {
|
|||
params: {
|
||||
length: 32
|
||||
},
|
||||
ref: ["user", "userEntityGrant", "userSystem", "userWechatPublicTag", "wechatPublicTag", "wechatQrCode", "wechatUser"]
|
||||
ref: ["user", "userEntityGrant", "userSystem", "userWechatPublicTag", "wechatLogin", "wechatPublicTag", "wechatQrCode", "wechatUser"]
|
||||
},
|
||||
entityId: {
|
||||
notNull: true,
|
||||
|
|
|
|||
|
|
@ -37,9 +37,10 @@ var Storage_33 = require("./System/Storage");
|
|||
var Storage_34 = require("./Token/Storage");
|
||||
var Storage_35 = require("./UserSystem/Storage");
|
||||
var Storage_36 = require("./UserWechatPublicTag/Storage");
|
||||
var Storage_37 = require("./WechatPublicTag/Storage");
|
||||
var Storage_38 = require("./WechatQrCode/Storage");
|
||||
var Storage_39 = require("./WechatUser/Storage");
|
||||
var Storage_37 = require("./WechatLogin/Storage");
|
||||
var Storage_38 = require("./WechatPublicTag/Storage");
|
||||
var Storage_39 = require("./WechatQrCode/Storage");
|
||||
var Storage_40 = require("./WechatUser/Storage");
|
||||
exports.storageSchema = {
|
||||
actionAuth: Storage_1.desc,
|
||||
modi: Storage_2.desc,
|
||||
|
|
@ -77,7 +78,8 @@ exports.storageSchema = {
|
|||
token: Storage_34.desc,
|
||||
userSystem: Storage_35.desc,
|
||||
userWechatPublicTag: Storage_36.desc,
|
||||
wechatPublicTag: Storage_37.desc,
|
||||
wechatQrCode: Storage_38.desc,
|
||||
wechatUser: Storage_39.desc
|
||||
wechatLogin: Storage_37.desc,
|
||||
wechatPublicTag: Storage_38.desc,
|
||||
wechatQrCode: Storage_39.desc,
|
||||
wechatUser: Storage_40.desc
|
||||
};
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import * as Token from "../Token/Schema";
|
|||
import * as UserEntityGrant from "../UserEntityGrant/Schema";
|
||||
import * as UserSystem from "../UserSystem/Schema";
|
||||
import * as UserWechatPublicTag from "../UserWechatPublicTag/Schema";
|
||||
import * as WechatLogin from "../WechatLogin/Schema";
|
||||
import * as WechatUser from "../WechatUser/Schema";
|
||||
import * as ModiEntity from "../ModiEntity/Schema";
|
||||
import * as OperEntity from "../OperEntity/Schema";
|
||||
|
|
@ -73,6 +74,8 @@ export declare type Schema = EntityShape & {
|
|||
userSystem$user$$aggr?: AggregationResult<UserSystem.Schema>;
|
||||
userWechatPublicTag$user?: Array<UserWechatPublicTag.Schema>;
|
||||
userWechatPublicTag$user$$aggr?: AggregationResult<UserWechatPublicTag.Schema>;
|
||||
wechatLogin$user?: Array<WechatLogin.Schema>;
|
||||
wechatLogin$user$$aggr?: AggregationResult<WechatLogin.Schema>;
|
||||
wechatUser$user?: Array<WechatUser.Schema>;
|
||||
wechatUser$user$$aggr?: AggregationResult<WechatUser.Schema>;
|
||||
modiEntity$entity?: Array<ModiEntity.Schema>;
|
||||
|
|
@ -202,6 +205,12 @@ export declare type Projection = {
|
|||
userWechatPublicTag$user$$aggr?: UserWechatPublicTag.Aggregation & {
|
||||
$entity: "userWechatPublicTag";
|
||||
};
|
||||
wechatLogin$user?: WechatLogin.Selection & {
|
||||
$entity: "wechatLogin";
|
||||
};
|
||||
wechatLogin$user$$aggr?: WechatLogin.Aggregation & {
|
||||
$entity: "wechatLogin";
|
||||
};
|
||||
wechatUser$user?: WechatUser.Selection & {
|
||||
$entity: "wechatUser";
|
||||
};
|
||||
|
|
@ -302,6 +311,7 @@ export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "refId">
|
|||
userEntityGrant$grantee?: OakOperation<UserEntityGrant.UpdateOperation["action"], Omit<UserEntityGrant.UpdateOperationData, "grantee" | "granteeId">, UserEntityGrant.Filter> | OakOperation<"create", Omit<UserEntityGrant.CreateOperationData, "grantee" | "granteeId">[]> | Array<OakOperation<"create", Omit<UserEntityGrant.CreateOperationData, "grantee" | "granteeId">> | OakOperation<UserEntityGrant.UpdateOperation["action"], Omit<UserEntityGrant.UpdateOperationData, "grantee" | "granteeId">, UserEntityGrant.Filter>>;
|
||||
userSystem$user?: OakOperation<UserSystem.UpdateOperation["action"], Omit<UserSystem.UpdateOperationData, "user" | "userId">, UserSystem.Filter> | OakOperation<"create", Omit<UserSystem.CreateOperationData, "user" | "userId">[]> | Array<OakOperation<"create", Omit<UserSystem.CreateOperationData, "user" | "userId">> | OakOperation<UserSystem.UpdateOperation["action"], Omit<UserSystem.UpdateOperationData, "user" | "userId">, UserSystem.Filter>>;
|
||||
userWechatPublicTag$user?: OakOperation<UserWechatPublicTag.UpdateOperation["action"], Omit<UserWechatPublicTag.UpdateOperationData, "user" | "userId">, UserWechatPublicTag.Filter> | OakOperation<"create", Omit<UserWechatPublicTag.CreateOperationData, "user" | "userId">[]> | Array<OakOperation<"create", Omit<UserWechatPublicTag.CreateOperationData, "user" | "userId">> | OakOperation<UserWechatPublicTag.UpdateOperation["action"], Omit<UserWechatPublicTag.UpdateOperationData, "user" | "userId">, UserWechatPublicTag.Filter>>;
|
||||
wechatLogin$user?: OakOperation<WechatLogin.UpdateOperation["action"], Omit<WechatLogin.UpdateOperationData, "user" | "userId">, WechatLogin.Filter> | OakOperation<"create", Omit<WechatLogin.CreateOperationData, "user" | "userId">[]> | Array<OakOperation<"create", Omit<WechatLogin.CreateOperationData, "user" | "userId">> | OakOperation<WechatLogin.UpdateOperation["action"], Omit<WechatLogin.UpdateOperationData, "user" | "userId">, WechatLogin.Filter>>;
|
||||
wechatUser$user?: OakOperation<WechatUser.UpdateOperation["action"], Omit<WechatUser.UpdateOperationData, "user" | "userId">, WechatUser.Filter> | OakOperation<"create", Omit<WechatUser.CreateOperationData, "user" | "userId">[]> | Array<OakOperation<"create", Omit<WechatUser.CreateOperationData, "user" | "userId">> | OakOperation<WechatUser.UpdateOperation["action"], Omit<WechatUser.UpdateOperationData, "user" | "userId">, WechatUser.Filter>>;
|
||||
modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
|
||||
operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
|
||||
|
|
@ -338,6 +348,7 @@ export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "refId">
|
|||
userEntityGrant$grantee?: UserEntityGrant.UpdateOperation | UserEntityGrant.RemoveOperation | OakOperation<"create", Omit<UserEntityGrant.CreateOperationData, "grantee" | "granteeId">[]> | Array<OakOperation<"create", Omit<UserEntityGrant.CreateOperationData, "grantee" | "granteeId">> | UserEntityGrant.UpdateOperation | UserEntityGrant.RemoveOperation>;
|
||||
userSystem$user?: UserSystem.UpdateOperation | UserSystem.RemoveOperation | OakOperation<"create", Omit<UserSystem.CreateOperationData, "user" | "userId">[]> | Array<OakOperation<"create", Omit<UserSystem.CreateOperationData, "user" | "userId">> | UserSystem.UpdateOperation | UserSystem.RemoveOperation>;
|
||||
userWechatPublicTag$user?: UserWechatPublicTag.UpdateOperation | UserWechatPublicTag.RemoveOperation | OakOperation<"create", Omit<UserWechatPublicTag.CreateOperationData, "user" | "userId">[]> | Array<OakOperation<"create", Omit<UserWechatPublicTag.CreateOperationData, "user" | "userId">> | UserWechatPublicTag.UpdateOperation | UserWechatPublicTag.RemoveOperation>;
|
||||
wechatLogin$user?: WechatLogin.UpdateOperation | WechatLogin.RemoveOperation | OakOperation<"create", Omit<WechatLogin.CreateOperationData, "user" | "userId">[]> | Array<OakOperation<"create", Omit<WechatLogin.CreateOperationData, "user" | "userId">> | WechatLogin.UpdateOperation | WechatLogin.RemoveOperation>;
|
||||
wechatUser$user?: WechatUser.UpdateOperation | WechatUser.RemoveOperation | OakOperation<"create", Omit<WechatUser.CreateOperationData, "user" | "userId">[]> | Array<OakOperation<"create", Omit<WechatUser.CreateOperationData, "user" | "userId">> | WechatUser.UpdateOperation | WechatUser.RemoveOperation>;
|
||||
modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
|
||||
operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
import { GenericAction } from "oak-domain/lib/actions/action";
|
||||
export declare type ParticularAction = 'success';
|
||||
export declare type Action = GenericAction | ParticularAction | string;
|
||||
export declare const actions: string[];
|
||||
export declare const ActionDefDict: {};
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ActionDefDict = exports.actions = void 0;
|
||||
exports.actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "success"];
|
||||
exports.ActionDefDict = {};
|
||||
|
|
@ -0,0 +1,186 @@
|
|||
import { String, Boolean, Text, Datetime, ForeignKey } from "oak-domain/lib/types/DataType";
|
||||
import { Q_DateValue, Q_BooleanValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, ExprOp, ExpressionKey } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf } from "oak-domain/lib/types/Polyfill";
|
||||
import * as SubQuery from "../_SubQuery";
|
||||
import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, EntityShape, AggregationResult } from "oak-domain/lib/types/Entity";
|
||||
import { Action, ParticularAction } from "./Action";
|
||||
import { QrCodeType } from "../../types/Config";
|
||||
import * as User from "../User/Schema";
|
||||
import * as ModiEntity from "../ModiEntity/Schema";
|
||||
import * as OperEntity from "../OperEntity/Schema";
|
||||
import * as WechatQrCode from "../WechatQrCode/Schema";
|
||||
export declare type OpSchema = EntityShape & {
|
||||
userId?: ForeignKey<"user"> | null;
|
||||
type: 'bind' | 'login';
|
||||
successed: Boolean;
|
||||
remark?: Text | null;
|
||||
qrCodeType: QrCodeType;
|
||||
expiresAt?: Datetime | null;
|
||||
expired?: Boolean | null;
|
||||
};
|
||||
export declare type OpAttr = keyof OpSchema;
|
||||
export declare type Schema = EntityShape & {
|
||||
userId?: ForeignKey<"user"> | null;
|
||||
type: 'bind' | 'login';
|
||||
successed: Boolean;
|
||||
remark?: Text | null;
|
||||
qrCodeType: QrCodeType;
|
||||
expiresAt?: Datetime | null;
|
||||
expired?: Boolean | null;
|
||||
user?: User.Schema | null;
|
||||
modiEntity$entity?: Array<ModiEntity.Schema>;
|
||||
modiEntity$entity$$aggr?: AggregationResult<ModiEntity.Schema>;
|
||||
operEntity$entity?: Array<OperEntity.Schema>;
|
||||
operEntity$entity$$aggr?: AggregationResult<OperEntity.Schema>;
|
||||
wechatQrCode$entity?: Array<WechatQrCode.Schema>;
|
||||
wechatQrCode$entity$$aggr?: AggregationResult<WechatQrCode.Schema>;
|
||||
} & {
|
||||
[A in ExpressionKey]?: any;
|
||||
};
|
||||
declare type AttrFilter = {
|
||||
id: Q_StringValue | SubQuery.WechatLoginIdSubQuery;
|
||||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_StringValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
userId: Q_StringValue | SubQuery.UserIdSubQuery;
|
||||
user: User.Filter;
|
||||
type: Q_EnumValue<'bind' | 'login'>;
|
||||
successed: Q_BooleanValue;
|
||||
remark: Q_StringValue;
|
||||
qrCodeType: Q_EnumValue<QrCodeType>;
|
||||
expiresAt: Q_DateValue;
|
||||
expired: Q_BooleanValue;
|
||||
};
|
||||
export declare type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
|
||||
export declare type Projection = {
|
||||
"#id"?: NodeId;
|
||||
[k: string]: any;
|
||||
id?: number;
|
||||
$$createAt$$?: number;
|
||||
$$updateAt$$?: number;
|
||||
$$seq$$?: number;
|
||||
userId?: number;
|
||||
user?: User.Projection;
|
||||
type?: number;
|
||||
successed?: number;
|
||||
remark?: number;
|
||||
qrCodeType?: number;
|
||||
expiresAt?: number;
|
||||
expired?: number;
|
||||
modiEntity$entity?: ModiEntity.Selection & {
|
||||
$entity: "modiEntity";
|
||||
};
|
||||
modiEntity$entity$$aggr?: ModiEntity.Aggregation & {
|
||||
$entity: "modiEntity";
|
||||
};
|
||||
operEntity$entity?: OperEntity.Selection & {
|
||||
$entity: "operEntity";
|
||||
};
|
||||
operEntity$entity$$aggr?: OperEntity.Aggregation & {
|
||||
$entity: "operEntity";
|
||||
};
|
||||
wechatQrCode$entity?: WechatQrCode.Selection & {
|
||||
$entity: "wechatQrCode";
|
||||
};
|
||||
wechatQrCode$entity$$aggr?: WechatQrCode.Aggregation & {
|
||||
$entity: "wechatQrCode";
|
||||
};
|
||||
} & Partial<ExprOp<OpAttr | string>>;
|
||||
declare type WechatLoginIdProjection = OneOf<{
|
||||
id: number;
|
||||
}>;
|
||||
declare type UserIdProjection = OneOf<{
|
||||
userId: number;
|
||||
}>;
|
||||
export declare type SortAttr = {
|
||||
id: number;
|
||||
} | {
|
||||
$$createAt$$: number;
|
||||
} | {
|
||||
$$seq$$: number;
|
||||
} | {
|
||||
$$updateAt$$: number;
|
||||
} | {
|
||||
userId: number;
|
||||
} | {
|
||||
user: User.SortAttr;
|
||||
} | {
|
||||
type: number;
|
||||
} | {
|
||||
successed: number;
|
||||
} | {
|
||||
remark: number;
|
||||
} | {
|
||||
qrCodeType: number;
|
||||
} | {
|
||||
expiresAt: number;
|
||||
} | {
|
||||
expired: number;
|
||||
} | {
|
||||
[k: string]: any;
|
||||
} | OneOf<ExprOp<OpAttr | string>>;
|
||||
export declare type SortNode = {
|
||||
$attr: SortAttr;
|
||||
$direction?: "asc" | "desc";
|
||||
};
|
||||
export declare type Sorter = SortNode[];
|
||||
export declare type SelectOperation<P extends Object = Projection> = OakSelection<"select", P, Filter, Sorter>;
|
||||
export declare type Selection<P extends Object = Projection> = Omit<SelectOperation<P>, "action">;
|
||||
export declare type Aggregation = DeduceAggregation<Projection, Filter, Sorter>;
|
||||
export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "userId">> & (({
|
||||
userId?: never;
|
||||
user?: User.CreateSingleOperation;
|
||||
} | {
|
||||
userId: String<64>;
|
||||
user?: User.UpdateOperation;
|
||||
} | {
|
||||
userId?: String<64>;
|
||||
})) & {
|
||||
modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
|
||||
operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
|
||||
wechatQrCode$entity?: OakOperation<WechatQrCode.UpdateOperation["action"], Omit<WechatQrCode.UpdateOperationData, "entity" | "entityId">, WechatQrCode.Filter> | OakOperation<"create", Omit<WechatQrCode.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<WechatQrCode.CreateOperationData, "entity" | "entityId">> | OakOperation<WechatQrCode.UpdateOperation["action"], Omit<WechatQrCode.UpdateOperationData, "entity" | "entityId">, WechatQrCode.Filter>>;
|
||||
};
|
||||
export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
||||
export declare type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
||||
export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
||||
export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "userId">> & (({
|
||||
user: User.CreateSingleOperation;
|
||||
userId?: never;
|
||||
} | {
|
||||
user: User.UpdateOperation;
|
||||
userId?: never;
|
||||
} | {
|
||||
user: User.RemoveOperation;
|
||||
userId?: never;
|
||||
} | {
|
||||
user?: never;
|
||||
userId?: String<64> | null;
|
||||
})) & {
|
||||
[k: string]: any;
|
||||
modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
|
||||
operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
|
||||
wechatQrCode$entity?: WechatQrCode.UpdateOperation | WechatQrCode.RemoveOperation | OakOperation<"create", Omit<WechatQrCode.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<WechatQrCode.CreateOperationData, "entity" | "entityId">> | WechatQrCode.UpdateOperation | WechatQrCode.RemoveOperation>;
|
||||
};
|
||||
export declare type UpdateOperation = OakOperation<"update" | ParticularAction | string, UpdateOperationData, Filter, Sorter>;
|
||||
export declare type RemoveOperationData = {} & (({
|
||||
user?: User.UpdateOperation | User.RemoveOperation;
|
||||
}));
|
||||
export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
||||
export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
||||
export declare type UserIdSubQuery = Selection<UserIdProjection>;
|
||||
export declare type WechatLoginIdSubQuery = Selection<WechatLoginIdProjection>;
|
||||
export declare type EntityDef = {
|
||||
Schema: Schema;
|
||||
OpSchema: OpSchema;
|
||||
Action: OakMakeAction<Action> | string;
|
||||
Selection: Selection;
|
||||
Aggregation: Aggregation;
|
||||
Operation: Operation;
|
||||
Create: CreateOperation;
|
||||
Update: UpdateOperation;
|
||||
Remove: RemoveOperation;
|
||||
CreateSingle: CreateSingleOperation;
|
||||
CreateMulti: CreateMultipleOperation;
|
||||
ParticularAction: ParticularAction;
|
||||
};
|
||||
export {};
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
import { StorageDesc } from "oak-domain/lib/types/Storage";
|
||||
import { OpSchema } from "./Schema";
|
||||
export declare const desc: StorageDesc<OpSchema>;
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.desc = void 0;
|
||||
var Action_1 = require("./Action");
|
||||
exports.desc = {
|
||||
attributes: {
|
||||
userId: {
|
||||
type: "ref",
|
||||
ref: "user"
|
||||
},
|
||||
type: {
|
||||
notNull: true,
|
||||
type: "enum",
|
||||
enumeration: ["bind", "login"]
|
||||
},
|
||||
successed: {
|
||||
notNull: true,
|
||||
type: "boolean"
|
||||
},
|
||||
remark: {
|
||||
type: "text"
|
||||
},
|
||||
qrCodeType: {
|
||||
notNull: true,
|
||||
type: "enum",
|
||||
enumeration: ["wechatMpDomainUrl", "wechatMpWxaCode", "wechatPublic", "wechatPublicForMp", "webForWechatPublic"]
|
||||
},
|
||||
expiresAt: {
|
||||
type: "datetime"
|
||||
},
|
||||
expired: {
|
||||
type: "boolean"
|
||||
}
|
||||
},
|
||||
actionType: "crud",
|
||||
actions: Action_1.actions,
|
||||
indexes: [
|
||||
{
|
||||
name: 'index_uuid',
|
||||
attributes: [
|
||||
{
|
||||
name: 'expired'
|
||||
},
|
||||
{
|
||||
name: 'expiresAt'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
{ "name": "绑定微信号", "attr": { "user": "用户", "type": "类型", "successed": "是否成功", "remark": "备注", "codes": "微信码", "expired": "是否过期", "expiresAt": "过期时间", "qrCodeType": "二维码类型" }, "action": { "success": "成功" }, "v": { "type": { "bind": "绑定", "login": "登录" }, "qrCodeType": { "webForWechatPublic": "网站引流到公众号", "wechatMpDomainUrl": "小程序url码", "wechatMpWxaCode": "小程序码", "wechatPublic": "公众号关注码", "wechatPublicForMp": "公众号跳转小程序码" } } }
|
||||
|
|
@ -8,6 +8,7 @@ import { QrCodeType } from "../../types/Config";
|
|||
import * as Application from "../Application/Schema";
|
||||
import * as User from "../User/Schema";
|
||||
import * as UserEntityGrant from "../UserEntityGrant/Schema";
|
||||
import * as WechatLogin from "../WechatLogin/Schema";
|
||||
import * as ModiEntity from "../ModiEntity/Schema";
|
||||
import * as OperEntity from "../OperEntity/Schema";
|
||||
export declare type WechatQrCodeProps = {
|
||||
|
|
@ -17,7 +18,7 @@ export declare type WechatQrCodeProps = {
|
|||
isTabBar?: boolean;
|
||||
};
|
||||
export declare type OpSchema = EntityShape & {
|
||||
entity: "user" | "userEntityGrant" | string;
|
||||
entity: "user" | "userEntityGrant" | "wechatLogin" | string;
|
||||
entityId: String<64>;
|
||||
type: QrCodeType;
|
||||
allowShare: Boolean;
|
||||
|
|
@ -34,7 +35,7 @@ export declare type OpSchema = EntityShape & {
|
|||
};
|
||||
export declare type OpAttr = keyof OpSchema;
|
||||
export declare type Schema = EntityShape & {
|
||||
entity: "user" | "userEntityGrant" | string;
|
||||
entity: "user" | "userEntityGrant" | "wechatLogin" | string;
|
||||
entityId: String<64>;
|
||||
type: QrCodeType;
|
||||
allowShare: Boolean;
|
||||
|
|
@ -51,6 +52,7 @@ export declare type Schema = EntityShape & {
|
|||
application: Application.Schema;
|
||||
user?: User.Schema;
|
||||
userEntityGrant?: UserEntityGrant.Schema;
|
||||
wechatLogin?: WechatLogin.Schema;
|
||||
modiEntity$entity?: Array<ModiEntity.Schema>;
|
||||
modiEntity$entity$$aggr?: AggregationResult<ModiEntity.Schema>;
|
||||
operEntity$entity?: Array<OperEntity.Schema>;
|
||||
|
|
@ -80,8 +82,9 @@ declare type AttrFilter<E> = {
|
|||
props: Q_EnumValue<WechatQrCodeProps>;
|
||||
user: User.Filter;
|
||||
userEntityGrant: UserEntityGrant.Filter;
|
||||
wechatLogin: WechatLogin.Filter;
|
||||
};
|
||||
export declare type Filter<E = Q_EnumValue<"user" | "userEntityGrant" | string>> = MakeFilter<AttrFilter<E> & ExprOp<OpAttr | string>>;
|
||||
export declare type Filter<E = Q_EnumValue<"user" | "userEntityGrant" | "wechatLogin" | string>> = MakeFilter<AttrFilter<E> & ExprOp<OpAttr | string>>;
|
||||
export declare type Projection = {
|
||||
"#id"?: NodeId;
|
||||
[k: string]: any;
|
||||
|
|
@ -106,6 +109,7 @@ export declare type Projection = {
|
|||
props?: number;
|
||||
user?: User.Projection;
|
||||
userEntityGrant?: UserEntityGrant.Projection;
|
||||
wechatLogin?: WechatLogin.Projection;
|
||||
modiEntity$entity?: ModiEntity.Selection & {
|
||||
$entity: "modiEntity";
|
||||
};
|
||||
|
|
@ -131,6 +135,9 @@ declare type UserIdProjection = OneOf<{
|
|||
declare type UserEntityGrantIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
declare type WechatLoginIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
export declare type SortAttr = {
|
||||
id: number;
|
||||
} | {
|
||||
|
|
@ -173,6 +180,8 @@ export declare type SortAttr = {
|
|||
user: User.SortAttr;
|
||||
} | {
|
||||
userEntityGrant: UserEntityGrant.SortAttr;
|
||||
} | {
|
||||
wechatLogin: WechatLogin.SortAttr;
|
||||
} | {
|
||||
[k: string]: any;
|
||||
} | OneOf<ExprOp<OpAttr | string>>;
|
||||
|
|
@ -214,6 +223,17 @@ export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity"
|
|||
} | {
|
||||
entity: "userEntityGrant";
|
||||
entityId: String<64>;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
wechatLogin: WechatLogin.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "wechatLogin";
|
||||
entityId: String<64>;
|
||||
wechatLogin: WechatLogin.UpdateOperation;
|
||||
} | {
|
||||
entity: "wechatLogin";
|
||||
entityId: String<64>;
|
||||
} | {
|
||||
entity?: string;
|
||||
entityId?: string;
|
||||
|
|
@ -246,7 +266,11 @@ export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity"
|
|||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
entity?: ("user" | "userEntityGrant" | string) | null;
|
||||
wechatLogin?: WechatLogin.CreateSingleOperation | WechatLogin.UpdateOperation | WechatLogin.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
entity?: ("user" | "userEntityGrant" | "wechatLogin" | string) | null;
|
||||
entityId?: String<64> | null;
|
||||
}) & {
|
||||
[k: string]: any;
|
||||
|
|
@ -260,6 +284,8 @@ export declare type RemoveOperationData = {} & (({
|
|||
user?: User.UpdateOperation | User.RemoveOperation;
|
||||
} | {
|
||||
userEntityGrant?: UserEntityGrant.UpdateOperation | UserEntityGrant.RemoveOperation;
|
||||
} | {
|
||||
wechatLogin?: WechatLogin.UpdateOperation | WechatLogin.RemoveOperation;
|
||||
} | {
|
||||
[k: string]: any;
|
||||
});
|
||||
|
|
@ -268,6 +294,7 @@ export declare type Operation = CreateOperation | UpdateOperation | RemoveOperat
|
|||
export declare type ApplicationIdSubQuery = Selection<ApplicationIdProjection>;
|
||||
export declare type UserIdSubQuery = Selection<UserIdProjection>;
|
||||
export declare type UserEntityGrantIdSubQuery = Selection<UserEntityGrantIdProjection>;
|
||||
export declare type WechatLoginIdSubQuery = Selection<WechatLoginIdProjection>;
|
||||
export declare type WechatQrCodeIdSubQuery = Selection<WechatQrCodeIdProjection>;
|
||||
export declare type EntityDef = {
|
||||
Schema: Schema;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ exports.desc = {
|
|||
params: {
|
||||
length: 32
|
||||
},
|
||||
ref: ["user", "userEntityGrant"]
|
||||
ref: ["user", "userEntityGrant", "wechatLogin"]
|
||||
},
|
||||
entityId: {
|
||||
notNull: true,
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import * as System from "./System/Schema";
|
|||
import * as Token from "./Token/Schema";
|
||||
import * as UserSystem from "./UserSystem/Schema";
|
||||
import * as UserWechatPublicTag from "./UserWechatPublicTag/Schema";
|
||||
import * as WechatLogin from "./WechatLogin/Schema";
|
||||
import * as WechatPublicTag from "./WechatPublicTag/Schema";
|
||||
import * as WechatQrCode from "./WechatQrCode/Schema";
|
||||
import * as WechatUser from "./WechatUser/Schema";
|
||||
|
|
@ -105,6 +106,8 @@ export declare type UserIdSubQuery = {
|
|||
entity: "userSystem";
|
||||
}) | (UserWechatPublicTag.UserIdSubQuery & {
|
||||
entity: "userWechatPublicTag";
|
||||
}) | (WechatLogin.UserIdSubQuery & {
|
||||
entity: "wechatLogin";
|
||||
}) | (WechatUser.UserIdSubQuery & {
|
||||
entity: "wechatUser";
|
||||
}) | (User.UserIdSubQuery & {
|
||||
|
|
@ -291,6 +294,11 @@ export declare type UserWechatPublicTagIdSubQuery = {
|
|||
entity: "userWechatPublicTag";
|
||||
}) | any;
|
||||
};
|
||||
export declare type WechatLoginIdSubQuery = {
|
||||
[K in "$in" | "$nin"]?: (WechatLogin.WechatLoginIdSubQuery & {
|
||||
entity: "wechatLogin";
|
||||
}) | any;
|
||||
};
|
||||
export declare type WechatPublicTagIdSubQuery = {
|
||||
[K in "$in" | "$nin"]?: (UserWechatPublicTag.WechatPublicTagIdSubQuery & {
|
||||
entity: "userWechatPublicTag";
|
||||
|
|
|
|||
|
|
@ -0,0 +1,118 @@
|
|||
import { EntityDict } from '../../../general-app-domain';
|
||||
import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid';
|
||||
|
||||
const Interval = 2 * 60 * 1000;
|
||||
|
||||
export default OakComponent({
|
||||
isList: false,
|
||||
lifetimes: {
|
||||
async attached() {
|
||||
this.createWechatLogin();
|
||||
(this as any).createTimer = setInterval(() => {
|
||||
this.createWechatLogin();
|
||||
}, Interval);
|
||||
},
|
||||
async detached() {
|
||||
if ((this as any).createTimer) {
|
||||
clearInterval((this as any).createTimer);
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
async createWechatLogin() {
|
||||
const userId = this.features.token.getUserId();
|
||||
const wechatLoginId = await generateNewIdAsync();
|
||||
await this.features.cache.operate('wechatLogin', {
|
||||
id: await generateNewIdAsync(),
|
||||
action: 'create',
|
||||
data: {
|
||||
id: wechatLoginId,
|
||||
userId,
|
||||
type: 'bind',
|
||||
expiresAt: Date.now() + Interval,
|
||||
expired: false,
|
||||
qrCodeType: 'wechatPublic',
|
||||
successed: false,
|
||||
} as EntityDict['wechatLogin']['CreateSingle']['data'],
|
||||
});
|
||||
this.setState(
|
||||
{
|
||||
wechatLoginId,
|
||||
},
|
||||
() => {
|
||||
this.getWechatLogin();
|
||||
}
|
||||
);
|
||||
},
|
||||
async getWechatLogin() {
|
||||
const { wechatLoginId } = this.state;
|
||||
const {
|
||||
data: [wechatLogin],
|
||||
} = await this.features.cache.refresh('wechatLogin', {
|
||||
data: {
|
||||
id: 1,
|
||||
userId: 1,
|
||||
type: 1,
|
||||
qrCodeType: 1,
|
||||
remark: 1,
|
||||
expired: 1,
|
||||
expiresAt: 1,
|
||||
successed: 1,
|
||||
wechatQrCode$entity: {
|
||||
$entity: 'wechatQrCode',
|
||||
data: {
|
||||
id: 1,
|
||||
entity: 1,
|
||||
entityId: 1,
|
||||
type: 1, //类型
|
||||
ticket: 1,
|
||||
url: 1,
|
||||
buffer: 1,
|
||||
expired: 1,
|
||||
expiresAt: 1,
|
||||
applicationId: 1,
|
||||
},
|
||||
filter: {
|
||||
entity: 'userEntityGrant',
|
||||
},
|
||||
indexFrom: 0,
|
||||
count: 1,
|
||||
},
|
||||
},
|
||||
filter: {
|
||||
id: wechatLoginId,
|
||||
},
|
||||
});
|
||||
|
||||
let qrCodeUrl = wechatLogin?.wechatQrCode$entity![0]?.url;
|
||||
const buffer = wechatLogin?.wechatQrCode$entity![0]?.buffer;
|
||||
if (buffer) {
|
||||
const newBuffer = new ArrayBuffer(buffer.length * 2);
|
||||
const newBufferToUint16 = new Uint16Array(newBuffer);
|
||||
for (let i = 0; i < buffer.length; i++) {
|
||||
newBufferToUint16[i] = buffer.charCodeAt(i);
|
||||
}
|
||||
|
||||
if (process.env.OAK_PLATFORM === 'wechatMp') {
|
||||
const base64Str = wx.arrayBufferToBase64(newBufferToUint16);
|
||||
qrCodeUrl = 'data:image/png;base64,' + base64Str;
|
||||
} else {
|
||||
let binary = '';
|
||||
const bytes = new Uint8Array(newBufferToUint16);
|
||||
const len = bytes.byteLength;
|
||||
for (let i = 0; i < len; i++) {
|
||||
binary += String.fromCharCode(bytes[i]);
|
||||
}
|
||||
const base64Str = window.btoa(binary);
|
||||
// const buffer2 = Buffer.from(newBufferToUint16, 'base64');
|
||||
// const base64Str = buffer2.toString('base64');
|
||||
|
||||
qrCodeUrl = 'data:image/png;base64,' + base64Str;
|
||||
}
|
||||
}
|
||||
this.setState({
|
||||
qrCodeUrl,
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
.container {
|
||||
display: flex;
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
import React from 'react';
|
||||
import QrCode from '../../../components/common/qrCode';
|
||||
import { EntityDict } from '../../../general-app-domain';
|
||||
import { WebComponentProps } from 'oak-frontend-base';
|
||||
|
||||
import Style from './web.module.less';
|
||||
|
||||
export default function Render(
|
||||
props: WebComponentProps<
|
||||
EntityDict,
|
||||
'wechatLogin',
|
||||
true,
|
||||
{
|
||||
wechatLoginId: string;
|
||||
qrCodeUrl: string;
|
||||
},
|
||||
{}
|
||||
>
|
||||
) {
|
||||
const { oakFullpath, wechatLoginId, qrCodeUrl } = props.data;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<QrCode url={qrCodeUrl} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
import { String, Text, Datetime, Int } from 'oak-domain/lib/types/DataType';
|
||||
import { EntityShape } from 'oak-domain/lib/types/Entity';
|
||||
import { LocaleDef } from 'oak-domain/lib/types/Locale';
|
||||
import { Index } from 'oak-domain/lib/types/Storage';
|
||||
import { Schema as User } from './User';
|
||||
import { Schema as WechatQrCode } from './WechatQrCode';
|
||||
import { QrCodeType } from '../types/Config';
|
||||
|
||||
export interface Schema extends EntityShape {
|
||||
user?: User;
|
||||
type: 'bind' | 'login';
|
||||
successed: Boolean;
|
||||
remark?: Text;
|
||||
qrCodeType: QrCodeType;
|
||||
expiresAt?: Datetime;
|
||||
expired?: Boolean;
|
||||
codes: Array<WechatQrCode>;
|
||||
}
|
||||
|
||||
type Action = 'success';
|
||||
|
||||
const indexes: Index<Schema>[] = [
|
||||
{
|
||||
name: 'index_uuid',
|
||||
attributes: [
|
||||
{
|
||||
name: 'expired',
|
||||
},
|
||||
{
|
||||
name: 'expiresAt',
|
||||
}
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
const locale: LocaleDef<
|
||||
Schema,
|
||||
Action,
|
||||
'',
|
||||
{
|
||||
type: Schema['type'];
|
||||
qrCodeType: QrCodeType;
|
||||
}
|
||||
> = {
|
||||
zh_CN: {
|
||||
name: '绑定微信号',
|
||||
attr: {
|
||||
user: '用户',
|
||||
type: '类型',
|
||||
successed: '是否成功',
|
||||
remark: '备注',
|
||||
codes: '微信码',
|
||||
expired: '是否过期',
|
||||
expiresAt: '过期时间',
|
||||
qrCodeType: '二维码类型',
|
||||
},
|
||||
action: {
|
||||
success: '成功',
|
||||
},
|
||||
v: {
|
||||
type: {
|
||||
bind: '绑定',
|
||||
login: '登录',
|
||||
},
|
||||
qrCodeType: {
|
||||
webForWechatPublic: '网站引流到公众号',
|
||||
wechatMpDomainUrl: '小程序url码',
|
||||
wechatMpWxaCode: '小程序码',
|
||||
wechatPublic: '公众号关注码',
|
||||
wechatPublicForMp: '公众号跳转小程序码',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"navigationBarTitleText": "修改个人信息",
|
||||
"navigationBarTitleText": "个人设置",
|
||||
"oakDisablePulldownRefresh": true,
|
||||
"usingComponents": {
|
||||
"l-button": "@oak-frontend-base/miniprogram_npm/lin-ui/button/index",
|
||||
|
|
|
|||
|
|
@ -44,10 +44,8 @@ export default OakComponent({
|
|||
},
|
||||
],
|
||||
formData({ data }) {
|
||||
const pagination = this.getPagination();
|
||||
return {
|
||||
list: data,
|
||||
pagination,
|
||||
};
|
||||
},
|
||||
data: {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
import * as React from 'react';
|
||||
import { Table, Button, Space, Typography, Modal } from 'antd';
|
||||
import { Table, Space, Typography } from 'antd';
|
||||
import dayjs from 'dayjs';
|
||||
import { WebComponentProps } from 'oak-frontend-base';
|
||||
import PageHeader from '../../../components/common/pageHeader';
|
||||
import { EntityDict } from '../../../general-app-domain';
|
||||
import { WebComponentProps } from 'oak-frontend-base';
|
||||
|
||||
import Style from './web.module.less';
|
||||
|
||||
export default function render(
|
||||
|
|
@ -23,15 +22,15 @@ export default function render(
|
|||
>
|
||||
) {
|
||||
const {
|
||||
pagination,
|
||||
oakPagination,
|
||||
oakFullpath,
|
||||
list = [],
|
||||
oakLoading,
|
||||
showBack,
|
||||
variant,
|
||||
oakFullpath,
|
||||
} = props.data;
|
||||
|
||||
const { pageSize, total, currentPage } = pagination || {};
|
||||
const { pageSize, total, currentPage } = oakPagination || {};
|
||||
|
||||
const { t, setPageSize, setCurrentPage } = props.methods;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import userEntityGrantTriggers from './userEntityGrant';
|
|||
import wechatQrCodeTriggers from './wechatQrCode';
|
||||
import messageTriggers from './message';
|
||||
import notificationTriggers from './notification';
|
||||
import wechatLoginTriggers from './wechatLogin';
|
||||
|
||||
export default [
|
||||
...addressTriggers,
|
||||
|
|
@ -12,4 +13,5 @@ export default [
|
|||
...wechatQrCodeTriggers,
|
||||
...messageTriggers,
|
||||
...notificationTriggers,
|
||||
...wechatLoginTriggers,
|
||||
];
|
||||
|
|
|
|||
|
|
@ -5,13 +5,8 @@ import { EntityDict } from '../general-app-domain/EntityDict';
|
|||
|
||||
import { OakRowInconsistencyException, OakExternalException, SelectOpResult } from 'oak-domain/lib/types';
|
||||
import { assert } from 'oak-domain/lib/utils/assert';
|
||||
import {
|
||||
createWechatQrCode,
|
||||
getMpUnlimitWxaCode,
|
||||
} from '../aspects/wechatQrCode';
|
||||
import { firstLetterUpperCase } from 'oak-domain/lib/utils/string';
|
||||
import { RuntimeCxt } from '../types/RuntimeCxt';
|
||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
||||
|
||||
const triggers: Trigger<EntityDict, 'userEntityGrant', RuntimeCxt>[] = [
|
||||
{
|
||||
|
|
@ -58,20 +53,6 @@ const triggers: Trigger<EntityDict, 'userEntityGrant', RuntimeCxt>[] = [
|
|||
},
|
||||
{}
|
||||
);
|
||||
// await createWechatQrCode(
|
||||
// {
|
||||
// entity: 'userEntityGrant',
|
||||
// entityId: id,
|
||||
// props: {
|
||||
// pathname: '/userEntityGrant/confirm',
|
||||
// props: {
|
||||
// oakId: id,
|
||||
// },
|
||||
// },
|
||||
// type: userEntityGrantData.qrCodeType,
|
||||
// },
|
||||
// context as BackendRuntimeContext<EntityDict>
|
||||
// );
|
||||
};
|
||||
if (data instanceof Array) {
|
||||
assert('授权不存在一对多的情况');
|
||||
|
|
@ -265,44 +246,5 @@ const triggers: Trigger<EntityDict, 'userEntityGrant', RuntimeCxt>[] = [
|
|||
return 1;
|
||||
},
|
||||
} as UpdateTrigger<EntityDict, 'userEntityGrant', RuntimeCxt>,
|
||||
// {
|
||||
// name: '当userEntityGrant查询时,使其相关的wechatQrCode动态生成buffer',
|
||||
// entity: 'userEntityGrant',
|
||||
// action: 'select',
|
||||
// when: 'after',
|
||||
// fn: async ({ operation, result }, context) => {
|
||||
// if (operation?.data?.wechatQrCode$entity?.data?.buffer) {
|
||||
// //如果projection写buffer 就动态获取,临时性代码
|
||||
// for (let userEntityGrant of result) {
|
||||
// if (userEntityGrant.qrCodeType === 'wechatMpWxaCode') {
|
||||
// const wechatQrCode =
|
||||
// userEntityGrant.wechatQrCode$entity &&
|
||||
// userEntityGrant.wechatQrCode$entity[0];
|
||||
// if (wechatQrCode) {
|
||||
// const { id } = wechatQrCode;
|
||||
// const backContext = context as BackendRuntimeContext<EntityDict>;
|
||||
// const buffer = await getMpUnlimitWxaCode(
|
||||
// wechatQrCode.id,
|
||||
// backContext,
|
||||
// );
|
||||
// backContext.opRecords.forEach(
|
||||
// ele => {
|
||||
// if (ele.a === 's') {
|
||||
// const { d } = ele as SelectOpResult<EntityDict>;
|
||||
// if (d.wechatQrCode && d.wechatQrCode[id]) {
|
||||
// Object.assign(d.wechatQrCode[id], {
|
||||
// buffer,
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// )
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return 1;
|
||||
// },
|
||||
// } as SelectTrigger<EntityDict, 'userEntityGrant', RuntimeCxt>,
|
||||
];
|
||||
export default triggers;
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
import { generateNewId, generateNewIdAsync } from 'oak-domain/lib/utils/uuid';
|
||||
import { Trigger, CreateTrigger, UpdateTrigger, SelectTrigger } from 'oak-domain/lib/types/Trigger';
|
||||
import { CreateOperationData as CreateWechatLoginData } from '../general-app-domain/WechatLogin/Schema';
|
||||
import { EntityDict } from '../general-app-domain/EntityDict';
|
||||
|
||||
import { OakRowInconsistencyException, OakExternalException, SelectOpResult } from 'oak-domain/lib/types';
|
||||
import { assert } from 'oak-domain/lib/utils/assert';
|
||||
import { firstLetterUpperCase } from 'oak-domain/lib/utils/string';
|
||||
import { RuntimeCxt } from '../types/RuntimeCxt';
|
||||
|
||||
const triggers: Trigger<EntityDict, 'wechatLogin', RuntimeCxt>[] = [
|
||||
{
|
||||
name: '当创建wechatLogin时,尝试为之创建一个wechatQrCode',
|
||||
entity: 'wechatLogin',
|
||||
action: 'create',
|
||||
when: 'before',
|
||||
fn: async ({ operation }, context, params) => {
|
||||
const { data, filter } = operation;
|
||||
const fn = async (wechatLoginData: CreateWechatLoginData) => {
|
||||
const { id } = wechatLoginData;
|
||||
|
||||
Object.assign(wechatLoginData, {
|
||||
expired: false,
|
||||
successed: false,
|
||||
});
|
||||
if (!wechatLoginData.expiresAt) {
|
||||
Object.assign(wechatLoginData, {
|
||||
expiresAt: Date.now() + 2 * 60 * 1000,
|
||||
});
|
||||
}
|
||||
// 为之创建微信体系下的一个weChatQrCode
|
||||
await context.operate(
|
||||
'wechatQrCode',
|
||||
{
|
||||
id: await generateNewIdAsync(),
|
||||
action: 'create',
|
||||
data: {
|
||||
id: await generateNewIdAsync(),
|
||||
entity: 'wechatLogin',
|
||||
entityId: id,
|
||||
props: {
|
||||
pathname: '/wechatLogin/confirm',
|
||||
props: {
|
||||
oakId: id,
|
||||
},
|
||||
},
|
||||
type: wechatLoginData.qrCodeType,
|
||||
},
|
||||
},
|
||||
{}
|
||||
);
|
||||
};
|
||||
if (data instanceof Array) {
|
||||
assert('授权不存在一对多的情况');
|
||||
} else {
|
||||
await fn(data);
|
||||
}
|
||||
return 0;
|
||||
},
|
||||
} as CreateTrigger<EntityDict, 'wechatLogin', RuntimeCxt>,
|
||||
{
|
||||
name: '当wechatLogin过期时,使其相关的wechatQrCode也过期',
|
||||
entity: 'wechatLogin',
|
||||
action: 'update',
|
||||
check: (operation) => {
|
||||
const { data } = operation;
|
||||
return !!data.expired;
|
||||
},
|
||||
when: 'before',
|
||||
fn: async ({ operation }, context) => {
|
||||
const { data } = operation;
|
||||
data.wechatQrCode$entity = {
|
||||
id: await generateNewIdAsync(),
|
||||
action: 'update',
|
||||
data: {
|
||||
expired: true,
|
||||
},
|
||||
};
|
||||
return 1;
|
||||
},
|
||||
} as UpdateTrigger<EntityDict, 'wechatLogin', RuntimeCxt>,
|
||||
];
|
||||
export default triggers;
|
||||
|
|
@ -12,57 +12,6 @@ import { Config as SysConfig, QrCodeType } from '../types/Config';
|
|||
|
||||
|
||||
const triggers: Trigger<EntityDict, 'wechatQrCode', RuntimeCxt>[] = [
|
||||
/* {
|
||||
name: '选择wechatQrCode时,动态生成需要的数据',
|
||||
entity: 'wechatQrCode',
|
||||
action: 'select',
|
||||
when: 'after',
|
||||
fn: async ({ result }, context, params) => {
|
||||
let count = 0;
|
||||
const application = await context.getApplication();
|
||||
const { type: appType, config } = application!;
|
||||
|
||||
if (appType !== 'wechatMp' && config!.type !== 'wechatMp') {
|
||||
|
||||
} else {
|
||||
assert(appType === 'wechatMp' || config!.type === 'wechatMp');
|
||||
const config2 = config as WechatMpConfig;
|
||||
const { appId, appSecret } = config2;
|
||||
for (const code of result) {
|
||||
const { type, expired, id } = code;
|
||||
if (
|
||||
type === 'wechatMpWxaCode' &&
|
||||
code.hasOwnProperty('buffer')
|
||||
) {
|
||||
// 小程序码去实时获取(暂时不考虑缓存)
|
||||
const wechatInstance = WechatSDK.getInstance(
|
||||
appId,
|
||||
'wechatMp',
|
||||
appSecret
|
||||
) as WechatMpInstance;
|
||||
const buffer = await wechatInstance.getMpUnlimitWxaCode(
|
||||
{
|
||||
scene: shrinkUuidTo32Bytes(id!),
|
||||
page: 'pages/index/index', // todo,这里用其它的页面微信服务器拒绝,因为没发布。应该是 pages/wechatQrCode/scan/index
|
||||
}
|
||||
);
|
||||
// 把arrayBuffer转成字符串返回
|
||||
const str = String.fromCharCode(
|
||||
...new Uint8Array(buffer)
|
||||
);
|
||||
Object.assign(code, {
|
||||
buffer: str,
|
||||
});
|
||||
count++;
|
||||
} else if (expired && code.hasOwnProperty('url')) {
|
||||
// 如果过期了,在这里生成新的临时码并修改值(公众号)
|
||||
throw new Error('not implemented yet');
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
} as SelectTriggerAfter<EntityDict, 'wechatQrCode', RuntimeCxt>, */
|
||||
{
|
||||
name: '当生成wechatQrCode时,调用外部接口完善数据',
|
||||
entity: 'wechatQrCode',
|
||||
|
|
@ -324,20 +273,6 @@ const triggers: Trigger<EntityDict, 'wechatQrCode', RuntimeCxt>[] = [
|
|||
Object.assign(
|
||||
wechatQrCode, updateData,
|
||||
)
|
||||
// await context.operate(
|
||||
// 'wechatQrCode',
|
||||
// {
|
||||
// id: await generateNewIdAsync(),
|
||||
// action: 'update',
|
||||
// data: updateData,
|
||||
// filter: {
|
||||
// id,
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// dontCollect: true,
|
||||
// }
|
||||
// );
|
||||
}
|
||||
if (data instanceof Array) {
|
||||
for (const ele of data) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue