<?php

namespace app\model;

use think\Model;

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

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

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

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

    // 设置字段类型和默认值
    protected $casts = [
        'platform' => 'int',
        'account_id' => 'string',
        'customer_id' => 'string',
        'creative_id' => 'string',
        'name' => 'string',
        'title' => 'string',
        'thumbnail_url' => 'string',
        'url' => 'string',
        'type' => 'int',
        'object_type' => 'string',
        'status' => 'int',
        'created_at' => 'timestamp',
        'updated_at' => 'timestamp',
    ];

    // 默认值设置
    protected $defaults = [
        'name' => '',
        'title' => '',
        'thumbnail_url' => '',
        'url' => '',
        'type' => 1, // 默认为图片
        'object_type' => '',
        'status' => 2, // 默认为启用
    ];

}