wechat验证接口

This commit is contained in:
wenjiarui 2023-01-30 11:02:53 +08:00
parent 3a94c92a1b
commit 55f9ba052e
96 changed files with 116 additions and 96 deletions

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import './index.less'; import './index.less';
declare const Empty: () => JSX.Element; declare const Empty: () => JSX.Element;
export default Empty; export default Empty;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import './index.less'; import './index.less';
declare const Empty: () => JSX.Element; declare const Empty: () => JSX.Element;
export default Empty; export default Empty;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { AppType, WebConfig, WechatPublicConfig, WechatMpConfig } from '../../../general-app-domain/Application/Schema'; import { AppType, WebConfig, WechatPublicConfig, WechatMpConfig } from '../../../general-app-domain/Application/Schema';
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebConfig } from '../../../../general-app-domain/Application/Schema'; import { WebConfig } from '../../../../general-app-domain/Application/Schema';
export default function Web(props: { export default function Web(props: {
config: WebConfig; config: WebConfig;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WechatMpConfig } from '../../../../general-app-domain/Application/Schema'; import { WechatMpConfig } from '../../../../general-app-domain/Application/Schema';
export default function WechatMp(props: { export default function WechatMp(props: {
config: WechatMpConfig; config: WechatMpConfig;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WechatPublicConfig } from '../../../../general-app-domain/Application/Schema'; import { WechatPublicConfig } from '../../../../general-app-domain/Application/Schema';
export default function WechatPublic(props: { export default function WechatPublic(props: {
isService?: boolean; isService?: boolean;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { Style as StyleType } from '../../../types/Style'; import { Style as StyleType } from '../../../types/Style';
declare type StyleProps = { declare type StyleProps = {
value?: StyleType | null; value?: StyleType | null;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { Config } from '../../../../types/Config'; import { Config } from '../../../../types/Config';
export default function Account(props: { export default function Account(props: {
account: Required<Config>['Account']; account: Required<Config>['Account'];

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { Config } from '../../../../types/Config'; import { Config } from '../../../../types/Config';
export default function Cos(props: { export default function Cos(props: {
cos: Required<Config>['Cos']; cos: Required<Config>['Cos'];

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { Config } from '../../../../types/Config'; import { Config } from '../../../../types/Config';
export default function Cos(props: { export default function Cos(props: {
live: Required<Config>['Live']; live: Required<Config>['Live'];

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { Config } from '../../../../types/Config'; import { Config } from '../../../../types/Config';
export default function Cos(props: { export default function Cos(props: {
map: Required<Config>['Map']; map: Required<Config>['Map'];

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { Config } from '../../../../types/Config'; import { Config } from '../../../../types/Config';
export default function Sms(props: { export default function Sms(props: {
sms: Required<Config>['Sms']; sms: Required<Config>['Sms'];

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { Config } from '../../../types/Config'; import { Config } from '../../../types/Config';
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { ButtonProps, SpaceProps } from 'antd'; import { ButtonProps, SpaceProps } from 'antd';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../general-app-domain'; import { EntityDict } from '../../general-app-domain';

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { UploadFile } from 'antd'; import { UploadFile } from 'antd';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';

View File

@ -1,2 +1 @@
/// <reference types="react" />
export default function render(): JSX.Element; export default function render(): JSX.Element;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { UploadFile } from 'antd'; import { UploadFile } from 'antd';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from "oak-frontend-base"; import { WebComponentProps } from "oak-frontend-base";
import { EntityDict } from "../../../general-app-domain"; import { EntityDict } from "../../../general-app-domain";
export default function Render(props: WebComponentProps<EntityDict, 'user', false, { export default function Render(props: WebComponentProps<EntityDict, 'user', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
export default function render(props: WebComponentProps<EntityDict, 'address', true, { export default function render(props: WebComponentProps<EntityDict, 'address', true, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../general-app-domain'; import { EntityDict } from '../../general-app-domain';
import './web.less'; import './web.less';

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'message', false, { export default function Render(props: WebComponentProps<EntityDict, 'message', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'message', false, {}, { export default function Render(props: WebComponentProps<EntityDict, 'message', false, {}, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { MessageProps } from 'oak-frontend-base/lib/types/Message'; import { MessageProps } from 'oak-frontend-base/lib/types/Message';
export default function render(props: { export default function render(props: {
data: { data: {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
import { AvatarSize } from 'antd/es/avatar/SizeContext'; import { AvatarSize } from 'antd/es/avatar/SizeContext';

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'token', false, { export default function Render(props: WebComponentProps<EntityDict, 'token', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'token', false, { export default function Render(props: WebComponentProps<EntityDict, 'token', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'userEntityGrant', true, { export default function Render(props: WebComponentProps<EntityDict, 'userEntityGrant', true, {

View File

@ -1,18 +1,72 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib"); var tslib_1 = require("tslib");
var url_1 = tslib_1.__importDefault(require("url"));
var sha1_1 = tslib_1.__importDefault(require("sha1"));
function assertFromWeChat(query, config) {
var _a;
var signature = query.signature, nonce = query.nonce, timestamp = query.timestamp;
var token = (_a = config.server) === null || _a === void 0 ? void 0 : _a.token;
var stringArray = [nonce, timestamp, token];
var sign = stringArray.sort().reduce(function (acc, val) {
acc += val;
return acc;
});
var sha1Sign = (0, sha1_1.default)(sign);
return signature === sha1Sign;
}
var endpoints = { var endpoints = {
wechatApi: { wechatApi: {
name: '微信公众号回调接口', name: '微信公众号回调接口',
method: 'post', method: 'post',
params: ['appId'], params: ['appId'],
fn: function (context, params, body, headers) { return tslib_1.__awaiter(void 0, void 0, void 0, function () { fn: function (context, params, body, req, headers) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
var appId; var appId;
return tslib_1.__generator(this, function (_a) { return tslib_1.__generator(this, function (_a) {
appId = params.appId; appId = params.appId;
throw new Error('not implemented yet'); throw new Error('not implemented yet');
}); });
}); }, }); },
},
wechatVerify: {
name: '微信公众号验证接口',
method: 'get',
// params: ['applicationId'],
fn: function (context, params, body, req, headers) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
var query, applicationId, _a, application, isWeChat;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0:
query = url_1.default.parse(req.url, true, false).query;
applicationId = query.applicationId;
if (!applicationId) {
throw new Error('applicationId参数不存在');
}
return [4 /*yield*/, context.select('application', {
data: {
id: 1,
config: 1,
},
filter: {
id: applicationId,
},
}, {})];
case 1:
_a = tslib_1.__read.apply(void 0, [_b.sent(), 1]), application = _a[0];
if (!application) {
throw new Error("\u672A\u627E\u5230".concat(applicationId, "\u5BF9\u5E94\u7684app"));
}
isWeChat = assertFromWeChat(query, application.config);
if (isWeChat) {
return [2 /*return*/, query.echostr];
}
else {
throw new Error('Verify Failed');
}
return [2 /*return*/];
}
});
}); },
} }
}; };
exports.default = endpoints; exports.default = endpoints;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'address', true, { export default function Render(props: WebComponentProps<EntityDict, 'address', true, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'address', false, { export default function Render(props: WebComponentProps<EntityDict, 'address', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { AppType, WebConfig, WechatPublicConfig, WechatMpConfig } from '../../../../general-app-domain/Application/Schema'; import { AppType, WebConfig, WechatPublicConfig, WechatMpConfig } from '../../../../general-app-domain/Application/Schema';
import { EntityDict } from '../../../../general-app-domain'; import { EntityDict } from '../../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebConfig, WechatPublicConfig, WechatMpConfig } from '../../../general-app-domain/Application/Schema'; import { WebConfig, WechatPublicConfig, WechatMpConfig } from '../../../general-app-domain/Application/Schema';
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'application', true, { export default function Render(props: WebComponentProps<EntityDict, 'application', true, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'application', false, { export default function Render(props: WebComponentProps<EntityDict, 'application', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from './../../../general-app-domain'; import { EntityDict } from './../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
export default function render(props: WebComponentProps<EntityDict, 'article', false, { export default function render(props: WebComponentProps<EntityDict, 'article', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
export default function render(props: WebComponentProps<EntityDict, 'article', true, { export default function render(props: WebComponentProps<EntityDict, 'article', true, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'article', false, { export default function Render(props: WebComponentProps<EntityDict, 'article', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import '@wangeditor/editor/dist/css/style.css'; import '@wangeditor/editor/dist/css/style.css';
import { EntityDict } from './../../../general-app-domain'; import { EntityDict } from './../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'domain', false, { export default function Render(props: WebComponentProps<EntityDict, 'domain', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'system', true, { export default function Render(props: WebComponentProps<EntityDict, 'system', true, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'domain', false, { export default function Render(props: WebComponentProps<EntityDict, 'domain', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../general-app-domain'; import { EntityDict } from '../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'token', true, {}, {}>): JSX.Element; export default function Render(props: WebComponentProps<EntityDict, 'token', true, {}, {}>): JSX.Element;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../general-app-domain'; import { EntityDict } from '../../general-app-domain';
export default function render(props: WebComponentProps<EntityDict, 'token', false, { export default function render(props: WebComponentProps<EntityDict, 'token', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'message', false, { export default function Render(props: WebComponentProps<EntityDict, 'message', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'message', false, { export default function Render(props: WebComponentProps<EntityDict, 'message', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'message', false, { export default function Render(props: WebComponentProps<EntityDict, 'message', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'message', true, { export default function Render(props: WebComponentProps<EntityDict, 'message', true, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'message', true, { export default function Render(props: WebComponentProps<EntityDict, 'message', true, {

View File

@ -1,2 +1 @@
/// <reference types="react" />
export default function render(this: any): JSX.Element; export default function render(this: any): JSX.Element;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
export default function render(props: WebComponentProps<EntityDict, 'mobile', true, { export default function render(props: WebComponentProps<EntityDict, 'mobile', true, {

View File

@ -1,2 +1 @@
/// <reference types="react" />
export default function Render(): JSX.Element; export default function Render(): JSX.Element;

View File

@ -1,2 +1 @@
/// <reference types="react" />
export default function Render(): JSX.Element; export default function Render(): JSX.Element;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
export default function render(props: WebComponentProps<EntityDict, 'area', true, { export default function render(props: WebComponentProps<EntityDict, 'area', true, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { Config } from '../../../../types/Config'; import { Config } from '../../../../types/Config';
import { EntityDict } from '../../../../general-app-domain'; import { EntityDict } from '../../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
import { Config } from '../../../types/Config'; import { Config } from '../../../types/Config';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'platform', true, { export default function Render(props: WebComponentProps<EntityDict, 'platform', true, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'platform', false, { export default function Render(props: WebComponentProps<EntityDict, 'platform', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../general-app-domain'; import { EntityDict } from '../../general-app-domain';
export default function render(props: WebComponentProps<EntityDict, 'user', false, { export default function render(props: WebComponentProps<EntityDict, 'user', false, {

View File

@ -1,2 +1 @@
/// <reference types="react" />
export default function Render(): JSX.Element; export default function Render(): JSX.Element;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WechatPublicConfig } from '../../../../general-app-domain/Application/Schema'; import { WechatPublicConfig } from '../../../../general-app-domain/Application/Schema';
import { EntityDict } from '../../../../general-app-domain'; import { EntityDict } from '../../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WechatPublicConfig } from '../../../general-app-domain/Application/Schema'; import { WechatPublicConfig } from '../../../general-app-domain/Application/Schema';
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'subscription', true, { export default function Render(props: WebComponentProps<EntityDict, 'subscription', true, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'subscription', false, { export default function Render(props: WebComponentProps<EntityDict, 'subscription', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../../general-app-domain'; import { EntityDict } from '../../../../general-app-domain';
import { Config } from '../../../../types/Config'; import { Config } from '../../../../types/Config';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
import { Config } from '../../../types/Config'; import { Config } from '../../../types/Config';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'system', true, { export default function Render(props: WebComponentProps<EntityDict, 'system', true, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'system', false, { export default function Render(props: WebComponentProps<EntityDict, 'system', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'token', true, { export default function Render(props: WebComponentProps<EntityDict, 'token', true, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
declare type DataProps = { declare type DataProps = {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'user', false, { export default function Render(props: WebComponentProps<EntityDict, 'user', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../../general-app-domain'; import { EntityDict } from '../../../../general-app-domain';
export default function render(props: WebComponentProps<EntityDict, 'user', false, { export default function render(props: WebComponentProps<EntityDict, 'user', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../../general-app-domain'; import { EntityDict } from '../../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'user', false, { export default function Render(props: WebComponentProps<EntityDict, 'user', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
export default function render(props: WebComponentProps<EntityDict, 'user', true, { export default function render(props: WebComponentProps<EntityDict, 'user', true, {

View File

@ -1,2 +1 @@
/// <reference types="react" />
export default function render(this: any): JSX.Element; export default function render(this: any): JSX.Element;

View File

@ -1,2 +1 @@
/// <reference types="react" />
export default function render(): JSX.Element; export default function render(): JSX.Element;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
export default function render(props: WebComponentProps<EntityDict, 'userEntityGrant', true, { export default function render(props: WebComponentProps<EntityDict, 'userEntityGrant', true, {

View File

@ -1,2 +1 @@
/// <reference types="react" />
export default function Render(props: any): JSX.Element; export default function Render(props: any): JSX.Element;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'userEntityGrant', true, { export default function Render(props: WebComponentProps<EntityDict, 'userEntityGrant', true, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
export default function render(props: WebComponentProps<EntityDict, 'token', false, { export default function render(props: WebComponentProps<EntityDict, 'token', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
export default function render(props: WebComponentProps<EntityDict, 'userEntityGrant', true, { export default function render(props: WebComponentProps<EntityDict, 'userEntityGrant', true, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'user', true, { export default function Render(props: WebComponentProps<EntityDict, 'user', true, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'user', true, { export default function Render(props: WebComponentProps<EntityDict, 'user', true, {

View File

@ -1,2 +1 @@
/// <reference types="react" />
export default function render(this: any): JSX.Element; export default function render(this: any): JSX.Element;

View File

@ -1,2 +1 @@
/// <reference types="react" />
export default function render(this: any): JSX.Element; export default function render(this: any): JSX.Element;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../../general-app-domain'; import { EntityDict } from '../../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'mobile', false, { export default function Render(props: WebComponentProps<EntityDict, 'mobile', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../../general-app-domain'; import { EntityDict } from '../../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'user', false, { export default function Render(props: WebComponentProps<EntityDict, 'user', false, {

View File

@ -1,2 +1 @@
/// <reference types="react" />
export default function render(this: any): JSX.Element; export default function render(this: any): JSX.Element;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../../general-app-domain'; import { EntityDict } from '../../../../general-app-domain';
export default function render(props: WebComponentProps<EntityDict, 'userEntityGrant', false, { export default function render(props: WebComponentProps<EntityDict, 'userEntityGrant', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../../../general-app-domain'; import { EntityDict } from '../../../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'user', false, { export default function Render(props: WebComponentProps<EntityDict, 'user', false, {

View File

@ -1,2 +1 @@
/// <reference types="react" />
export default function render(this: any): JSX.Element; export default function render(this: any): JSX.Element;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../../general-app-domain'; import { EntityDict } from '../../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'user', false, { export default function Render(props: WebComponentProps<EntityDict, 'user', false, {

View File

@ -1,2 +1 @@
/// <reference types="react" />
export default function render(this: any): JSX.Element; export default function render(this: any): JSX.Element;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'user', false, { export default function Render(props: WebComponentProps<EntityDict, 'user', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
export default function render(props: WebComponentProps<EntityDict, 'token', false, { export default function render(props: WebComponentProps<EntityDict, 'token', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain'; import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base'; import { WebComponentProps } from 'oak-frontend-base';
export default function render(props: WebComponentProps<EntityDict, 'token', false, { export default function render(props: WebComponentProps<EntityDict, 'token', false, {

View File

@ -1,17 +1,77 @@
import { Endpoint } from 'oak-domain/lib/types/Endpoint'; import { Endpoint } from 'oak-domain/lib/types/Endpoint';
import { EntityDict } from '../general-app-domain'; import { EntityDict } from '../general-app-domain';
import { BRC } from '../types/RuntimeCxt'; import { BRC } from '../types/RuntimeCxt';
import URL from 'url';
import { WechatPublicConfig } from '../entities/Application';
import sha1 from 'sha1';
import { AccountBookOutlined } from '@ant-design/icons';
type VerifyQuery = {
applicationId: string,
signature: string,
nonce: string,
timestamp: string,
echostr: string,
}
function assertFromWeChat(query: VerifyQuery, config: WechatPublicConfig) {
const { signature, nonce, timestamp } = query;
const token = config.server?.token as string;
const stringArray = [nonce, timestamp, token];
const sign = stringArray.sort().reduce((acc, val) => {
acc += val;
return acc;
});
const sha1Sign = sha1(sign);
return signature === sha1Sign;
}
const endpoints: Record<string, Endpoint<EntityDict, BRC>> = { const endpoints: Record<string, Endpoint<EntityDict, BRC>> = {
wechatApi: { wechatApi: {
name: '微信公众号回调接口', name: '微信公众号回调接口',
method: 'post', method: 'post',
params: ['appId'], params: ['appId'],
fn: async (context, params, body, headers) => { fn: async (context, params, body, req, headers) => {
const { appId } = params as { appId: string }; const { appId } = params as { appId: string };
throw new Error('not implemented yet'); throw new Error('not implemented yet');
}, },
},
wechatVerify: {
name: '微信公众号验证接口',
method: 'get',
// params: ['applicationId'],
fn: async (context, params, body, req, headers) => {
const query = URL.parse(req.url as string, true, false).query as VerifyQuery;
const { applicationId } = query;
if (!applicationId) {
throw new Error('applicationId参数不存在');
}
const [application] = await context.select(
'application',
{
data: {
id: 1,
config: 1,
},
filter: {
id: applicationId,
},
},
{}
);
if (!application) {
throw new Error(`未找到${applicationId}对应的app`);
}
const isWeChat = assertFromWeChat(query, application.config as WechatPublicConfig);
if (isWeChat) {
return query.echostr;
}
else {
throw new Error('Verify Failed');
}
},
} }
}; };
export default endpoints; export default endpoints;