文件
fenleixinxi/application/admin/model/FcWithdraw.php

61 行
1.1 KiB
PHP

<?php
namespace app\admin\model;
use think\Model;
use app\common\library\FcRelation;
class FcWithdraw extends Model
{
// 表名
protected $name = 'fc_withdraw';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'integer';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
protected $deleteTime = false;
// 追加属性
protected $append = [
'status_text',
'user_name',
];
public function getUserNameAttr($value, $data)
{
return FcRelation::userName(isset($data['user_id']) ? $data['user_id'] : 0);
}
public function getStatusList()
{
return [
'auditing' => __('待审核'),
'paid' => __('已打款'),
'rejected' => __('已驳回'),
];
}
public function getStatusTextAttr($value, $data)
{
$value = $value ?: ($data['status'] ?? '');
$list = $this->getStatusList();
return $list[$value] ?? '';
}
}