'use strict';

/**
 *
 *
 * @author Mai
 * @date 2018/6/8
 * @version
 */

module.exports = app => {
    class Log extends app.BaseService {
        /**
         * 构造函数
         *
         * @param {Object} ctx - egg全局context
         * @return {void}
         */
        constructor(ctx) {
            super(ctx);
            this.tableName = 'log';
        }

        async addLog(operation, time) {
            console.log(time);
            try {
                await this.db.insert(this.tableName, {
                    operation: operation,
                    time: time,
                });
            } catch (err) {
                console.log(err);
            }
        }

    };

    return Log;
};