user.js 865 Bytes
const mysqlCli = global.yoho.utils.mysqlCli;

const TABLE_ACT_LOGIN_USER_LOG = 'act_login_user_log';

class UserModel extends global.yoho.BaseModel {
    constructor(ctx) {
        super(ctx);
    }
    loginLog({uid, ip, loginTime, platform, referer}) {
        return mysqlCli.insert(
            `insert into ${TABLE_ACT_LOGIN_USER_LOG} (user_id, login_time, platform, ip, referer) values (:uid, :loginTime, :platform, :ip, :referer);`, // eslint-disable-line
            {
                uid,
                loginTime,
                platform,
                ip,
                referer
            }
        );
    }
    userBaseInfo(uid) {
        return this.get({
            data: {
                uid,
                method: 'app.passport.getUserBase'
            },
            api: global.yoho.API
        });
    }
}
module.exports = UserModel;