功能:职务奖励金币发放系统
数据库: - positions 新增 daily_reward_limit(单日累计上限) - positions 新增 recipient_daily_limit(同一接收者每日次数上限) 后端: - CurrencySource::POSITION_REWARD 新枚举值 - AdminCommandController::reward() 三层限额校验 ① 单次上限 ② 单日累计上限 ③ 同一接收者每日次数 写履职记录(PositionAuthorityLog)+ UserCurrencyService 聊天室悄悄话通知接收者 - POST /command/reward 路由注册 前端(user-actions.blade.php): - 名片按钮行 2+1 布局(加好友/送礼物/送金币) - 送金币仅在 myMaxReward>0 时显示(职务持有者) - 内联奖励金币面板:金额输入 + 确认发放 + 说明文字 - sendReward() 前端校验 + API 调用 + chatDialog 反馈 后台(positions/index): - 编辑表单新增两个奖励限额字段 - PositionController 验证规则同步更新
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 文件功能:为 positions 表补充奖励限额字段
|
||||
*
|
||||
* 新增字段:
|
||||
* - daily_reward_limit : 操作人单日累计最多可发放的金币总量(null = 不限)
|
||||
* - recipient_daily_limit: 同一接收者每天最多可接收该职务奖励的次数(null = 不限)
|
||||
*/
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* 执行迁移
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('positions', function (Blueprint $table) {
|
||||
// 操作人单日累计发放金币上限(null=不限)
|
||||
$table->unsignedInteger('daily_reward_limit')
|
||||
->nullable()
|
||||
->after('max_reward')
|
||||
->comment('操作人单日累计可发奖励金币上限(null=不限)');
|
||||
|
||||
// 同一接收者每日最多收到本职务奖励的次数(null=不限)
|
||||
$table->unsignedSmallInteger('recipient_daily_limit')
|
||||
->nullable()
|
||||
->after('daily_reward_limit')
|
||||
->comment('同一接收者每天最多可接收本职务奖励次数(null=不限)');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 回滚迁移
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('positions', function (Blueprint $table) {
|
||||
$table->dropColumn(['daily_reward_limit', 'recipient_daily_limit']);
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user