- 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: 新闻自动采集脚本
89 lines
2.2 KiB
PHP
Executable File
89 lines
2.2 KiB
PHP
Executable File
<?php
|
|
|
|
namespace app\admin\model\app;
|
|
|
|
use think\Model;
|
|
|
|
|
|
class HisOrder extends Model
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
// 表名
|
|
protected $name = 'his_order';
|
|
|
|
// 自动写入时间戳字段
|
|
protected $autoWriteTimestamp = 'int';
|
|
|
|
// 定义时间戳字段名
|
|
protected $createTime = 'createtime';
|
|
protected $updateTime = false;
|
|
protected $deleteTime = false;
|
|
|
|
// 追加属性
|
|
protected $append = [
|
|
'symbol_text',
|
|
'open_time_text',
|
|
'trade_result_text',
|
|
'rise_or_fall_text'
|
|
];
|
|
|
|
|
|
|
|
public function getSymbolList()
|
|
{
|
|
return ['btcusdt' => __('Btcusdt'), 'bchusdt' => __('Bchusdt'), 'ethusdt' => __('Ethusdt'), 'ltcusdt' => __('Ltcusdt'), 'eosusdt' => __('Eosusdt'), 'etcusdt' => __('Etcusdt')];
|
|
}
|
|
|
|
public function getTradeResultList()
|
|
{
|
|
return ['win' => __('Trade_result win'), 'loss' => __('Trade_result loss')];
|
|
}
|
|
|
|
public function getRiseOrFallList()
|
|
{
|
|
return ['rise' => __('Rise_or_fall rise'), 'fall' => __('Rise_or_fall fall')];
|
|
}
|
|
|
|
|
|
public function getSymbolTextAttr($value, $data)
|
|
{
|
|
$value = $value ? $value : (isset($data['symbol']) ? $data['symbol'] : '');
|
|
$list = $this->getSymbolList();
|
|
return isset($list[$value]) ? $list[$value] : '';
|
|
}
|
|
|
|
|
|
public function getOpenTimeTextAttr($value, $data)
|
|
{
|
|
$value = $value ? $value : (isset($data['open_time']) ? $data['open_time'] : '');
|
|
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
|
|
}
|
|
|
|
|
|
public function getTradeResultTextAttr($value, $data)
|
|
{
|
|
$value = $value ? $value : (isset($data['trade_result']) ? $data['trade_result'] : '');
|
|
$list = $this->getTradeResultList();
|
|
return isset($list[$value]) ? $list[$value] : '';
|
|
}
|
|
|
|
|
|
public function getRiseOrFallTextAttr($value, $data)
|
|
{
|
|
$value = $value ? $value : (isset($data['rise_or_fall']) ? $data['rise_or_fall'] : '');
|
|
$list = $this->getRiseOrFallList();
|
|
return isset($list[$value]) ? $list[$value] : '';
|
|
}
|
|
|
|
protected function setOpenTimeAttr($value)
|
|
{
|
|
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
|
|
}
|
|
|
|
|
|
}
|