1.提交缺失的东西

This commit is contained in:
2025-05-15 15:48:31 +08:00
parent 4bbb96d217
commit 68e8a7cb16
4 changed files with 76 additions and 0 deletions

View File

@ -20,6 +20,8 @@ class BaseApiController extends BaseLikeAdminController
{
protected int $userId = 0;
protected array $userInfo = [];
protected int $page_no = 1;
protected int $page_size = 15;
public function initialize()
{

View File

@ -83,6 +83,20 @@ class UserController extends BaseApiController
$info = UserLogic::myWallet($this->userId);
return $this->success('获取成功', $info);
}
/**
* Notes:账户流水
* @author: 2021/3/10 10:13
*/
public function accountLog()
{
$source = $this->request->get('source');
$type = $this->request->get('type', 0);
$list = [];
if ($source) {
$list = UserLogic::accountLog($this->userId, $source, $type, $this->page_no, $this->page_size);
}
return $this->success('获取成功', $list);
}
/**
* @notes 修改密码

View File

@ -19,6 +19,7 @@ use app\common\{enum\notice\NoticeEnum,
enum\user\UserTerminalEnum,
enum\YesNoEnum,
logic\BaseLogic,
model\account\AccountLog,
model\user\User,
model\user\UserAuth,
service\ConfigServer,
@ -92,6 +93,46 @@ class UserLogic extends BaseLogic
return $info;
}
public static function accountLog($user_id, $source, $type, $page, $size)
{
$source_type = '';
$where[] = ['user_id', '=', $user_id];
switch ($source) {
case 1:
$source_type = AccountLog::money_change;
break;
case 2:
$source_type = AccountLog::integral_change;
break;
case 3:
$source_type = AccountLog::growth_change;
}
$where[] = ['source_type', 'in', $source_type];
if ($type) {
$where[] = ['change_type', '=', $type];
}
$accountLog = new AccountLog();
$count = $accountLog
->where($where)
->count();
$list = $accountLog
->where($where)
->page($page, $size)
->order('id desc')
->field('id,change_amount,source_type,change_type,create_time,remark')
->select();
$more = is_more($count, $page, $size); //是否有下一页
$data = [
'list' => $list,
'page_no' => $page,
'page_size' => $size,
'count' => $count,
'more' => $more
];
return $data;
}
/**
* @notes 设置用户信息