改进 推介系统

This commit is contained in:
iVampireSP.com 2023-02-23 09:40:40 +08:00
parent 16cec5c737
commit 381fcf3938
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132
4 changed files with 38 additions and 13 deletions

View File

@ -16,9 +16,9 @@ class AffiliateController extends Controller
/** /**
* Display a listing of the resource. * Display a listing of the resource.
*/ */
public function index(): View|RedirectResponse public function index(Request $request): View|RedirectResponse
{ {
$user = auth()->user(); $user = $request->user('web');
$user->load('affiliate'); $user->load('affiliate');
$affiliate = $user->affiliate; $affiliate = $user->affiliate;
@ -36,9 +36,9 @@ public function index(): View|RedirectResponse
/** /**
* Show the form for creating a new resource. * Show the form for creating a new resource.
*/ */
public function create(): View|RedirectResponse public function create(Request $request): View|RedirectResponse
{ {
$user = auth('web')->user(); $user = $request->user('web');
$user->load('affiliate', 'affiliateUser.affiliate.user'); $user->load('affiliate', 'affiliateUser.affiliate.user');
if ($user->affiliate) { if ($user->affiliate) {

View File

@ -4,7 +4,7 @@
'billing' => [ 'billing' => [
'commission' => '0.1', 'commission' => '0.1',
// 推介佣金比例 // 推介佣金比例
'commission_referral' => '0.05', 'commission_referral' => '0.8',
], ],
'wecom' => [ 'wecom' => [
'robot_hook' => [ 'robot_hook' => [

View File

@ -6,9 +6,14 @@
<h3>加入推介计划</h3> <h3>加入推介计划</h3>
<p> <p>
让更多人用上我们的产品,您将从他们实认证成功之后的每笔充值中获取 {{ config('settings.billing.commission_referral') * 100 . '%' }} 让更多人用上我们的产品,您将从他们实认证成功之后的每笔充值中获取 {{ config('settings.billing.commission_referral') * 100 . '%' }}
的佣金。</p> 的佣金。</p>
{{-- @php($amount = 1)--}}
{{-- <p>比如,下属用户在实人认证成功后充值了 {{$amount}}--}}
{{-- 元,您将获得 {{ $amount / (config('settings.billing.commission_referral') * 100) }} 元的佣金。</p>--}}
@if ($user->affiliate_id) @if ($user->affiliate_id)
<span>您被 {{ $user->affiliateUser->affiliate->user->name }}#{{ $user->affiliateUser->affiliate->user_id }} 引荐。</span> <span>您被 {{ $user->affiliateUser->affiliate->user->name }}#{{ $user->affiliateUser->affiliate->user_id }} 引荐。</span>
@if ($user->affiliateUser->affiliate->revenue > 5) @if ($user->affiliateUser->affiliate->revenue > 5)
@ -18,7 +23,7 @@
<form class="mt-3" method="post" action="{{ route('affiliates.store') }}"> <form class="mt-3" method="post" action="{{ route('affiliates.store') }}">
@csrf @csrf
<button type="submit" class="btn btn-primary">加入推介计划</button> <button type="submit" class="btn btn-sm btn-primary">加入推介计划</button>
</form> </form>
@endsection @endsection

View File

@ -3,6 +3,7 @@
@section('title', '推介计划') @section('title', '推介计划')
@section('content') @section('content')
@php($url = \Illuminate\Support\Facades\URL::route('affiliates.show', $affiliate->uuid))
<h3>推介计划</h3> <h3>推介计划</h3>
@ -13,16 +14,17 @@
盈利:{{ $affiliate->revenue }} 盈利:{{ $affiliate->revenue }}
</p> </p>
<p>推介 URL: {{ \Illuminate\Support\Facades\URL::route('affiliates.show', $affiliate->uuid) }}</p> <p>推介 URL: {{ $url }}</p>
<h3>用户列表</h3>
@php($count = $affiliateUsers->count()) @php($count = $affiliateUsers->count())
@if ($count) @if ($count)
<h4>用户列表</h4>
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
<th scope="col">用户名</th> <th scope="col">用户名</th>
<th scope="col">盈利</th> <th scope="col">盈利</th>
<th scope="col">实人状态</th>
<th scope="col">注册时间</th> <th scope="col">注册时间</th>
</tr> </tr>
</thead> </thead>
@ -31,22 +33,40 @@
<tr> <tr>
<td>{{ $user->user->name }}</td> <td>{{ $user->user->name }}</td>
<td>{{ $user->revenue }} </td> <td>{{ $user->revenue }} </td>
<td>
@if ($user->real_name_verified_at)
完成
@else
<span class="text-danger">未完成</span>
@endif
</td>
<td>{{ $user->created_at }}</td> <td>{{ $user->created_at }}</td>
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>
</table> </table>
{{ $affiliateUsers->links() }} {{ $affiliateUsers->links() }}
@else
<p>您还没有推介用户。</p>
@endif @endif
<h4>广告词</h4>
<p>您可以定义一个广告词来收获更多的用户。让新用户访问您的推介 URL 并完成注册,您就会获得一个下属用户。</p>
<h4>金额到账时间</h4>
<p>
当您的下属用户完成实人认证后并充值,之后的充值所获得的佣金将会立即到您的余额。
</p>
<h4>佣金计算方式</h4>
<p>佣金 = 下属用户充值总额 / ({{config('settings.billing.commission_referral')}} * 100)</p>
<h4>离开推介计划</h4> <h4>离开推介计划</h4>
<form method="post" action="{{ route('affiliates.destroy', $affiliate->id) }}" <form method="post" action="{{ route('affiliates.destroy', $affiliate->id) }}"
onclick="return confirm('删除后将不会获得收益,推介数据也会被删除。')"> onclick="return confirm('离开除后将不会获得收益,关联的推介数据也会被删除。')">
@csrf @csrf
@method('DELETE') @method('DELETE')
<button type="submit" class="btn btn-danger">删除推介计划</button> <button type="submit" class="btn btn-sm btn-danger">离开</button>
</form> </form>
@endsection @endsection