mirror of
https://github.com/cool-team-official/cool-admin-midway.git
synced 2024-11-01 14:10:29 +08:00
新增插件支持类型提示
This commit is contained in:
parent
450700c211
commit
dba0331e44
@ -144,7 +144,7 @@ export class PluginService extends BaseService {
|
|||||||
...params
|
...params
|
||||||
) {
|
) {
|
||||||
// 实例
|
// 实例
|
||||||
const instance = await this.getInstance(key);
|
const instance: any = await this.getInstance(key);
|
||||||
return await instance[method](...params);
|
return await instance[method](...params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ export class UserLoginService extends BaseService {
|
|||||||
* @param openid
|
* @param openid
|
||||||
*/
|
*/
|
||||||
async uniPhone(access_token, openid, appId) {
|
async uniPhone(access_token, openid, appId) {
|
||||||
const instance = await this.pluginService.getInstance('uniphone');
|
const instance: any = await this.pluginService.getInstance('uniphone');
|
||||||
const phone = await instance.getPhone(access_token, openid, appId);
|
const phone = await instance.getPhone(access_token, openid, appId);
|
||||||
if (phone) {
|
if (phone) {
|
||||||
return await this.phone(phone);
|
return await this.phone(phone);
|
||||||
|
@ -32,7 +32,7 @@ export class UserWxService extends BaseService {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
async getMiniApp() {
|
async getMiniApp() {
|
||||||
const wxPlugin = await this.pluginService.getInstance('wx');
|
const wxPlugin: any = await this.pluginService.getInstance('wx');
|
||||||
return wxPlugin.MiniApp();
|
return wxPlugin.MiniApp();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ export class UserWxService extends BaseService {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
async getOfficialAccount() {
|
async getOfficialAccount() {
|
||||||
const wxPlugin = await this.pluginService.getInstance('wx');
|
const wxPlugin: any = await this.pluginService.getInstance('wx');
|
||||||
return wxPlugin.OfficialAccount();
|
return wxPlugin.OfficialAccount();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ export class UserWxService extends BaseService {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
async getOpenPlatform() {
|
async getOpenPlatform() {
|
||||||
const wxPlugin = await this.pluginService.getInstance('wx');
|
const wxPlugin: any = await this.pluginService.getInstance('wx');
|
||||||
return wxPlugin.OpenPlatform();
|
return wxPlugin.OpenPlatform();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
typings/plugin.d.ts
vendored
4
typings/plugin.d.ts
vendored
@ -1,12 +1,8 @@
|
|||||||
import * as wx from './wx';
|
|
||||||
import * as uniphone from './uniphone';
|
|
||||||
import { BaseUpload, MODETYPE } from './upload';
|
import { BaseUpload, MODETYPE } from './upload';
|
||||||
type AnyString = string & {};
|
type AnyString = string & {};
|
||||||
/**
|
/**
|
||||||
* 插件类型声明
|
* 插件类型声明
|
||||||
*/
|
*/
|
||||||
interface PluginMap {
|
interface PluginMap {
|
||||||
wx: wx.CoolPlugin;
|
|
||||||
upload: BaseUpload;
|
upload: BaseUpload;
|
||||||
uniphone: uniphone.CoolPlugin;
|
|
||||||
}
|
}
|
||||||
|
14
typings/uniphone.d.ts
vendored
14
typings/uniphone.d.ts
vendored
@ -1,14 +0,0 @@
|
|||||||
import { BasePlugin } from '@cool-midway/plugin-cli';
|
|
||||||
/**
|
|
||||||
* 一键手机号登录
|
|
||||||
*/
|
|
||||||
export declare class CoolPlugin extends BasePlugin {
|
|
||||||
/**
|
|
||||||
* 获得手机号
|
|
||||||
* @param access_token 前端获取的access_token
|
|
||||||
* @param openid 前端获取的openid
|
|
||||||
* @param appId 前端获取的appId
|
|
||||||
*/
|
|
||||||
getPhone(access_token: string, openid: string, appId: string): Promise<any>;
|
|
||||||
}
|
|
||||||
export declare const Plugin: typeof CoolPlugin;
|
|
58
typings/wx.d.ts
vendored
58
typings/wx.d.ts
vendored
@ -1,58 +0,0 @@
|
|||||||
import { BasePlugin } from '@cool-midway/plugin-cli';
|
|
||||||
import {
|
|
||||||
OfficialAccount,
|
|
||||||
MiniApp,
|
|
||||||
Pay,
|
|
||||||
OpenPlatform,
|
|
||||||
Work,
|
|
||||||
OpenWork,
|
|
||||||
} from 'node-easywechat';
|
|
||||||
/**
|
|
||||||
* 微信
|
|
||||||
*/
|
|
||||||
export declare class CoolPlugin extends BasePlugin {
|
|
||||||
/**
|
|
||||||
* 公众号
|
|
||||||
* @param config
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
OfficialAccount(config?: any): Promise<any>;
|
|
||||||
/**
|
|
||||||
* 小程序
|
|
||||||
* @param config
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
MiniApp(config?: any): Promise<any>;
|
|
||||||
/**
|
|
||||||
* 支付
|
|
||||||
* @param config
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
Pay(config?: any): Promise<any>;
|
|
||||||
/**
|
|
||||||
* 开放平台
|
|
||||||
* @param config
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
OpenPlatform(config?: any): Promise<any>;
|
|
||||||
/**
|
|
||||||
* 企业微信
|
|
||||||
* @param config
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
Work(config?: any): Promise<any>;
|
|
||||||
/**
|
|
||||||
* 企业微信开放平台
|
|
||||||
* @param config
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
OpenWork(config?: any): Promise<any>;
|
|
||||||
/**
|
|
||||||
* 设置缓存
|
|
||||||
* @param app
|
|
||||||
*/
|
|
||||||
setCache(
|
|
||||||
app: OfficialAccount | MiniApp | Pay | OpenPlatform | Work | OpenWork
|
|
||||||
): Promise<void>;
|
|
||||||
}
|
|
||||||
export declare const Plugin: typeof CoolPlugin;
|
|
Loading…
Reference in New Issue
Block a user