<?php



namespace app\common\model\store;

use app\common\model\BaseModel;
use app\common\model\system\merchant\MerchantAdmin;

class Excel extends BaseModel
{
    protected $typeData = [
            'order'             => '订单列表',
            'delivery'          => '待发货订单',
            'searchLog'         => '搜索记录',
            'financial'         => '流水记录',
            'refundOrder'       => '退款单',
            'integralLog'       => '积分日志',
            'importDelivery'    => '发货导入',
            'exportFinancial'   => '日/月账单',
        ];

    /**
     * TODO
     * @return string
     * @author Qinii
     * @day 2020-07-30
     */
    public static function tablePk(): string
    {
        return 'excel_id';
    }


    /**
     * TODO
     * @return string
     * @author Qinii
     * @day 2020-07-30
     */
    public static function tableName(): string
    {
        return 'excel';
    }

    public function merAdmin()
    {
        return $this->hasOne(MerchantAdmin::class,'merchant_admin_id','admin_id');
    }

    public function getPathAttr($value)
    {
        return systemConfig('site_url').$value;
    }

    public function getTypeAttr($value)
    {
        return $this->typeData[$value];
    }

}
