mirror of
https://github.com/cool-team-official/cool-admin-midway.git
synced 2025-12-15 03:42:51 +00:00
优化未安装插件的提示
This commit is contained in:
parent
c3b021c2c9
commit
9d90b99105
@ -50,7 +50,10 @@ export class UserSmsService extends BaseService {
|
|||||||
// 随机四位验证码
|
// 随机四位验证码
|
||||||
const code = _.random(1000, 9999);
|
const code = _.random(1000, 9999);
|
||||||
const pluginKey = this.config.pluginKey;
|
const pluginKey = this.config.pluginKey;
|
||||||
if (!this.plugin) throw new CoolCommException('未配置短信插件');
|
if (!this.plugin)
|
||||||
|
throw new CoolCommException(
|
||||||
|
'未配置短信插件,请到插件市场下载安装配置:https://cool-js.com/plugin?keyWord=短信'
|
||||||
|
);
|
||||||
try {
|
try {
|
||||||
if (pluginKey == 'sms-tx') {
|
if (pluginKey == 'sms-tx') {
|
||||||
await this.plugin.send([phone], [code]);
|
await this.plugin.send([phone], [code]);
|
||||||
|
|||||||
@ -27,12 +27,27 @@ export class UserWxService extends BaseService {
|
|||||||
@Inject()
|
@Inject()
|
||||||
pluginService: PluginService;
|
pluginService: PluginService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得插件实例
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
async getPlugin() {
|
||||||
|
try {
|
||||||
|
const wxPlugin: any = await this.pluginService.getInstance('wx');
|
||||||
|
return wxPlugin;
|
||||||
|
} catch (error) {
|
||||||
|
throw new CoolCommException(
|
||||||
|
'未配置微信插件,请到插件市场下载安装配置:https://cool-js.com/plugin/70'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得小程序实例
|
* 获得小程序实例
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
async getMiniApp() {
|
async getMiniApp() {
|
||||||
const wxPlugin: any = await this.pluginService.getInstance('wx');
|
const wxPlugin: any = await this.getPlugin();
|
||||||
return wxPlugin.MiniApp();
|
return wxPlugin.MiniApp();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,7 +56,7 @@ export class UserWxService extends BaseService {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
async getOfficialAccount() {
|
async getOfficialAccount() {
|
||||||
const wxPlugin: any = await this.pluginService.getInstance('wx');
|
const wxPlugin: any = await this.getPlugin();
|
||||||
return wxPlugin.OfficialAccount();
|
return wxPlugin.OfficialAccount();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +65,7 @@ export class UserWxService extends BaseService {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
async getOpenPlatform() {
|
async getOpenPlatform() {
|
||||||
const wxPlugin: any = await this.pluginService.getInstance('wx');
|
const wxPlugin: any = await this.getPlugin();
|
||||||
return wxPlugin.OpenPlatform();
|
return wxPlugin.OpenPlatform();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user