user.js 560 Bytes
/**
 * 用户鉴权model
 * @author: leo <qi.li@yoho.cn>
 * @date: 28/06/2017
 */

const mysqlCli = global.yoho.utils.mysqlCli;

const TABLE_USER = 'user';

class UserModel extends global.yoho.BaseModel {
    constructor(ctx) {
        super(ctx);
    }

    /**
     * 判断用户是否存在
     * @param phone
     * @returns {*}
     */
    isUserExisted(phone) {
        return mysqlCli.query(
            `select * from ${TABLE_USER} where user_phone = :phone;`, {
                phone
            }
        );
    }
}

module.exports = UserModel;