41 lines
891 B
PHP
41 lines
891 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace app\common\model\finance;
|
|
|
|
use app\common\model\BaseModel;
|
|
use think\facade\Db;
|
|
|
|
class AccountCost extends BaseModel
|
|
{
|
|
protected $name = 'account_cost';
|
|
|
|
protected $autoWriteTimestamp = true;
|
|
|
|
protected $createTime = 'create_time';
|
|
|
|
protected $updateTime = 'update_time';
|
|
|
|
protected $dateFormat = 'Y-m-d H:i:s';
|
|
|
|
public static function supportsDeptBinding(): bool
|
|
{
|
|
static $supported = null;
|
|
if ($supported !== null) {
|
|
return $supported;
|
|
}
|
|
|
|
try {
|
|
$fields = Db::name('account_cost')->getTableFields();
|
|
$supported = is_array($fields)
|
|
&& in_array('dept_id', $fields, true)
|
|
&& in_array('dept_name', $fields, true);
|
|
} catch (\Throwable) {
|
|
$supported = false;
|
|
}
|
|
|
|
return $supported;
|
|
}
|
|
}
|