定义了system的config格式
This commit is contained in:
parent
b03dbeb0e9
commit
080f6f6e3e
|
|
@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.syncUserInfoWechatMp = exports.loginWechatMp = exports.loginByPassword = exports.loginMp = void 0;
|
||||
const oak_wechat_sdk_1 = __importDefault(require("oak-wechat-sdk"));
|
||||
const oak_wechat_sdk_1 = require("oak-wechat-sdk");
|
||||
const assert_1 = __importDefault(require("assert"));
|
||||
const lodash_1 = require("lodash");
|
||||
const extraFile_1 = require("../utils/extraFile");
|
||||
|
|
@ -32,7 +32,7 @@ async function loginWechatMp({ code, env }, context) {
|
|||
(0, assert_1.default)(type === 'wechatMp' || config.type === 'wechatMp');
|
||||
const config2 = config;
|
||||
const { appId, appSecret } = config2;
|
||||
const wechatInstance = oak_wechat_sdk_1.default.getInstance(appId, appSecret, 'wechatMp');
|
||||
const wechatInstance = oak_wechat_sdk_1.WechatSDK.getInstance(appId, appSecret, 'wechatMp');
|
||||
const { sessionKey, openId, unionId } = await wechatInstance.code2Session(code);
|
||||
const { result: [wechatUser] } = await rowStore.select('wechatUser', {
|
||||
data: {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,21 @@
|
|||
import { String, Text } from 'oak-domain/lib/types/DataType';
|
||||
import { EntityShape } from 'oak-domain/lib/types/Entity';
|
||||
export declare type SystemConfig = {
|
||||
Cos: {
|
||||
qiniu: {
|
||||
appKey: string;
|
||||
appSecret: string;
|
||||
};
|
||||
};
|
||||
Map: {
|
||||
amap: {
|
||||
webApiKey: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
export interface Schema extends EntityShape {
|
||||
name: String<32>;
|
||||
description: Text;
|
||||
config: Object;
|
||||
config: SystemConfig;
|
||||
}
|
||||
export declare type Relation = 'owner';
|
||||
|
|
|
|||
|
|
@ -1,13 +1,17 @@
|
|||
import { EntityDict } from 'oak-app-domain';
|
||||
import { Feature } from 'oak-frontend-base';
|
||||
import { Aspect, Context } from 'oak-domain/lib/types';
|
||||
import { Cache } from 'oak-frontend-base';
|
||||
export declare class Token<ED extends EntityDict, Cxt extends Context<ED>, AD extends Record<string, Aspect<ED, Cxt>>> extends Feature<ED, Cxt, AD> {
|
||||
private token?;
|
||||
private rwLock;
|
||||
private cache?;
|
||||
constructor();
|
||||
loginByPassword(mobile: string, password: string, scene: string): Promise<void>;
|
||||
loginWechatMp(scene: string): Promise<void>;
|
||||
syncUserInfoWechatMp(scene: string): Promise<void>;
|
||||
logout(): Promise<void>;
|
||||
getToken(): Promise<string | undefined>;
|
||||
setCache(cache: Cache<ED, Cxt, AD>): void;
|
||||
getUserId(): Promise<("userId" extends keyof ED["token"]["Schema"] ? ED["token"]["Selection"]["data"][keyof ED["token"]["Schema"] & "userId"] extends 1 | undefined ? ED["token"]["Schema"][keyof ED["token"]["Schema"] & "userId"] : ED["token"]["Selection"]["data"][keyof ED["token"]["Schema"] & "userId"] extends import("oak-domain/lib/types").OtmSubProjection ? never[] | import("oak-domain/lib/types").SelectRowShape<Required<ED["token"]["Schema"]>[keyof ED["token"]["Schema"] & "userId"][0], ED["token"]["Selection"]["data"][keyof ED["token"]["Schema"] & "userId"]["data"]>[] : keyof ED["token"]["Schema"] & "userId" extends import("oak-domain/lib/types").OptionalKeys<ED["token"]["Schema"]> ? import("oak-domain/lib/types").SelectRowShape<NonNullable<Required<ED["token"]["Schema"]>[import("oak-domain/lib/types").OptionalKeys<ED["token"]["Schema"]> & keyof ED["token"]["Schema"] & "userId"]>, ED["token"]["Selection"]["data"][import("oak-domain/lib/types").OptionalKeys<ED["token"]["Schema"]> & keyof ED["token"]["Schema"] & "userId"]> | null : import("oak-domain/lib/types").SelectRowShape<NonNullable<Required<ED["token"]["Schema"]>[keyof ED["token"]["Schema"] & "userId"]>, ED["token"]["Selection"]["data"][keyof ED["token"]["Schema"] & "userId"]> : never) | undefined>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ const concurrent_1 = require("oak-domain/lib/utils/concurrent");
|
|||
class Token extends oak_frontend_base_1.Feature {
|
||||
token;
|
||||
rwLock;
|
||||
cache;
|
||||
constructor() {
|
||||
super();
|
||||
this.rwLock = new concurrent_1.RWLock();
|
||||
|
|
@ -88,6 +89,22 @@ class Token extends oak_frontend_base_1.Feature {
|
|||
throw err;
|
||||
}
|
||||
}
|
||||
setCache(cache) {
|
||||
this.cache = cache;
|
||||
}
|
||||
async getUserId() {
|
||||
const token = await this.getToken();
|
||||
const result = await this.cache.get('token', {
|
||||
data: {
|
||||
id: 1,
|
||||
userId: 1,
|
||||
},
|
||||
filter: {
|
||||
id: token,
|
||||
}
|
||||
}, 'token:getUserId');
|
||||
return result[0].userId;
|
||||
}
|
||||
}
|
||||
__decorate([
|
||||
oak_frontend_base_1.Action
|
||||
|
|
|
|||
|
|
@ -1,10 +1,24 @@
|
|||
import { String, Int, Datetime, Image, Boolean, Text } from 'oak-domain/lib/types/DataType';
|
||||
import { EntityShape } from 'oak-domain/lib/types/Entity';
|
||||
|
||||
export type SystemConfig = {
|
||||
Cos: {
|
||||
qiniu: {
|
||||
appKey: string;
|
||||
appSecret: string;
|
||||
}
|
||||
},
|
||||
Map: {
|
||||
amap: {
|
||||
webApiKey: string; // 高德访问rest服务接口的key
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export interface Schema extends EntityShape {
|
||||
name: String<32>;
|
||||
description: Text;
|
||||
config: Object;
|
||||
config: SystemConfig;
|
||||
};
|
||||
|
||||
export type Relation = 'owner';
|
||||
|
|
@ -77,7 +77,7 @@
|
|||
"node_modules",
|
||||
"**/*.spec.ts",
|
||||
"test",
|
||||
"scripts",/*
|
||||
"wechatMp" */
|
||||
"scripts",
|
||||
"wechatMp"
|
||||
]
|
||||
}
|
||||
|
|
@ -25,7 +25,7 @@ Component({
|
|||
},
|
||||
|
||||
methods: {
|
||||
async onAdd() {
|
||||
async onPick() {
|
||||
const { selectCount, mediaType, sourceType, oakUpdateData } = this.data;
|
||||
try {
|
||||
const { errMsg, tempFiles } = await wx.chooseMedia({
|
||||
|
|
@ -40,8 +40,9 @@ Component({
|
|||
});
|
||||
}
|
||||
else {
|
||||
// this.triggerEvent('add', tempFiles);
|
||||
this.createData(tempFiles);
|
||||
const result = this.triggerEvent('pick', tempFiles);
|
||||
// console.log(result);
|
||||
// this.properties.createData(tempFiles);
|
||||
/* const { globalData: { features } } = getApp();
|
||||
const { oakFullpath } = this.data;
|
||||
for (const file of tempFiles) {
|
||||
|
|
@ -74,7 +75,6 @@ Component({
|
|||
},
|
||||
async setFullpath(oakParent: string) {
|
||||
const { globalData: { features }} = getApp();
|
||||
console.log(this.data);
|
||||
if (oakParent) {
|
||||
const oakFullpath = `${oakParent}.${this.data.oakPath}`;
|
||||
await features.runningNode.createNode({
|
||||
|
|
@ -85,6 +85,12 @@ Component({
|
|||
oakFullpath,
|
||||
});
|
||||
}
|
||||
},
|
||||
add(options: any[]) {
|
||||
const { globalData: { features }} = getApp();
|
||||
options.forEach(
|
||||
ele => features.runningNode.addNode(this.data.oakFullpath, ele)
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<view class="default-item item" wx:for="{{oakValue}}" wx:key="index">
|
||||
<item oakValue="{{item}}" oakPath="{{index}}" oakParent="{{oakFullpath}}" />
|
||||
</view>
|
||||
<view class="default-item item insert-btn" wx:if="{{!disableInsert}}" bind:tap="onAdd">
|
||||
<view class="default-item item insert-btn" wx:if="{{!disableInsert}}" bind:tap="onPick">
|
||||
<g-icon name="add" size="80"/>
|
||||
</view>
|
||||
</view>
|
||||
Loading…
Reference in New Issue