43 lines
1003 B
PHP
43 lines
1003 B
PHP
<?php
|
|
|
|
namespace app\common\model;
|
|
|
|
use support\think\Model;
|
|
|
|
/**
|
|
* Channel
|
|
*/
|
|
class Channel extends Model
|
|
{
|
|
// 表名
|
|
protected $name = 'channel';
|
|
|
|
// 自动写入时间戳字段
|
|
protected $autoWriteTimestamp = true;
|
|
|
|
// 字段类型转换
|
|
protected $type = [
|
|
'create_time' => 'integer',
|
|
'update_time' => 'integer',
|
|
'affiliate_effective_start_at' => 'integer',
|
|
'affiliate_effective_end_at' => 'integer',
|
|
'settle_weekday' => 'integer',
|
|
'settle_monthday' => 'integer',
|
|
];
|
|
|
|
public function getprofitAmountAttr($value): ?float
|
|
{
|
|
return is_null($value) ? null : (float)$value;
|
|
}
|
|
|
|
public function adminGroup(): \think\model\relation\BelongsTo
|
|
{
|
|
return $this->belongsTo(\app\admin\model\AdminGroup::class, 'admin_group_id', 'id');
|
|
}
|
|
|
|
public function admin(): \think\model\relation\BelongsTo
|
|
{
|
|
return $this->belongsTo(\app\admin\model\Admin::class, 'admin_id', 'id');
|
|
}
|
|
}
|