79 lines
1.9 KiB
PHP

<?php
namespace app\api\lists\user_sign;
use app\api\lists\BaseApiDataLists;
use app\common\model\user_label\UserLabel;
use app\common\lists\ListsSearchInterface;
use app\common\logic\UserSignLogic;
use app\common\model\user_ship\UserShip;
use app\common\model\user_sign\UserSign;
/**
* 积分列表
* Class UserSignLists
* @package app\api\user_sign
*/
class UserSignLists extends BaseApiDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author admin
* @date 2024/06/17 17:02
*/
public function setSearch(): array
{
return [
];
}
/**
* @notes 获取用户标签列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author admin
* @date 2024/06/17 17:02
*/
public function lists(): array
{
$type=$this->request->get('type',1);
$mark=$this->request->get('mark','');
if($type==1){
$this->searchWhere[]=['type','in',[4,9,8,2]];
$this->searchWhere[]=['status','=',1];
}
if($mark==1){
$this->searchWhere[]=['financial_pm','=',1];
}elseif($mark==2){
$this->searchWhere[]=['financial_pm','=',0];
}
$list=UserSign::where($this->searchWhere)->order('id desc')
->limit($this->limitOffset, $this->limitLength)
->select()->each(function ($item){
$item['title']=UserSignLogic::getTitle($item['type'],$item['number']);
return $item;
});
return $list?->toArray();
}
/**
* @notes 获取用户标签数量
* @return int
* @author admin
* @date 2024/06/17 17:02
*/
public function count(): int
{
return UserLabel::where($this->searchWhere)->count();
}
}