first commit
This commit is contained in:
70
app/api/lists/lh/LhRecordLists.php
Normal file
70
app/api/lists/lh/LhRecordLists.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
namespace app\api\lists\lh;
|
||||
|
||||
use app\api\lists\BaseApiDataLists;
|
||||
use app\common\enum\YesNoEnum;
|
||||
use app\common\model\lh\LhRecord;
|
||||
use app\common\model\setting\Language;
|
||||
|
||||
/**
|
||||
* 量化记录列表
|
||||
* Class LhRecordLists
|
||||
* @package app\api\lists\lh
|
||||
*/
|
||||
class LhRecordLists extends BaseApiDataLists
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 获取量化记录列表
|
||||
* @return array
|
||||
*@author bd
|
||||
* @date 2024/01/31 14:07
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
|
||||
$field = 'id,sn,user_id,coin_name,coin_logo,coin_symbol,coin_buy_name,coin_sale_name,money,income,money_buy,money_sale,create_time';
|
||||
$lists = LhRecord::field($field)
|
||||
->where(['user_id' => $this->userId])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['create_time' => 'desc','id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
//查询语言
|
||||
$timeFormat = 'Y-m-d H:i:s';
|
||||
$language = Language::where(['symbol' => $this->params['lang']])->findOrEmpty();
|
||||
if (!$language->isEmpty()) {
|
||||
$timeFormat = $language['time_format'];
|
||||
}
|
||||
|
||||
foreach ($lists as &$item) {
|
||||
$item['create_time'] = date($timeFormat, strtotime($item['create_time']));
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取量化记录数量
|
||||
* @return int
|
||||
* @author bd
|
||||
* @date 2024/01/31 14:07
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
$where = '1 = 1';
|
||||
|
||||
if( $this->params['status'] != 0){
|
||||
$status = $this->params['status'] ;
|
||||
$where = " status = $status ";
|
||||
}
|
||||
|
||||
return LhRecord::where([
|
||||
'user_id' => $this->userId,
|
||||
])
|
||||
->where($where)
|
||||
->count();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user