|
@@ -7,6 +7,7 @@ const { CrudService } = require('naf-framework-mongoose/lib/service');
|
|
const { BusinessError, ErrorCode } = require('naf-core').Error;
|
|
const { BusinessError, ErrorCode } = require('naf-core').Error;
|
|
|
|
|
|
const sms = require('../util/aliMessage.js');
|
|
const sms = require('../util/aliMessage.js');
|
|
|
|
+const smsUtil = require('../util/smsUtil.js');
|
|
|
|
|
|
class PhoneMessageService extends CrudService {
|
|
class PhoneMessageService extends CrudService {
|
|
|
|
|
|
@@ -27,13 +28,21 @@ class PhoneMessageService extends CrudService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 发送短信提醒:PhoneNumbers, SignName, TemplateCode, TemplateParam
|
|
|
|
+ async smsRemind(data) {
|
|
|
|
+ if (data.PhoneNumbers) {
|
|
|
|
+ const res = await smsUtil.smsAlert(data.PhoneNumbers, '惠金信用信息服务', data.TemplateCode, data.TemplateParam);
|
|
|
|
+ return res;
|
|
|
|
+ }
|
|
|
|
+ return '手机号有误';
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // OCR : img(base64)
|
|
async getMessage(data) {
|
|
async getMessage(data) {
|
|
const url = 'https://dm-58.data.aliyun.com/rest/160601/ocr/ocr_business_license.json';
|
|
const url = 'https://dm-58.data.aliyun.com/rest/160601/ocr/ocr_business_license.json';
|
|
const AppCode = '4638ef02c8e248e1b12d55b1170e4feb';
|
|
const AppCode = '4638ef02c8e248e1b12d55b1170e4feb';
|
|
if (data.img) {
|
|
if (data.img) {
|
|
-
|
|
|
|
const bodys = { image: data.img };
|
|
const bodys = { image: data.img };
|
|
-
|
|
|
|
const res = await this.ctx.curl(url, {
|
|
const res = await this.ctx.curl(url, {
|
|
method: 'POST',
|
|
method: 'POST',
|
|
headers: { Authorization: 'APPCODE ' + AppCode },
|
|
headers: { Authorization: 'APPCODE ' + AppCode },
|