feat: 用户行为信誉分系统

- User 新增 credit_score 字段(0-200,默认100)
- 信誉分影响检测阈值系数:高分降低敏感度,低分提高敏感度
- 发布成功+1分,被拦截-2分;申诉通过+10分,驳回-5分
- 新增手动调整和批量重算信誉分接口
- admin-users 页面显示信誉分进度条,支持编辑调整

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
刘正航
2026-04-21 23:52:47 +08:00
parent 5279816452
commit 6d62120443
8 changed files with 166 additions and 10 deletions

View File

@@ -460,6 +460,32 @@ button.btn::after {
color: var(--sub);
}
/* 信誉分进度条 */
.credit-score-bar {
position: relative;
width: 180rpx;
height: 28rpx;
border-radius: 14rpx;
background: rgba(85, 123, 166, 0.25);
overflow: hidden;
}
.credit-fill {
height: 100%;
border-radius: inherit;
background: linear-gradient(90deg, var(--success), var(--accent));
}
.credit-value {
position: absolute;
right: 8rpx;
top: 50%;
transform: translateY(-50%);
font-size: 22rpx;
font-weight: 600;
color: #f2f7ff;
}
.chip-group {
display: flex;
flex-wrap: wrap;

View File

@@ -12,7 +12,8 @@ Page({
title: '',
phone: '',
is_admin: false,
password: ''
password: '',
credit_score: 100
},
importText: '[{"username":"operator01","password":"123456","nickname":"运营同学","company":"示例科技公司"}]'
},
@@ -60,7 +61,8 @@ Page({
title: row.title || '',
phone: row.phone || '',
is_admin: !!row.is_admin,
password: ''
password: '',
credit_score: row.credit_score || 100
}
})
},

View File

@@ -27,6 +27,13 @@
<view class="list-item" wx:for="{{users}}" wx:key="id">
<view class="item-title">{{item.nickname}}{{item.username}}</view>
<view class="item-sub">{{item.company || '未填写公司'}} · {{item.title || '未填写岗位'}} · {{item.is_admin ? '管理员' : '普通用户'}}</view>
<view class="row">
<text class="label">信誉分</text>
<view class="credit-score-bar">
<view class="credit-fill" style="width: {{(item.credit_score || 100) / 2}}%;"></view>
<text class="credit-value">{{item.credit_score || 100}}</text>
</view>
</view>
<view wx:if="{{editUserId === item.id}}">
<input class="input" placeholder="昵称" value="{{editForm.nickname}}" data-field="nickname" bindinput="onEditInput" />
@@ -34,6 +41,7 @@
<input class="input" placeholder="岗位" value="{{editForm.title}}" data-field="title" bindinput="onEditInput" />
<input class="input" placeholder="手机号" value="{{editForm.phone}}" data-field="phone" bindinput="onEditInput" />
<input class="input" placeholder="新密码(可选)" password value="{{editForm.password}}" data-field="password" bindinput="onEditInput" />
<input class="input" placeholder="信誉分0-200" type="number" value="{{editForm.credit_score}}" data-field="credit_score" bindinput="onEditInput" />
<view class="row">
<text class="label">管理员权限</text>