import { IData } from "../../tc/interface/IData";

// import { IData } from "../../tc/interface/IData";
/**
 *Created by cuiliqiang on 2018/3/12
 * 数据基类
 */

export class Data implements IData {
    success: boolean;
    private _message: string;
    private _code: string;

    public update(data: any): void {
        this.success = data.success == undefined ? true : data.success;
        if (data.message) {
            this._message = data.message;
        } else if (data.desc) {
            this._message = data.desc;
        } else if (data.msg) {
            this._message = data.msg;
        }
        this._code = data.code;
    }

    /**
     * 接口提示信息
     * @returns {string}
     */
    public get message(): string {
        return this._message;
    }

    public set message(val) {
        this._message=val;
    }

    /**
     * 状态码
     * @returns {string}
     */
    public get code(): string {
        return this._code;
    }
}
