- Contract.php: 返回合约账户余额(balance_contract) - My.php: 地址管理增加BTC/ETH - AppContract.php: 一键平仓(closeall) - AppProxy.php: 代理专属注册链接 + 分级权限(L1/L2) - site.php: 手续费减半(0.018→0.009) - agent_permission_setup.sql: 代理权限SQL - crypto_news_crawler.py: 新闻自动采集脚本
155 lines
4.3 KiB
PHP
Executable File
155 lines
4.3 KiB
PHP
Executable File
<?php
|
|
|
|
namespace app\admin\model\user;
|
|
|
|
use think\Model;
|
|
|
|
|
|
class User extends Model
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
// 表名
|
|
protected $name = 'user';
|
|
|
|
// 自动写入时间戳字段
|
|
protected $autoWriteTimestamp = 'int';
|
|
|
|
// 定义时间戳字段名
|
|
protected $createTime = 'createtime';
|
|
protected $updateTime = 'updatetime';
|
|
protected $deleteTime = false;
|
|
|
|
// 追加属性
|
|
protected $append = [
|
|
'prevtime_text',
|
|
'logintime_text',
|
|
'jointime_text',
|
|
'update_time_text',
|
|
'listentime_text',
|
|
'last_level_time_text',
|
|
'apy_pay_text'
|
|
];
|
|
|
|
protected static function init()
|
|
{
|
|
// self::beforeUpdate(function ($row) {
|
|
// $changed = $row->getChangedData();
|
|
// //如果有修改密码
|
|
// if (isset($changed['password'])) {
|
|
// if ($changed['password']) {
|
|
// $salt = \fast\Random::alnum();
|
|
// $row->password = \app\common\library\Auth::instance()->getEncryptPassword($changed['password'], $salt);
|
|
// $row->salt = $salt;
|
|
// } else {
|
|
// unset($row->password);
|
|
// }
|
|
// }
|
|
// });
|
|
}
|
|
|
|
|
|
public function getApyPayList()
|
|
{
|
|
return ['0' => __('Apy_pay 0'), '1' => __('Apy_pay 1')];
|
|
}
|
|
public function getLhActList()
|
|
{
|
|
return ['0' => __('Lh_act 0'), '1' => __('Lh_act 1')];
|
|
}
|
|
public function getAuthList()
|
|
{
|
|
return ['0' => __('Auth 0'), '1' => __('Auth 1'), '2' => __('Auth 2')];
|
|
}
|
|
|
|
public function getEarlyAuthList()
|
|
{
|
|
return ['0' => __('未认证'), '1' => __('已认证')];
|
|
}
|
|
|
|
|
|
public function getPrevtimeTextAttr($value, $data)
|
|
{
|
|
$value = $value ? $value : (isset($data['prevtime']) ? $data['prevtime'] : '');
|
|
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
|
|
}
|
|
|
|
|
|
public function getLogintimeTextAttr($value, $data)
|
|
{
|
|
$value = $value ? $value : (isset($data['logintime']) ? $data['logintime'] : '');
|
|
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
|
|
}
|
|
|
|
|
|
public function getJointimeTextAttr($value, $data)
|
|
{
|
|
$value = $value ? $value : (isset($data['jointime']) ? $data['jointime'] : '');
|
|
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
|
|
}
|
|
|
|
|
|
public function getUpdateTimeTextAttr($value, $data)
|
|
{
|
|
$value = $value ? $value : (isset($data['update_time']) ? $data['update_time'] : '');
|
|
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
|
|
}
|
|
|
|
|
|
public function getListentimeTextAttr($value, $data)
|
|
{
|
|
$value = $value ? $value : (isset($data['listentime']) ? $data['listentime'] : '');
|
|
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
|
|
}
|
|
|
|
|
|
public function getLastLevelTimeTextAttr($value, $data)
|
|
{
|
|
$value = $value ? $value : (isset($data['last_level_time']) ? $data['last_level_time'] : '');
|
|
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
|
|
}
|
|
|
|
|
|
public function getApyPayTextAttr($value, $data)
|
|
{
|
|
$value = $value ? $value : (isset($data['apy_pay']) ? $data['apy_pay'] : '');
|
|
$list = $this->getApyPayList();
|
|
return isset($list[$value]) ? $list[$value] : '';
|
|
}
|
|
|
|
protected function setPrevtimeAttr($value)
|
|
{
|
|
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
|
|
}
|
|
|
|
protected function setLogintimeAttr($value)
|
|
{
|
|
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
|
|
}
|
|
|
|
protected function setJointimeAttr($value)
|
|
{
|
|
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
|
|
}
|
|
|
|
protected function setUpdateTimeAttr($value)
|
|
{
|
|
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
|
|
}
|
|
|
|
protected function setListentimeAttr($value)
|
|
{
|
|
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
|
|
}
|
|
|
|
protected function setLastLevelTimeAttr($value)
|
|
{
|
|
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
|
|
}
|
|
|
|
|
|
}
|