<commit_before>'use strict';

import Base from './base.js';

export default class extends Base {
    /**
     * index action
     * @return {Promise} []
     */
    indexAction() {
        //auto render template file index_index.html
        return this.display();
    }

    /**
     * 获得列表中的数据
     * @return {object} JSON 格式数据
     */
    async getdataAction() {
        let data = await this.model('user').getAllUser();

        data.map(item => {
            // 转义时间
            item.createTime = this.getCurTimeStr(item.createTime);
            item.updateTime = this.getCurTimeStr(item.updateTime);
            item.birthday = this.getCurDateStr(item.birthday);

            // 为表格中的每一行增加id：DT_RowId，以便后续方便操作
            item.DT_RowId = 'row_' + item.id;

            if (item.state < 0) {
                // 为表格中的无效数据增加样式：DT_RowClass，默认值有'active', 'success', 'warning', 'danger'，也可以自定义
                item.DT_RowClass = 'warning';
                item.stateShow = '无效';
            } else {
                item.stateShow = '有效';
            }

            return item;
        });

        return this.success(data);
    }

    async saveAction() {
        let {
            id, name, pwd, state
        } = this.post();

        //console.log(title, theme, slide_content); 
        let model = this.model("user");
        let datetime = this.getCurTimeStr();

        pwd = think.md5('think_' + pwd);

        let record = {
            name: name,
            pwd: <PASSWORD>,
            createTime: datetime,
            updateTime: datetime,
            state: state
        };
        console.log(record);
        // return this.success('test');

        if (!id) {<commit_msg>user增加birthday到数据库<commit_after>'use strict';

import Base from './base.js';

export default class extends Base {
    /**
     * index action
     * @return {Promise} []
     */
    indexAction() {
        //auto render template file index_index.html
        return this.display();
    }

    /**
     * 获得列表中的数据
     * @return {object} JSON 格式数据
     */
    async getdataAction() {
        let data = await this.model('user').getAllUser();

        data.map(item => {
            // 转义时间
            item.createTime = this.getCurTimeStr(item.createTime);
            item.updateTime = this.getCurTimeStr(item.updateTime);
            item.birthday = this.getCurDateStr(item.birthday);

            // 为表格中的每一行增加id：DT_RowId，以便后续方便操作
            item.DT_RowId = 'row_' + item.id;

            if (item.state < 0) {
                // 为表格中的无效数据增加样式：DT_RowClass，默认值有'active', 'success', 'warning', 'danger'，也可以自定义
                item.DT_RowClass = 'warning';
                item.stateShow = '无效';
            } else {
                item.stateShow = '有效';
            }

            return item;
        });

        return this.success(data);
    }

    async saveAction() {
        let {
            id, name, pwd, state, birthday
        } = this.post();

        let model = this.model("user");
        let datetime = this.getCurTimeStr();

        pwd = <PASSWORD>('<PASSWORD>' + pwd);

        let record = {
            name: name,
            pwd: <PASSWORD>,
            createTime: datetime,
            updateTime: datetime,
            state: state,
            birthday: birthday
        };
        console.log(record);
        // return this.success('test');

        if (!id) {
{'fraction_non_alphanumeric': 0.12821270310192023, 'fraction_numerical': 0.0008862629246676514, 'mean_word_length': 1.5729483282674772, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1656931', 'n_tokens_mistral': 1085, 'n_tokens_neox': 1077, 'n_words': 202}