批零提现时,保存最近的管理者信息
parent
e51d8de60c
commit
2fcd925831
|
|
@ -118,6 +118,9 @@ class DealerController extends AdminController
|
||||||
$column->row(Show::make($id, $builder, function (Show $show) {
|
$column->row(Show::make($id, $builder, function (Show $show) {
|
||||||
// $show->field('id');
|
// $show->field('id');
|
||||||
$show->field('user.phone');
|
$show->field('user.phone');
|
||||||
|
$show->field('userInfo.nickname')->as(function () {
|
||||||
|
return $this->userInfo->nickname;
|
||||||
|
});
|
||||||
$show->field('lvl')->as(function () {
|
$show->field('lvl')->as(function () {
|
||||||
return $this->lvl->text();
|
return $this->lvl->text();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ class DealerWalletToBankLogController extends AdminController
|
||||||
*/
|
*/
|
||||||
protected function grid()
|
protected function grid()
|
||||||
{
|
{
|
||||||
$builder = DealerWalletToBankLog::with(['user']);
|
$builder = DealerWalletToBankLog::with(['user', 'managerUserInfo']);
|
||||||
return Grid::make($builder, function (Grid $grid) {
|
return Grid::make($builder, function (Grid $grid) {
|
||||||
$grid->tools(function (Grid\Tools $tools) {
|
$grid->tools(function (Grid\Tools $tools) {
|
||||||
$tools->append(new DealerWalletWithdraw());
|
$tools->append(new DealerWalletWithdraw());
|
||||||
|
|
@ -37,6 +37,13 @@ class DealerWalletToBankLogController extends AdminController
|
||||||
$grid->column('rate')->append('%');
|
$grid->column('rate')->append('%');
|
||||||
$grid->column('service_amount')->prepend('¥');
|
$grid->column('service_amount')->prepend('¥');
|
||||||
$grid->column('account_amount')->prepend('¥');
|
$grid->column('account_amount')->prepend('¥');
|
||||||
|
$grid->column('manager_id')->display(function () {
|
||||||
|
if ($this->managerUserInfo) {
|
||||||
|
$href = admin_route('dealers.show', ['dealer_user' => $this->manager_id]);
|
||||||
|
|
||||||
|
return "<a href=\"{$href}\" target=\"_blank\">{$this->managerUserInfo->nickname}</a>";
|
||||||
|
}
|
||||||
|
});
|
||||||
$grid->column('status')->display(function ($v) {
|
$grid->column('status')->display(function ($v) {
|
||||||
$text = $v->text();
|
$text = $v->text();
|
||||||
$background = $v->color();
|
$background = $v->color();
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,7 @@ class WalletController extends Controller
|
||||||
'rate' => $rate,
|
'rate' => $rate,
|
||||||
'service_amount' => bcdiv($serviceAmount, 100, 2),
|
'service_amount' => bcdiv($serviceAmount, 100, 2),
|
||||||
'account_amount' => bcdiv($amount - $serviceAmount, 100, 2),
|
'account_amount' => bcdiv($amount - $serviceAmount, 100, 2),
|
||||||
|
'manager_id' => $user->dealer->firstManager()?->user_id,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
//减去用户可提金额
|
//减去用户可提金额
|
||||||
|
|
|
||||||
|
|
@ -136,6 +136,24 @@ class Dealer extends Model
|
||||||
})->all();
|
})->all();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取经销商最近的管理者
|
||||||
|
*
|
||||||
|
* @return static|null
|
||||||
|
*/
|
||||||
|
public function firstManager(): ?static
|
||||||
|
{
|
||||||
|
if (empty($pids = $this->userInfo->parent_ids)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$manager = UserInfo::whereHas('dealer', function ($builder) {
|
||||||
|
$builder->where('is_manager', true);
|
||||||
|
})->whereIn('user_id', $pids)->latest('depth')->first();
|
||||||
|
|
||||||
|
return $manager?->dealer;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取直属金牌经销商数量
|
* 获取直属金牌经销商数量
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ class DealerWalletToBankLog extends Model
|
||||||
'pay_way',
|
'pay_way',
|
||||||
'pay_at',
|
'pay_at',
|
||||||
'failed_reason',
|
'failed_reason',
|
||||||
|
'manager_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -59,6 +60,11 @@ class DealerWalletToBankLog extends Model
|
||||||
return $this->belongsTo(Dealer::class, 'user_id', 'user_id');
|
return $this->belongsTo(Dealer::class, 'user_id', 'user_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function managerUserInfo()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(UserInfo::class, 'manager_id', 'user_id');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 待打款状态
|
* 待打款状态
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class AddManagerIdToDealerWalletToBankLogsTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('dealer_wallet_to_bank_logs', function (Blueprint $table) {
|
||||||
|
$table->unsignedBigInteger('manager_id')->nullable()->comment('管理者UID');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('dealer_wallet_to_bank_logs', function (Blueprint $table) {
|
||||||
|
$table->dropColumn(['manager_id']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -19,6 +19,7 @@ return [
|
||||||
'remarks' => '备注',
|
'remarks' => '备注',
|
||||||
'failed_reason' => '失败原因',
|
'failed_reason' => '失败原因',
|
||||||
'pay_way' => '支付方式',
|
'pay_way' => '支付方式',
|
||||||
|
'manager_id' => '管理者',
|
||||||
],
|
],
|
||||||
'options' => [
|
'options' => [
|
||||||
],
|
],
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue