first commit
This commit is contained in:
61
app/api/lists/user/UserMineRecordLists.php
Normal file
61
app/api/lists/user/UserMineRecordLists.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
namespace app\api\lists\user;
|
||||
|
||||
use app\api\lists\BaseApiDataLists;
|
||||
use app\common\enum\YesNoEnum;
|
||||
use app\common\model\user\UserMineRecord;
|
||||
use app\common\model\setting\Language;
|
||||
use app\common\service\{FileService,UtilsService};
|
||||
|
||||
/**
|
||||
* 挖矿记录列表
|
||||
* Class UserMineRecordLists
|
||||
* @package app\api\lists\user
|
||||
*/
|
||||
class UserMineRecordLists extends BaseApiDataLists
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 获取挖矿记录列表
|
||||
* @return array
|
||||
*@author bd
|
||||
* @date 2024/01/31 14:07
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
|
||||
$field = 'id,amount,amount_act,symbol,rate,precision,start_time,create_time';
|
||||
$lists = UserMineRecord::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['start_time'] = date($timeFormat, $item['start_time']);
|
||||
$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
|
||||
{
|
||||
return UserMineRecord::where(['user_id' => $this->userId])->count();
|
||||
}
|
||||
}
|
||||
73
app/api/lists/user/UserNoticeLists.php
Normal file
73
app/api/lists/user/UserNoticeLists.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
namespace app\api\lists\user;
|
||||
|
||||
use app\api\lists\BaseApiDataLists;
|
||||
use app\common\enum\YesNoEnum;
|
||||
use app\common\model\user\UserNotice;
|
||||
use app\common\model\setting\Language;
|
||||
use app\common\service\{FileService,UtilsService};
|
||||
|
||||
/**
|
||||
* 用户消息列表
|
||||
* Class UserNoticeLists
|
||||
* @package app\api\lists\user
|
||||
*/
|
||||
class UserNoticeLists extends BaseApiDataLists
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 获取用户消息列表
|
||||
* @return array
|
||||
*@author bd
|
||||
* @date 2024/01/31 14:07
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
|
||||
$field = 'id,title,content,read,langs,create_time';
|
||||
$lists = UserNotice::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']));
|
||||
//多语言替换
|
||||
$data = UtilsService::get_langs_data($item['langs'],$this->params['lang']);
|
||||
$data_title = '';
|
||||
$data_content = '';
|
||||
|
||||
if(count($data) > 0){
|
||||
$data_title = $data['title'];
|
||||
$data_content = $data['content'];
|
||||
}
|
||||
|
||||
$item['title'] = get_file_domain($data_title);
|
||||
$item['content'] = get_file_domain($data_content);
|
||||
unset($item['langs']);
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取用户消息数量
|
||||
* @return int
|
||||
* @author bd
|
||||
* @date 2024/01/31 14:07
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return UserNotice::where(['user_id' => $this->userId])->count();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user