cert-service.js 634 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) {
        let {code, data} = await this.api.certCheck(mobile, area, smsCode);

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

        return {
            result: data
        };
    }
};