<?php
namespace app\model;

use think\Model;

class BpsAdsMerchantRelation extends Model
{
    // 设置当前模型对应的完整数据表名称
    protected $table = 'bps.bps_ads_merchant_relation';

    // 设置主键
    protected $pk = 'id';

    // 设置自动时间戳
    protected $autoWriteTimestamp = true;

    // 定义时间戳字段
    protected $createTime = 'created_at';  // 创建时间字段
    protected $updateTime = 'updated_at';  // 更新时间字段

    // 字段类型映射
    protected $casts = [
        'id' => 'int',
        'platform' => 'int',
        'ext_info' => 'json', // 将 ext_info 字段映射为 JSON 类型
        'is_unbind' => 'bool',
        'is_del' => 'bool',
    ];

    // 默认值设置
    protected $defaults = [
        'currency' => '', // 设置默认货币类型
        'ext_info' => '{}', // 设置默认 ext_info 为空的 JSON 对象
        'is_unbind' => false, // 设置默认 is_unbind 为 false
        'is_del' => false, // 设置默认 is_del 为 false
    ];

    // 其他自定义方法可以根据需求添加
}