1
This commit is contained in:
parent
12297587f7
commit
330e1fc9da
@ -1699,8 +1699,7 @@ CREATE TABLE `t_hash_rate` (
|
|||||||
`period` int(11) NOT NULL DEFAULT '0' COMMENT '算力期数',
|
`period` int(11) NOT NULL DEFAULT '0' COMMENT '算力期数',
|
||||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||||
PRIMARY KEY (`idx`),
|
PRIMARY KEY (`idx`)
|
||||||
UNIQUE KEY `account_period_task_id` (`account_id`,`period`, `task_id`)
|
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||||
|
|
||||||
--
|
--
|
||||||
|
@ -8,15 +8,27 @@ class HashRate extends BaseModel
|
|||||||
{
|
{
|
||||||
|
|
||||||
public static function find($taskId,$period){
|
public static function find($taskId,$period){
|
||||||
return SqlHelper::ormSelectOne(
|
// return SqlHelper::ormSelectOne(
|
||||||
myself()->_getSelfMysql(),
|
// myself()->_getSelfMysql(),
|
||||||
't_hash_rate',
|
// 't_hash_rate',
|
||||||
|
// array(
|
||||||
|
// 'account_id' => myself()->_getAccountId(),
|
||||||
|
// 'task_id' => $taskId,
|
||||||
|
// 'period' => $period,
|
||||||
|
// )
|
||||||
|
// );
|
||||||
|
$row = myself()->_getSelfMysql()->execQueryOne(
|
||||||
|
'SELECT * FROM t_hash_rate WHERE account_id=:account AND period=:period AND task_id=:task_id ORDER BY idx DESC LIMIT 1',
|
||||||
array(
|
array(
|
||||||
'account_id' => myself()->_getAccountId(),
|
':account' => myself()->_getAccountId(),
|
||||||
'task_id' => $taskId,
|
':period' => $period,
|
||||||
'period' => $period,
|
':task_id' => $taskId,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
if (!$row){
|
||||||
|
$row = array();
|
||||||
|
}
|
||||||
|
return $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getCount($period){
|
public static function getCount($period){
|
||||||
@ -33,17 +45,9 @@ class HashRate extends BaseModel
|
|||||||
|
|
||||||
|
|
||||||
public static function add($taskId,$period){
|
public static function add($taskId,$period){
|
||||||
SqlHelper::upsert(
|
SqlHelper::insert(
|
||||||
myself()->_getSelfMysql(),
|
myself()->_getSelfMysql(),
|
||||||
't_hash_rate',
|
't_hash_rate',
|
||||||
array(
|
|
||||||
'account_id' => myself()->_getAccountId(),
|
|
||||||
'period' => $period,
|
|
||||||
'task_id' => $taskId
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'modifytime' => myself()->_getNowTime()
|
|
||||||
),
|
|
||||||
array(
|
array(
|
||||||
'account_id' => myself()->_getAccountId(),
|
'account_id' => myself()->_getAccountId(),
|
||||||
'period' => $period,
|
'period' => $period,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user