"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.OpResult = void 0;
/**
 * 常用操作结果
 */
class OpResult {
    constructor() {
        /**
         * 响应代码
         * 2000 ：成功，5000：失败
         * @type {number}
         */
        this.code = 2000;
        /**
         * 响应消息
         * @type {string}
         */
        this.message = "";
    }
    /**
     * 操作成功
     * @param message  响应消息
     * @param data  响应数据
     */
    static success(message = "", data = undefined) {
        const result = new OpResult();
        result.data = data;
        result.message = message;
        return result;
    }
    /**
    * 操作失败
    * @param message  响应消息
    * @param data  响应数据
    */
    static error(message = "", data) {
        const result = new OpResult();
        result.code = 5000;
        result.data = data;
        result.message = message;
        return result;
    }
}
exports.OpResult = OpResult;
