cert-service.js 648 Bytes
'use strict';

const CertApi = require('./cert-api');

module.exports = class extends global.yoho.BaseModel {
    constructor(ctx) {
        super(ctx);

        this.api = new CertApi(ctx);
        this.sendCertMsg = this.api.sendCertMsg.bind(this.api);
        this.certMobile = this.api.certMobile.bind(this.api);
    }

    async certCheck(mobile, area, smsCode, extra) {
        let {code, data} = await this.api.certCheck(mobile, area, smsCode, extra);

        if (!code || code !== 200) {
            return {
                error: new Error('error')
            };
        }

        return {
            result: data
        };
    }
};