<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "{{%FLOW_WALLET}}".
 *
 * @property string $ID
 * @property string $USER_ID 会员ID
 * @property string $CALC_ID 奖金结算表ID
 * @property string $AMOUNT 金额
 * @property string $TOTAL 当前总金额
 * @property int $IS_INCR 是否增加
 * @property string $REMARK 备注
 * @property string $ADMIN_NAME 操作人名称
 * @property int $PERIOD_NUM 所在期数
 * @property int $CALC_MONTH 所在结算月
 * @property string $P_MONTH 表分区的日期索引
 * @property int $CREATED_AT 创建时间
 * @property int $DELETED 是否删除
 * @property int $DELETED_AT 删除时间
 * @property int $SORT 排序
 * @property string $TRANSFER_SN 转账流水号
 */
class FlowWallet extends \common\components\ActiveRecord
{
    const INCR_REDUCE = 0;      // 减少
    const INCR_ADD = 1;         // 增加
    const INCR_FREEZE = 2;      // 冻结
    const INCR_UNFREEZE = 3;    // 解冻

    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%FLOW_WALLET}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['USER_ID', 'REMARK', 'PERIOD_NUM', 'CALC_MONTH', 'P_MONTH', 'CREATED_AT'], 'required'],
            [['AMOUNT', 'TOTAL'], 'number'],
            [['IS_INCR', 'PERIOD_NUM', 'CALC_MONTH', 'CREATED_AT', 'DELETED', 'DELETED_AT', 'SORT'], 'integer'],
            [['ID', 'USER_ID', 'CALC_ID', 'ADMIN_NAME', 'TRANSFER_SN'], 'string', 'max' => 32],
            [['REMARK'], 'string', 'max' => 255],
            [['ID'], 'unique'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'ID' => 'ID',
            'USER_ID' => '会员ID',
            'CALC_ID' => '现金结算表ID',
            'AMOUNT' => '金额',
            'TOTAL' => '当前总金额',
            'IS_INCR' => '是否增加',
            'REMARK' => '备注',
            'ADMIN_NAME' => '操作人名称',
            'PERIOD_NUM' => '所在期数',
            'CALC_MONTH' => '所在结算月',
            'P_MONTH' => '表分区的日期索引',
            'CREATED_AT' => '创建时间',
            'DELETED' => '是否删除',
            'DELETED_AT' => '删除时间',
            'SORT' => '排序',
            'TRANSFER_SN' => '转账流水号',
        ];
    }
}
