<?php
/**
 * 积分商品兑换Dao
 * Created by PhpStorm.
 * User: haoren
 * Date: 2021/03/25
 * Time: 15:00
 */

namespace JinDouYun\Dao\Integral;

use JinDouYun\Dao\BaseDao;

class DIntegralGoodsExchange extends BaseDao
{
    public function __construct($serviceDB = 'default')
    {
        $this->_table = 'integral_goods_exchange';
        $this->_primary = 'id';
        $this->_fields = [
            "id", //int(10) NOT NULL AUTO_INCREMENT COMMENT '主键id',
            "no", //varchar(255) DEFAULT NULL COMMENT '单号',
            "userCenterId", //int(10) DEFAULT NULL COMMENT '用户id',
            "customerId", //int(10) DEFAULT NULL COMMENT '客户id',
            "goodsId", //int(10) DEFAULT NULL COMMENT '积分商品id',
            "shopId", //int(10) DEFAULT '0' COMMENT '商铺id',
            "num", //int(10) DEFAULT NULL COMMENT '兑换数量',
            "integral", //decimal(10,2) DEFAULT NULL COMMENT '积分单价',
            "amount", //decimal(10,2) DEFAULT NULL COMMENT '积分总价',
            "address", //json DEFAULT NULL COMMENT '收货地址',
            "remark", //varchar(255) NOT NULL COMMENT '备注',
            "reason", //varchar(255) DEFAULT NULL COMMENT '失效原因',
            "status", //tinyint(1) DEFAULT '4' COMMENT '状态  4:待发货 5:已完成 6:已失效',
            "createTime", //int(10) DEFAULT NULL COMMENT '创建时间',
            "updateTime", //int(10) DEFAULT NULL COMMENT '修改时间',
            "extend", //json DEFAULT NULL COMMENT '扩展字段',
        ];
        $this->_readonly = ['id'];
        $this->_create_autofill = [
            'createTime' => time()
        ];
        $this->_update_autofill = [
            'updateTime' => time()
        ];

        parent::__construct($serviceDB);
    }
}