php管理和接口
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

36 lines
1.1 KiB

<?php
namespace app\admin\model;
use app\common\model\TimeModel;
class UserPointsLog extends TimeModel
{
protected static function indexWhere(&$where)
{
if ($where) {
foreach ($where as $key => $w) {
if ($w[0] == 'username') {
$uid = User::where('nick_name', $w[1], $w[2])->column('uid');
$where[$key] = ['uid', 'in', $uid ?: [0]];
}
}
}
}
public static function getPageList(array $param = [], array $where = [], $field = '*'): array
{
$page = $param['page'] ?? 1;
$limit = $param['limit'] ?? 10;
self::indexWhere($where);
$order = 'id desc';
$count = self::where($where)->count();
$list = self::where($where)->field($field)->order($order)->page($page, $limit)->select()->toArray();
foreach ($list as &$item) {
$item['username'] = User::getUserValue($item['uid']);
$item['avatar'] = User::getUserValue($item['uid'], 'avatar');
}
return ['data' => $list, 'count' => $count];
}
}