This commit is contained in:
2026-03-07 17:29:22 +08:00
parent c2e2a64416
commit f3c2bae6bf
4 changed files with 63 additions and 4 deletions

View File

@@ -31,6 +31,8 @@ public class AppMemberProfileController {
public CommonResult<MemberUserProfileDO> getProfile() { public CommonResult<MemberUserProfileDO> getProfile() {
Long userId = SecurityFrameworkUtils.getLoginUserId(); Long userId = SecurityFrameworkUtils.getLoginUserId();
MemberUserProfileDO profile = memberUserProfileService.createIfAbsent(userId); MemberUserProfileDO profile = memberUserProfileService.createIfAbsent(userId);
// 更新最后登录时间
memberUserProfileService.updateLastLoginTime(userId);
return success(profile); return success(profile);
} }

View File

@@ -98,4 +98,11 @@ public interface MemberUserProfileService {
*/ */
boolean decreaseUsedStorage(String userId, long fileSizeBytes); boolean decreaseUsedStorage(String userId, long fileSizeBytes);
/**
* 更新最后登录时间
*
* @param userId 用户ID
*/
void updateLastLoginTime(Long userId);
} }

View File

@@ -160,4 +160,15 @@ public class MemberUserProfileServiceImpl implements MemberUserProfileService {
return affectedRows > 0; return affectedRows > 0;
} }
@Override
public void updateLastLoginTime(Long userId) {
MemberUserProfileDO profile = memberUserProfileMapper.selectByUserId(userId);
if (profile != null) {
MemberUserProfileDO updateObj = new MemberUserProfileDO();
updateObj.setId(profile.getId());
updateObj.setLastLoginTime(LocalDateTime.now());
memberUserProfileMapper.updateById(updateObj);
}
}
} }

View File

@@ -106,12 +106,23 @@
<el-table-column type="selection" width="55" /> <el-table-column type="selection" width="55" />
<el-table-column label="用户编号" align="center" prop="userId" /> <el-table-column label="用户编号" align="center" prop="userId" />
<el-table-column label="手机号" align="center" prop="mobile" /> <el-table-column label="手机号" align="center" prop="mobile" />
<el-table-column label="变动类型" align="center" prop="type" /> <el-table-column label="变动类型" align="center" prop="type">
<template #default="scope">
{{ typeFormat(scope.row.type) }}
</template>
</el-table-column>
<el-table-column label="变动积分数量" align="center" prop="pointAmount" /> <el-table-column label="变动积分数量" align="center" prop="pointAmount" />
<el-table-column label="变动后余额" align="center" prop="balance" /> <el-table-column label="变动后余额" align="center" prop="balance" />
<el-table-column label="变动原因" align="center" prop="reason" /> <el-table-column label="变动原因" align="center" prop="reason">
<!-- (signin-签到 recharge-充值 exchange-兑换 admin-后台调整 gift-礼包赠送) --> <template #default="scope">
<el-table-column label="业务类型" align="center" prop="bizType" /> {{ reasonFormat(scope.row.reason) }}
</template>
</el-table-column>
<el-table-column label="业务类型" align="center" prop="bizType">
<template #default="scope">
{{ bizTypeFormat(scope.row.bizType) }}
</template>
</el-table-column>
<el-table-column label="业务关联ID" align="center" prop="bizId" /> <el-table-column label="业务关联ID" align="center" prop="bizId" />
<el-table-column label="备注" align="center" prop="remark" /> <el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" min-width="120px"> <el-table-column label="操作" align="center" min-width="120px">
@@ -157,6 +168,34 @@ import PointRecordForm from './PointRecordForm.vue'
/** 积分记录 列表 */ /** 积分记录 列表 */
defineOptions({ name: 'PointRecord' }) defineOptions({ name: 'PointRecord' })
// 格式化映射
const typeMap: Record<string, string> = {
increase: '增加',
decrease: '减少'
}
const bizTypeMap: Record<string, string> = {
signin: '签到',
recharge: '充值',
exchange: '兑换',
admin: '后台调整',
gift: '礼包赠送',
voice_tts: '语音合成',
tikhub_fetch: 'TikHub获取',
digital_human: '数字人',
dify_chat: 'AI对话'
}
const typeFormat = (type: string) => typeMap[type] || type
const bizTypeFormat = (bizType: string) => bizTypeMap[bizType] || bizType
// reason 格式化:处理 "xxx(预扣)" 格式
const reasonFormat = (reason: string) => {
if (!reason) return reason
const isPending = reason.includes('(预扣)')
const bizType = reason.replace('(预扣)', '')
const bizName = bizTypeMap[bizType] || bizType
return isPending ? `${bizName}(预扣)` : bizName
}
const message = useMessage() // 消息弹窗 const message = useMessage() // 消息弹窗
const { t } = useI18n() // 国际化 const { t } = useI18n() // 国际化