first commit
This commit is contained in:
69
app/adminapi/lists/mall/MallGoodsLists.php
Normal file
69
app/adminapi/lists/mall/MallGoodsLists.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
namespace app\adminapi\lists\mall;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\mall\MallGoods;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* 积分、抽奖奖品列表
|
||||
* Class MallGoodsLists
|
||||
* @package app\adminapi\listsmall
|
||||
*/
|
||||
class MallGoodsLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author BD
|
||||
* @date 2024/10/14 23:57
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['title', 'type', 'type2', 'is_show', 'create_time'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取积分、抽奖奖品列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author BD
|
||||
* @date 2024/10/14 23:57
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$items = MallGoods::where($this->searchWhere)
|
||||
->field(['id', 'title', 'image', 'price', 'content', 'money', 'point', 'win_rate', 'num', 'type', 'type2', 'is_show', 'sort', 'langs', 'create_time'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['type' => 'desc','sort' => 'desc','id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
foreach ($items as &$item) {
|
||||
$item['langs'] = json_decode($item['langs'], JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取积分、抽奖奖品数量
|
||||
* @return int
|
||||
* @author BD
|
||||
* @date 2024/10/14 23:57
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return MallGoods::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user