优化
This commit is contained in:
@@ -31,6 +31,8 @@ public class AppMemberProfileController {
|
||||
public CommonResult<MemberUserProfileDO> getProfile() {
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
MemberUserProfileDO profile = memberUserProfileService.createIfAbsent(userId);
|
||||
// 更新最后登录时间
|
||||
memberUserProfileService.updateLastLoginTime(userId);
|
||||
return success(profile);
|
||||
}
|
||||
|
||||
|
||||
@@ -98,4 +98,11 @@ public interface MemberUserProfileService {
|
||||
*/
|
||||
boolean decreaseUsedStorage(String userId, long fileSizeBytes);
|
||||
|
||||
/**
|
||||
* 更新最后登录时间
|
||||
*
|
||||
* @param userId 用户ID
|
||||
*/
|
||||
void updateLastLoginTime(Long userId);
|
||||
|
||||
}
|
||||
@@ -160,4 +160,15 @@ public class MemberUserProfileServiceImpl implements MemberUserProfileService {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -106,12 +106,23 @@
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column label="用户编号" align="center" prop="userId" />
|
||||
<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="balance" />
|
||||
<el-table-column label="变动原因" align="center" prop="reason" />
|
||||
<!-- (signin-签到 recharge-充值 exchange-兑换 admin-后台调整 gift-礼包赠送) -->
|
||||
<el-table-column label="业务类型" align="center" prop="bizType" />
|
||||
<el-table-column label="变动原因" align="center" prop="reason">
|
||||
<template #default="scope">
|
||||
{{ 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="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" min-width="120px">
|
||||
@@ -157,6 +168,34 @@ import PointRecordForm from './PointRecordForm.vue'
|
||||
/** 积分记录 列表 */
|
||||
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 { t } = useI18n() // 国际化
|
||||
|
||||
|
||||
Reference in New Issue
Block a user