调整后台修改老配额
parent
0791f685e2
commit
a557725c91
|
|
@ -63,7 +63,7 @@ class QuotaV1Deduction extends Form implements LazyRenderable
|
|||
public function form()
|
||||
{
|
||||
$this->select('user_id', '用户手机号')->ajax(admin_route('api.users'))->required();
|
||||
$this->currency('change_balance', '扣减配额')->symbol('¥')->required();
|
||||
$this->currency('change_balance', '扣减配额')->digits(3)->symbol('¥')->required();
|
||||
$this->confirm('是否确认扣减?', '提交后该动作无法逆转');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class QuotaV1Recharge extends Form implements LazyRenderable
|
|||
public function form()
|
||||
{
|
||||
$this->select('user_id', '用户手机号')->ajax(admin_route('api.users'))->required();
|
||||
$this->currency('change_balance', '增加配额')->symbol('¥')->required();
|
||||
$this->currency('change_balance', '增加配额')->digits(3)->required();
|
||||
$this->confirm('是否确认增加老配额?', '提交后该动作无法逆转');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,4 +11,17 @@ class QuotaV1Log extends Model
|
|||
|
||||
public const ACTION_ADMIN_RECHARGE = 7;
|
||||
public const ACTION_ADMIN_DEDUCTION = 8;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'loggable_id',
|
||||
'loggable_type',
|
||||
'action',
|
||||
'before_balance',
|
||||
'change_balance',
|
||||
'remarks',
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -368,6 +368,14 @@ class User extends Model implements AuthorizableContract, AuthenticatableContrac
|
|||
return $this->hasMany(QuotaLog::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户的配额日志
|
||||
*/
|
||||
public function quotaV1Logs()
|
||||
{
|
||||
return $this->hasMany(QuotaV1Log::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 属于此用户的团队销售值(含自己的销售值)
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class QuotaV1Service
|
|||
$user->userInfo()->decrement('quota_v1', $_changeBalance);
|
||||
}
|
||||
|
||||
$user->walletLogs()->create([
|
||||
$user->quotaV1Logs()->create([
|
||||
'loggable_id' => $loggable?->id,
|
||||
'loggable_type' => $loggable?->getMorphClass(),
|
||||
'before_balance' => $beforeBalance,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class ChangeBeforeBalanceToQuotaV1LogsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('quota_v1_logs', function (Blueprint $table) {
|
||||
$table->string('before_balance', 12, 3)->change();
|
||||
$table->decimal('change_balance', 12, 3)->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('quota_v1_logs', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue