新版数智员工
This commit is contained in:
39
application/store/model/TokensPackageModel.php
Normal file
39
application/store/model/TokensPackageModel.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?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) ?: [];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user