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