40 lines
725 B
PHP
40 lines
725 B
PHP
<?php
|
|
|
|
namespace app\store\model;
|
|
|
|
use think\Model;
|
|
|
|
/**
|
|
* 算力套餐模型
|
|
*/
|
|
class TokensPackageModel extends Model
|
|
{
|
|
protected $name = 'tokens_package';
|
|
protected $pk = 'id';
|
|
|
|
// 自动写入时间戳
|
|
protected $autoWriteTimestamp = true;
|
|
protected $createTime = 'createTime';
|
|
protected $updateTime = 'updateTime';
|
|
|
|
// 类型转换
|
|
protected $type = [
|
|
'description' => 'array',
|
|
];
|
|
|
|
/**
|
|
* 描述获取器
|
|
*/
|
|
public function getDescriptionAttr($value)
|
|
{
|
|
if (empty($value)) {
|
|
return [];
|
|
}
|
|
if (is_array($value)) {
|
|
return $value;
|
|
}
|
|
return json_decode($value, true) ?: [];
|
|
}
|
|
}
|
|
|