first commit

This commit is contained in:
Your Name
2026-01-19 14:19:22 +08:00
commit fe2d9c1868
4777 changed files with 665503 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\api\lists;
use app\common\lists\BaseDataLists;
abstract class BaseApiDataLists extends BaseDataLists
{
protected array $userInfo = [];
protected int $userId = 0;
public string $export;
public function __construct()
{
parent::__construct();
if (isset($this->request->userInfo) && $this->request->userInfo) {
$this->userInfo = $this->request->userInfo;
$this->userId = $this->request->userId;
}
$this->export = $this->request->get('export', '');
}
}

View File

@@ -0,0 +1,79 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\api\lists\article;
use app\api\lists\BaseApiDataLists;
use app\common\enum\YesNoEnum;
use app\common\model\article\Article;
/**
* 文章收藏列表
* Class ArticleCollectLists
* @package app\api\lists\article
*/
class ArticleCollectLists extends BaseApiDataLists
{
/**
* @notes 获取收藏列表
* @return array
* @author 段誉
* @date 2022/9/20 16:29
*/
public function lists(): array
{
$field = "c.id,c.article_id,a.title,a.image,a.desc,a.is_show,
a.click_virtual, a.click_actual,a.create_time, c.create_time as collect_time";
$lists = (new Article())->alias('a')
->join('article_collect c', 'c.article_id = a.id')
->field($field)
->where([
'c.user_id' => $this->userId,
'c.status' => YesNoEnum::YES,
'a.is_show' => YesNoEnum::YES,
])
->order(['sort' => 'desc', 'c.id' => 'desc'])
->limit($this->limitOffset, $this->limitLength)
->append(['click'])
->hidden(['click_virtual', 'click_actual'])
->select()->toArray();
foreach ($lists as &$item) {
$item['collect_time'] = date('Y-m-d H:i', $item['collect_time']);
}
return $lists;
}
/**
* @notes 获取收藏数量
* @return int
* @author 段誉
* @date 2022/9/20 16:29
*/
public function count(): int
{
return (new Article())->alias('a')
->join('article_collect c', 'c.article_id = a.id')
->where([
'c.user_id' => $this->userId,
'c.status' => YesNoEnum::YES,
'a.is_show' => YesNoEnum::YES,
])
->count();
}
}

View File

@@ -0,0 +1,107 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\api\lists\article;
use app\api\lists\BaseApiDataLists;
use app\common\enum\YesNoEnum;
use app\common\lists\ListsSearchInterface;
use app\common\model\article\Article;
use app\common\service\{FileService,UtilsService};
/**
* 文章列表
* Class ArticleLists
* @package app\api\lists\article
*/
class ArticleLists extends BaseApiDataLists implements ListsSearchInterface
{
/**
* @notes 搜索条件
* @return \string[][]
* @author 段誉
* @date 2022/9/16 18:54
*/
public function setSearch(): array
{
return [
'=' => ['cid']
];
}
/**
* @notes 自定查询条件
* @return array
* @author 段誉
* @date 2022/10/25 16:53
*/
public function queryWhere()
{
$where[] = ['is_show', '=', 1];
return $where;
}
/**
* @notes 获取文章列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/9/16 18:55
*/
public function lists(): array
{
$lang = $this->params['lang'];
$field = 'id,title,image,langs';
$result = Article::field($field)
->where($this->queryWhere())
->where($this->searchWhere)
->order(['sort' => 'desc', 'id' => 'desc'])
->limit($this->limitOffset, $this->limitLength)
->select()->toArray();
foreach ($result as &$article) {
//多语言替换
$data = UtilsService::get_langs_data($article['langs'],$lang);
$data_title = '';
if(count($data) > 0){
$data_title = $data['title'];
}
$article['title'] = $data_title;
unset($article['langs']);
}
return $result;
}
/**
* @notes 获取文章数量
* @return int
* @author 段誉
* @date 2022/9/16 18:55
*/
public function count(): int
{
return Article::where($this->searchWhere)
->where($this->queryWhere())
->count();
}
}

View File

@@ -0,0 +1,78 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\api\lists\finance;
use app\api\lists\BaseApiDataLists;
use app\common\enum\YesNoEnum;
use app\common\model\finance\RechargeRecord;
use app\common\model\setting\Language;
/**
* 充值记录列表
* Class RechargeRecordLists
* @package app\api\lists\finance
*/
class RechargeRecordLists extends BaseApiDataLists
{
/**
* @notes 获取充值记录列表
* @return array
*@author bd
* @date 2024/01/31 14:07
*/
public function lists(): array
{
$field = 'id,sn,method_id,amount,amount_act,rate,symbol,status,create_time';
$lists = RechargeRecord::field($field)
->append(['method_name'])
->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
{
return RechargeRecord::where([
'user_id' => $this->userId,
])
->count();
}
}

View File

@@ -0,0 +1,89 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\api\lists\finance;
use app\api\lists\BaseApiDataLists;
use app\common\model\finance\UserFinance;
use app\common\model\setting\Language;
/**
* 充值记录列表
* Class UserFinanceLists
* @package app\api\lists\finance
*/
class UserFinanceLists extends BaseApiDataLists
{
/**
* @notes 获取充值记录列表
* @return array
*@author bd
* @date 2024/01/31 14:07
*/
public function lists(): array
{
$where = '1 = 1';
if( $this->params['action'] == 1){
$where = ' action = 1 ';
}else if( $this->params['action'] == 2){
$where = ' action = 2 ';
}
if( $this->params['frozen'] == 1){
$where .= ' AND frozen = 1 ';
}
$field = 'id,sn,change_type as type,change_amount as amount,remark,action,create_time';
$lists = UserFinance::field($field)
->where($where)
->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
{
return UserFinance::where([
'user_id' => $this->userId,
])
->count();
}
}

View File

@@ -0,0 +1,74 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\api\lists\finance;
use app\api\lists\BaseApiDataLists;
use app\common\service\{UtilsService,FileService};
use app\common\model\finance\UserTransferRecord;
use app\common\model\setting\Language;
/**
* 转账记录列表
* Class UserTransferRecordLists
* @package app\api\lists\finance
*/
class UserTransferRecordLists extends BaseApiDataLists
{
/**
* @notes 获取转账记录列表
* @return array
*@author bd
* @date 2024/01/31 14:07
*/
public function lists(): array
{
$field = 'id,sn,user_id,user_id_from,user_id_to,amount,type,create_time';
$lists = UserTransferRecord::field($field)
->append(['users_info'])
->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
{
return UserTransferRecord::where(['user_id' => $this->userId])->count();
}
}

View File

@@ -0,0 +1,84 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\api\lists\finance;
use app\api\lists\BaseApiDataLists;
use app\common\enum\YesNoEnum;
use app\common\model\finance\WithdrawRecord;
use app\common\model\setting\Language;
/**
* 提现记录列表
* Class WithdrawRecordLists
* @package app\api\lists\finance
*/
class WithdrawRecordLists extends BaseApiDataLists
{
/**
* @notes 获取提现记录列表
* @return array
*@author bd
* @date 2024/01/31 14:07
*/
public function lists(): array
{
$field = 'id,sn,method_id,amount,amount_act,rate,symbol,status,create_time,account,type,remark,charge';
$lists = WithdrawRecord::field($field)
->append(['method_name'])
->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']));
if($item['type'] == 2){
$item['account'] = substr($item['account'],0,3).'******'.substr($item['account'],strlen($item['account'])-3,strlen($item['account']));
$item['account'] = $item['method_name'].'('.$item['account'].')';
}else{
$item['account'] = substr($item['account'],0,4).'******'.substr($item['account'],strlen($item['account'])-4,strlen($item['account']));
$item['account'] = $item['method_name'].'('.$item['account'].')';
}
}
return $lists;
}
/**
* @notes 获取提现记录数量
* @return int
* @author bd
* @date 2024/01/31 14:07
*/
public function count(): int
{
return WithdrawRecord::where([
'user_id' => $this->userId,
])
->count();
}
}

View File

@@ -0,0 +1,82 @@
<?php
namespace app\api\lists\goods;
use app\api\lists\BaseApiDataLists;
use app\common\enum\YesNoEnum;
use app\common\model\goods\GoodsRecord;
use app\common\model\setting\Language;
/**
* 抢单记录列表
* Class GoodsRecordLists
* @package app\api\lists\goods
*/
class GoodsRecordLists extends BaseApiDataLists
{
/**
* @notes 获取抢单记录列表
* @return array
*@author bd
* @date 2024/01/31 14:07
*/
public function lists(): array
{
$time = strtotime($this->params['date']) - time();
$where = '1 = 1';
if( $this->params['status'] != 0){
$status = $this->params['status'] ;
$where = " status = $status ";
}
$field = 'id,sn,goods_title as title,goods_image as image,money,commission,status,pay_time,create_time';
$lists = GoodsRecord::field($field)
->where($where)
->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']) + $time);
if($item['pay_time']) $item['pay_time'] = date($timeFormat, $item['pay_time'] + $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 GoodsRecord::where([
'user_id' => $this->userId,
])
->where($where)
->count();
}
}

View File

@@ -0,0 +1,88 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\api\lists\item;
use app\api\lists\BaseApiDataLists;
use app\common\service\{UtilsService,FileService};
use app\common\model\item\ItemRecord;
use app\common\model\setting\Language;
/**
* 投资记录列表
* Class ItemRecordLists
* @package app\api\lists\item
*/
class ItemRecordLists extends BaseApiDataLists
{
/**
* @notes 获取投资记录列表
* @return array
*@author bd
* @date 2024/01/31 14:07
*/
public function lists(): array
{
$field = 'id,sn,contract_no,item_title,item_image,item_langs,money,point,rate,total_income,cycle,type,status,create_time,end_time';
$lists = ItemRecord::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) {
//多语言替换
$data = UtilsService::get_langs_data($item['item_langs'], $this->params['lang']);
$data_title = '';
$data_image = '';
if(count($data) > 0){
$data_title = $data['title'];
$data_image = $data['image'];
}
$item['item_title'] = $data_title;
$item['item_image'] = FileService::getFileUrl($data_image);
unset($item['item_langs']);
$item['create_time'] = date($timeFormat, strtotime($item['create_time']));
$item['end_time'] = date($timeFormat, $item['end_time']);
}
return $lists;
}
/**
* @notes 获取投资记录数量
* @return int
* @author bd
* @date 2024/01/31 14:07
*/
public function count(): int
{
return ItemRecord::where(['user_id' => $this->userId])->count();
}
}

View 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();
}
}

View File

@@ -0,0 +1,89 @@
<?php
namespace app\api\lists\mall;
use app\api\lists\BaseApiDataLists;
use app\common\enum\YesNoEnum;
use app\common\service\{UtilsService,FileService};
use app\common\model\mall\MallGoodsRecord;
use app\common\model\setting\Language;
/**
* 奖品记录列表
* Class MallGoodsRecordLists
* @package app\api\lists\mall
*/
class MallGoodsRecordLists extends BaseApiDataLists
{
/**
* @notes 获取奖品记录列表
* @return array
*@author bd
* @date 2024/01/31 14:07
*/
public function lists(): array
{
$where = ' type = 1 ';
if( $this->params['type'] != 1){
$type = $this->params['type'] ;
$where = " type = $type ";
}
$field = 'id,sn,m_goods_title as title,m_goods_image as image,m_goods_langs,price,type,type2,create_time';
$lists = MallGoodsRecord::field($field)
->where($where)
->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) {
//多语言替换
$data = UtilsService::get_langs_data($item['m_goods_langs'], $this->params['lang']);
$data_title = '';
if(count($data) > 0){
$data_title = $data['title'];
}
$item['title'] = $data_title;
unset($item['m_goods_langs']);
$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 = ' type = 1 ';
if( $this->params['type'] != 1){
$type = $this->params['type'] ;
$where = " type = $type ";
}
return MallGoodsRecord::where([
'user_id' => $this->userId,
])
->where($where)
->count();
}
}

View File

@@ -0,0 +1,90 @@
<?php
namespace app\api\lists\team;
use app\api\lists\BaseApiDataLists;
use app\common\model\user\{User,UserRelation};
use app\common\model\setting\Language;
use app\common\service\{UtilsService,FileService};
/**
* 抢单记录列表
* Class TeamUserLists
* @package app\api\lists\team
*/
class TeamUserLists extends BaseApiDataLists
{
/**
* @notes 获取抢单记录列表
* @return array
*@author bd
* @date 2024/01/31 14:07
*/
public function lists(): array
{
$distributeLevel = UtilsService::get_distribute_level();
$level = $this->params['level'] ;
$where = " ur.level = $level ";
$field = 'ur.id as ur_id,ur.level,ur.create_time';
$field .= ',u.id,u.sn,u.mobile,u.total_income_invest,u.total_recharge,u.total_withdraw';
$lists = User::alias('u')
->join('user_relation ur', 'u.id = ur.user_id')
->field($field)
->append(['team_num','item_num'])
->where($where)
->where([
'ur.parent_id' => $this->userId,
])
->where(" level <= $distributeLevel ")
->limit($this->limitOffset, $this->limitLength)
->order(['ur.create_time' => 'desc','ur.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) {
if($level != 1){
$item['mobile'] = substr_replace($item['mobile'], str_repeat('*', 4), 2, 4);
}
$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
{
$distributeLevel = UtilsService::get_distribute_level();
$where = '1 = 1';
if( $this->params['level'] != 0){
$level = $this->params['level'] ;
$where = " ur.level = $level ";
}
return User::alias('u')
->join('user_relation ur', 'u.id = ur.user_id')
->where($where)
->where([
'ur.parent_id' => $this->userId,
])
->count();
}
}

View 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();
}
}

View 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();
}
}