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