添加后台创建老配额分红
parent
ee9fd8f447
commit
55547e2f76
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
|
||||
namespace App\Admin\Actions\Grid;
|
||||
|
||||
use App\Models\QuotaV1SendJob;
|
||||
use Dcat\Admin\Actions\Response;
|
||||
use Dcat\Admin\Grid\RowAction;
|
||||
use Illuminate\Http\Request;
|
||||
use Throwable;
|
||||
|
||||
class QuotaV1SendJobStart extends RowAction
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected $title = '<i class="feather grid-action-icon icon-play-circle"></i>';
|
||||
|
||||
public function title()
|
||||
{
|
||||
if ($this->title) {
|
||||
return $this->title.' 开始任务';
|
||||
}
|
||||
|
||||
return '开始任务';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model|Authenticatable|HasPermissions|null $user
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function authorize($user): bool
|
||||
{
|
||||
return $user->can('dcat.admin.quota_v2_send_jobs.start');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the action request.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function handle(Request $request)
|
||||
{
|
||||
try {
|
||||
QuotaV1SendJob::findOrFail($this->getKey())->update([
|
||||
'status' => QuotaV1SendJob::STATUS_DOING,
|
||||
]);
|
||||
} catch (Throwable $th) {
|
||||
report($th);
|
||||
return $this->response()->error('开始失败,'.$th->getMessage())->refresh();
|
||||
}
|
||||
|
||||
return $this->response()->success('操作成功')->refresh();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|array|void
|
||||
*/
|
||||
public function confirm()
|
||||
{
|
||||
return ['确认开始执行当前任务?', '确认后将针对任务金额开始分红,无法逆转。'];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,127 @@
|
|||
<?php
|
||||
|
||||
namespace App\Admin\Controllers;
|
||||
|
||||
use App\Admin\Actions\Grid\QuotaV1SendJobStart;
|
||||
use App\Admin\Renderable\QuotaV1SendLogTable;
|
||||
use App\Admin\Repositories\QuotaV1SendJob;
|
||||
use App\Models\QuotaV1SendJob as QuotaV1SendJobModel;
|
||||
use Dcat\Admin\Admin;
|
||||
use Dcat\Admin\Form;
|
||||
use Dcat\Admin\Grid;
|
||||
use Dcat\Admin\Http\Controllers\AdminController;
|
||||
use Dcat\Admin\Layout\Content;
|
||||
use Dcat\Admin\Show;
|
||||
|
||||
class QuotaV1SendJobController extends AdminController
|
||||
{
|
||||
/**
|
||||
* Make a grid builder.
|
||||
*
|
||||
* @return Grid
|
||||
*/
|
||||
protected function grid()
|
||||
{
|
||||
$builder = QuotaV1SendJob::with('administrator');
|
||||
return Grid::make($builder, function (Grid $grid) {
|
||||
$grid->column('id')->sortable();
|
||||
$grid->column('amount')->display(function ($value) {
|
||||
return bcdiv($value, 100, 2);
|
||||
})->prepend('¥');
|
||||
$grid->column('administrator.name');
|
||||
$grid->column('status')->using(QuotaV1SendJobModel::$statusText)->dot([
|
||||
0=>'primary',
|
||||
1=> 'warning',
|
||||
2=>'success',
|
||||
]);
|
||||
$grid->column('remarks');
|
||||
$grid->column('created_at')->sortable();
|
||||
|
||||
$grid->model()->orderBy('created_at', 'desc');
|
||||
|
||||
/** 操作 **/
|
||||
//新增
|
||||
if (Admin::user()->can('dcat.admin.quota_v1_send_jobs.create')) {
|
||||
$grid->disableCreateButton(false);
|
||||
$grid->enableDialogCreate();
|
||||
}
|
||||
//修改
|
||||
$grid->showQuickEditButton(Admin::user()->can('dcat.admin.quota_v1_send_jobs.edit'));
|
||||
//删除以及自定义操作
|
||||
$grid->actions(function (Grid\Displayers\Actions $actions) {
|
||||
if ($actions->row->status === 0) {
|
||||
$actions->disableDelete(Admin::user()->cannot('dcat.admin.quota_v1_send_jobs.destroy'));
|
||||
if (Admin::user()->can('dcat.admin.quota_v1_send_jobs.start')) {
|
||||
$actions->append(new QuotaV1SendJobStart());
|
||||
}
|
||||
} else {
|
||||
if (Admin::user()->can('dcat.admin.quota_v1_send_jobs.log_list')) {
|
||||
$actions->append('<a href="'.admin_route('quota_v1_send_jobs.log_list', ['job'=>$actions->row]).'"><i class="fa fa-eye"></i> 发放记录</a>');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/** 查询 **/
|
||||
$grid->filter(function (Grid\Filter $filter) {
|
||||
$filter->panel();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a show builder.
|
||||
*
|
||||
* @param mixed $id
|
||||
*
|
||||
* @return Show
|
||||
*/
|
||||
protected function detail($id)
|
||||
{
|
||||
return Show::make($id, new QuotaV1SendJob(), function (Show $show) {
|
||||
$show->field('id');
|
||||
$show->field('administrator_id');
|
||||
$show->field('amount');
|
||||
$show->field('status');
|
||||
$show->field('remarks');
|
||||
$show->field('created_at');
|
||||
$show->field('updated_at');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a form builder.
|
||||
*
|
||||
* @return Form
|
||||
*/
|
||||
protected function form()
|
||||
{
|
||||
return Form::make(new QuotaV1SendJob(), function (Form $form) {
|
||||
$form->display('id');
|
||||
if ($form->isCreating()) {
|
||||
$form->currency('amount')->symbol('¥')->customFormat(function ($amount) {
|
||||
return bcdiv($amount, 100, 2);
|
||||
})->saving(function ($amount) {
|
||||
return bcmul($amount, 100);
|
||||
})->required();
|
||||
} else {
|
||||
$form->currency('amount')->symbol('¥')->customFormat(function ($amount) {
|
||||
return bcdiv($amount, 100, 2);
|
||||
})->saving(function ($amount) {
|
||||
return bcmul($amount, 100);
|
||||
})->disable();
|
||||
}
|
||||
|
||||
$form->text('remarks');
|
||||
|
||||
$form->display('created_at');
|
||||
$form->display('updated_at');
|
||||
});
|
||||
}
|
||||
|
||||
public function logList(Content $content, QuotaV1SendJobModel $job)
|
||||
{
|
||||
return $content->header(__('quota-v1-send-job.labels.quota-v1-send-jobs'))
|
||||
->description($job->id)
|
||||
->body(QuotaV1SendLogTable::grid($job->id));
|
||||
}
|
||||
}
|
||||
|
|
@ -63,7 +63,7 @@ class BalanceDeduction extends Form implements LazyRenderable
|
|||
public function form()
|
||||
{
|
||||
$this->select('user_id', '用户手机号')->ajax(admin_route('api.users'))->required();
|
||||
$this->currency('change_balance', '扣减金额')->symbol('¥')->default(0)->saving(function ($value) {
|
||||
$this->currency('change_balance', '扣减金额')->symbol('¥')->saving(function ($value) {
|
||||
return bcmul($value, 100);
|
||||
})->required();
|
||||
$this->confirm('是否确认扣减可提?', '提交后该动作无法逆转');
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class BalanceRecharge extends Form implements LazyRenderable
|
|||
public function form()
|
||||
{
|
||||
$this->select('user_id', '用户手机号')->ajax(admin_route('api.users'))->required();
|
||||
$this->currency('change_balance', '充值金额')->symbol('¥')->default(0)->saving(function ($value) {
|
||||
$this->currency('change_balance', '充值金额')->symbol('¥')->saving(function ($value) {
|
||||
return bcmul($value, 100);
|
||||
})->required();
|
||||
$this->confirm('是否确认充值余额?', '提交后该动作无法逆转');
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class Distribution extends Form
|
|||
{
|
||||
$appSettings = (array) Setting::where('key', 'distribution')->value('value');
|
||||
|
||||
// dd(config('distribution'), app_settings('distribution'));
|
||||
// dd($appSettings, app_settings('distribution'));
|
||||
|
||||
$this->text('settle_days', '订单结算时间(天)')
|
||||
->value($appSettings['settle_days'] ?? 0)
|
||||
|
|
@ -49,7 +49,7 @@ class Distribution extends Form
|
|||
->value($appSettings['price_diff_fee_rate'] ?? 0)
|
||||
->rules('required|int|min:0|max:100')
|
||||
->saving(function ($value) {
|
||||
return bcdiv($value, 100);
|
||||
return bcdiv($value, 100, 2);
|
||||
})
|
||||
->customFormat(function ($value) {
|
||||
return bcmul($value, 100);
|
||||
|
|
@ -60,7 +60,7 @@ class Distribution extends Form
|
|||
->value($appSettings['lvl_same_bonus_fee_rate'] ?? 0)
|
||||
->rules('required|int|min:0|max:100')
|
||||
->saving(function ($value) {
|
||||
return bcdiv($value, 100);
|
||||
return bcdiv($value, 100, 2);
|
||||
})
|
||||
->customFormat(function ($value) {
|
||||
return bcmul($value, 100);
|
||||
|
|
@ -71,7 +71,7 @@ class Distribution extends Form
|
|||
->value($appSettings['lvl_diff_bonus_fee_rate'] ?? 0)
|
||||
->rules('required|int|min:0|max:100')
|
||||
->saving(function ($value) {
|
||||
return bcdiv($value, 100);
|
||||
return bcdiv($value, 100, 2);
|
||||
})
|
||||
->customFormat(function ($value) {
|
||||
return bcmul($value, 100);
|
||||
|
|
@ -82,7 +82,7 @@ class Distribution extends Form
|
|||
->value($appSettings['quota_v2_rate'] ?? 0)
|
||||
->rules('required|int|min:0|max:100')
|
||||
->saving(function ($value) {
|
||||
return bcdiv($value, 100);
|
||||
return bcdiv($value, 100, 2);
|
||||
})
|
||||
->customFormat(function ($value) {
|
||||
return bcmul($value, 100);
|
||||
|
|
@ -97,7 +97,7 @@ class Distribution extends Form
|
|||
->prepend('%')
|
||||
->rules('required|int|min:0|max:100')
|
||||
->saving(function ($value) {
|
||||
return bcdiv($value, 100);
|
||||
return bcdiv($value, 100, 2);
|
||||
})
|
||||
->customFormat(function ($value) {
|
||||
return bcmul($value, 100);
|
||||
|
|
@ -107,7 +107,7 @@ class Distribution extends Form
|
|||
->prepend('%')
|
||||
->rules('required|int|min:0|max:100')
|
||||
->saving(function ($value) {
|
||||
return bcdiv($value, 100);
|
||||
return bcdiv($value, 100, 2);
|
||||
})
|
||||
->customFormat(function ($value) {
|
||||
return bcmul($value, 100);
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class WalletDeduction extends Form implements LazyRenderable
|
|||
public function form()
|
||||
{
|
||||
$this->select('user_id', '用户手机号')->ajax(admin_route('api.users'))->required();
|
||||
$this->currency('change_balance', '扣减金额')->symbol('¥')->default(0)->saving(function ($value) {
|
||||
$this->currency('change_balance', '扣减金额')->symbol('¥')->saving(function ($value) {
|
||||
return bcmul($value, 100);
|
||||
})->required();
|
||||
$this->confirm('是否确认扣减可提?', '提交后该动作无法逆转');
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class WalletRecharge extends Form implements LazyRenderable
|
|||
public function form()
|
||||
{
|
||||
$this->select('user_id', '用户手机号')->ajax(admin_route('api.users'))->required();
|
||||
$this->currency('change_balance', '充值金额')->symbol('¥')->default(0)->saving(function ($value) {
|
||||
$this->currency('change_balance', '充值金额')->symbol('¥')->saving(function ($value) {
|
||||
return bcmul($value, 100);
|
||||
})->required();
|
||||
$this->confirm('是否确认充值可提?', '提交后该动作无法逆转');
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace App\Admin\Renderable;
|
||||
|
||||
use App\Models\QuotaV1SendLog;
|
||||
use Dcat\Admin\Grid;
|
||||
|
||||
class QuotaV1SendLogTable extends Grid
|
||||
{
|
||||
public static function grid(int $jobId = null)
|
||||
{
|
||||
$builder = QuotaV1SendLog::with(['user']);
|
||||
$grid = parent::make($builder, function (Grid $grid) {
|
||||
$grid->column('user.phone', '手机号');
|
||||
$grid->column('amount', '分红金额')->display(function ($value) {
|
||||
return bcdiv($value, 100, 2);
|
||||
})->prepend('¥');
|
||||
$grid->column('status', '状态')->using(QuotaV1SendLog::$statusText)->dot([
|
||||
0=>'warning',
|
||||
1=>'success',
|
||||
]);
|
||||
$grid->column('created_at', '发放时间')->sortable();
|
||||
|
||||
$grid->model()->orderBy('created_at', 'desc');
|
||||
|
||||
$grid->filter(function (Grid\Filter $filter) {
|
||||
$filter->panel();
|
||||
$filter->equal('user.phone', '手机号')->width(3);
|
||||
});
|
||||
$grid->disableActions();
|
||||
$grid->disableCreateButton();
|
||||
});
|
||||
if ($jobId) {
|
||||
$grid->model()->where('job_id', $jobId);
|
||||
}
|
||||
return $grid;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
<?php
|
||||
|
||||
namespace App\Admin\Repositories;
|
||||
|
||||
use App\Models\QuotaV1SendJob as Model;
|
||||
use Dcat\Admin\Admin;
|
||||
use Dcat\Admin\Form;
|
||||
use Dcat\Admin\Repositories\EloquentRepository;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class QuotaV1SendJob extends EloquentRepository
|
||||
{
|
||||
/**
|
||||
* Model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $eloquentClass = Model::class;
|
||||
|
||||
/**
|
||||
* 新增记录.
|
||||
*
|
||||
* @param Form $form
|
||||
* @return mixed
|
||||
*/
|
||||
public function store(Form $form)
|
||||
{
|
||||
$result = null;
|
||||
|
||||
DB::transaction(function () use ($form, &$result) {
|
||||
$model = $this->model();
|
||||
|
||||
$updates = $form->updates();
|
||||
|
||||
[$relations, $relationKeyMap] = $this->getRelationInputs($model, $updates);
|
||||
|
||||
if ($relations) {
|
||||
$updates = Arr::except($updates, array_keys($relationKeyMap));
|
||||
}
|
||||
|
||||
foreach ($updates as $column => $value) {
|
||||
$model->setAttribute($column, $value);
|
||||
}
|
||||
$model->setAttribute('administrator_id', Admin::user()->id);
|
||||
|
||||
$result = $model->save();
|
||||
|
||||
$this->updateRelation($form, $model, $relations, $relationKeyMap);
|
||||
});
|
||||
|
||||
return $this->model()->getKey();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新数据.
|
||||
*
|
||||
* @param Form $form
|
||||
* @return bool
|
||||
*/
|
||||
public function update(Form $form)
|
||||
{
|
||||
/* @var EloquentModel $builder */
|
||||
$model = $this->model();
|
||||
|
||||
if (! $model->getKey()) {
|
||||
$model->exists = true;
|
||||
|
||||
$model->setAttribute($model->getKeyName(), $form->getKey());
|
||||
}
|
||||
|
||||
$result = null;
|
||||
|
||||
DB::transaction(function () use ($form, $model, &$result) {
|
||||
$updates = $form->updates();
|
||||
|
||||
[$relations, $relationKeyMap] = $this->getRelationInputs($model, $updates);
|
||||
|
||||
if ($relations) {
|
||||
$updates = Arr::except($updates, array_keys($relationKeyMap));
|
||||
}
|
||||
|
||||
foreach ($updates as $column => $value) {
|
||||
/* @var EloquentModel $model */
|
||||
$model->setAttribute($column, $value);
|
||||
}
|
||||
$model->setAttribute('administrator_id', Admin::user()->id);
|
||||
$result = $model->update();
|
||||
|
||||
$this->updateRelation($form, $model, $relations, $relationKeyMap);
|
||||
});
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
|
@ -139,6 +139,11 @@ Route::group([
|
|||
'index',
|
||||
])->names('points_logs');
|
||||
|
||||
$router->resource('quota-v1-send-jobs', 'QuotaV1SendJobController')->only([
|
||||
'index', 'create', 'store', 'edit', 'update', 'destroy',
|
||||
])->names('quota_v1_send_jobs');
|
||||
$router->get('quota-v1-send-jobs/{job}/log-list', 'QuotaV1SendJobController@logList')->name('quota_v1_send_jobs.log_list');
|
||||
|
||||
/** api接口 **/
|
||||
$router->get('api/product-categories', 'ProductCategoryController@categories')->name('api.product_categories');
|
||||
$router->get('api/product-group-details', 'ProductGroupController@details')->name('api.product_group_details');
|
||||
|
|
|
|||
|
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\QuotaV1SendJob;
|
||||
use App\Models\QuotaV1SendLog;
|
||||
use App\Models\UserInfo;
|
||||
use App\Models\WalletLog;
|
||||
use App\Services\WalletService;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Throwable;
|
||||
|
||||
class QuotaV1SendCommand extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'quota-v1:send';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = '老配额分红';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
foreach (QuotaV1SendJob::where('status', 1)->cursor() as $job) {
|
||||
$totalQuotaV1 = UserInfo::where('quota_v1', '>', 0)->sum('quota_v1');
|
||||
if ($totalQuotaV1 > 0) {//总配额大于0才开始分
|
||||
UserInfo::with('user')->where('quota_v1', '>', 0)->chunkById(100, function ($userInfos) use ($totalQuotaV1, $job) {
|
||||
$walletService = new WalletService();
|
||||
//依次分红
|
||||
foreach ($userInfos as $userInfo) {
|
||||
$log = new QuotaV1SendLog();
|
||||
$log->user_id = $userInfo->user_id;
|
||||
$log->job_id = $job->id;
|
||||
$log->amount = round(bcmul(bcdiv($job->amount, $totalQuotaV1, 5), $userInfo->quota_v1, 3));
|
||||
$log->save();
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
$log->update(['status'=>1]);
|
||||
$walletService->changeBalance($userInfo->user, $log->amount, WalletLog::ACTION_QUOTA_V1, '老配额分红', $log);
|
||||
DB::commit();
|
||||
} catch (Throwable $th) {
|
||||
DB::rollBack();
|
||||
report($th);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
$job->update([
|
||||
'status' => 2,
|
||||
]);
|
||||
}
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Admin\Administrator;
|
||||
use Dcat\Admin\Traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class QuotaV1SendJob extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasDateTimeFormatter;
|
||||
|
||||
public const STATUS_PENDING = 0;
|
||||
public const STATUS_DOING = 1;
|
||||
public const STATUS_FINISHED = 2;
|
||||
|
||||
protected $fillable = [
|
||||
'status',
|
||||
];
|
||||
|
||||
public static $statusText = [
|
||||
self::STATUS_PENDING=>'未开始',
|
||||
self::STATUS_DOING=>'进行中',
|
||||
self::STATUS_FINISHED=>'已完成',
|
||||
];
|
||||
|
||||
public function administrator()
|
||||
{
|
||||
return $this->belongsTo(Administrator::class, 'administrator_id');
|
||||
}
|
||||
|
||||
public function logs()
|
||||
{
|
||||
return $this->hasMany(QuotaV1SendLog::class, 'job_id');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Dcat\Admin\Traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class QuotaV1SendLog extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasDateTimeFormatter;
|
||||
|
||||
public const STATUS_FAILED = 0;
|
||||
public const STATUS_SUCCESS = 1;
|
||||
|
||||
protected $attributes = [
|
||||
'status'=>0,
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'status',
|
||||
];
|
||||
|
||||
public static $statusText = [
|
||||
self::STATUS_FAILED=>'失败',
|
||||
self::STATUS_SUCCESS=>'成功',
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
}
|
||||
|
|
@ -19,6 +19,7 @@ class WalletLog extends Model
|
|||
public const ACTION_WITHDRAW_FAILED = 6;
|
||||
public const ACTION_ADMIN_RECHARGE = 7;
|
||||
public const ACTION_ADMIN_DEDUCTION = 8;
|
||||
public const ACTION_QUOTA_V1 = 9;
|
||||
public const ACTION_DISTRIBUTION_PRE_INCOME = 10;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ class AppServiceProvider extends ServiceProvider
|
|||
'balance_log' => \App\Models\BalanceLog::class,
|
||||
'distribution_pre_income' => \App\Models\DistributionPreIncome::class,
|
||||
'admin_users' => \App\Models\Admin\Administrator::class,
|
||||
'quota_v1_send_logs' => \App\Models\QuotaV1SendLog::class,
|
||||
]);
|
||||
|
||||
JsonResource::withoutWrapping();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateQuotaV1SendJobsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('quota_v1_send_jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('administrator_id')->comment('管理员ID');
|
||||
$table->unsignedInteger('amount')->comment('金额(分)');
|
||||
$table->unsignedTinyInteger('status')->default(0)->comment('0未开始1分配中2分配完成');
|
||||
$table->string('remarks')->nullable()->comment('备注');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('quota_v1_send_jobs');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateQuotaV1SendLogsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('quota_v1_send_logs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('user_id')->comment('用户ID');
|
||||
$table->unsignedBigInteger('job_id')->comment('任务ID');
|
||||
$table->unsignedInteger('amount')->default(0)->comment('分红金额');
|
||||
$table->unsignedTinyInteger('status')->default(0)->comment('0失败,1成功');
|
||||
$table->string('remarks')->nullable()->comment('备注');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('quota_v1_send_logs');
|
||||
}
|
||||
}
|
||||
|
|
@ -247,6 +247,11 @@ class AdminMenuSeeder extends Seeder
|
|||
'icon' => '',
|
||||
'uri' =>'after-sales?state=5',
|
||||
],
|
||||
[
|
||||
'title' => '老配额分红',
|
||||
'icon' => '',
|
||||
'uri' => 'quota-v1-send-jobs',
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
|
|
|
|||
|
|
@ -62,6 +62,8 @@ namespace Dcat\Admin {
|
|||
* @property Grid\Column|Collection state
|
||||
* @property Grid\Column|Collection tracking_number
|
||||
* @property Grid\Column|Collection sales_value
|
||||
* @property Grid\Column|Collection before_agent_level
|
||||
* @property Grid\Column|Collection change_agent_level
|
||||
* @property Grid\Column|Collection v
|
||||
* @property Grid\Column|Collection cate
|
||||
* @property Grid\Column|Collection is_force
|
||||
|
|
@ -168,6 +170,7 @@ namespace Dcat\Admin {
|
|||
* @property Grid\Column|Collection is_change
|
||||
* @property Grid\Column|Collection out_trade_no
|
||||
* @property Grid\Column|Collection auto_complete_at
|
||||
* @property Grid\Column|Collection is_settle
|
||||
* @property Grid\Column|Collection payable_type
|
||||
* @property Grid\Column|Collection payable_id
|
||||
* @property Grid\Column|Collection tokenable_type
|
||||
|
|
@ -196,6 +199,8 @@ namespace Dcat\Admin {
|
|||
* @property Grid\Column|Collection view_date
|
||||
* @property Grid\Column|Collection is_pushed
|
||||
* @property Grid\Column|Collection message_type
|
||||
* @property Grid\Column|Collection change_quota
|
||||
* @property Grid\Column|Collection job_id
|
||||
* @property Grid\Column|Collection x
|
||||
* @property Grid\Column|Collection y
|
||||
* @property Grid\Column|Collection size
|
||||
|
|
@ -296,6 +301,8 @@ namespace Dcat\Admin {
|
|||
* @method Grid\Column|Collection state(string $label = null)
|
||||
* @method Grid\Column|Collection tracking_number(string $label = null)
|
||||
* @method Grid\Column|Collection sales_value(string $label = null)
|
||||
* @method Grid\Column|Collection before_agent_level(string $label = null)
|
||||
* @method Grid\Column|Collection change_agent_level(string $label = null)
|
||||
* @method Grid\Column|Collection v(string $label = null)
|
||||
* @method Grid\Column|Collection cate(string $label = null)
|
||||
* @method Grid\Column|Collection is_force(string $label = null)
|
||||
|
|
@ -402,6 +409,7 @@ namespace Dcat\Admin {
|
|||
* @method Grid\Column|Collection is_change(string $label = null)
|
||||
* @method Grid\Column|Collection out_trade_no(string $label = null)
|
||||
* @method Grid\Column|Collection auto_complete_at(string $label = null)
|
||||
* @method Grid\Column|Collection is_settle(string $label = null)
|
||||
* @method Grid\Column|Collection payable_type(string $label = null)
|
||||
* @method Grid\Column|Collection payable_id(string $label = null)
|
||||
* @method Grid\Column|Collection tokenable_type(string $label = null)
|
||||
|
|
@ -430,6 +438,8 @@ namespace Dcat\Admin {
|
|||
* @method Grid\Column|Collection view_date(string $label = null)
|
||||
* @method Grid\Column|Collection is_pushed(string $label = null)
|
||||
* @method Grid\Column|Collection message_type(string $label = null)
|
||||
* @method Grid\Column|Collection change_quota(string $label = null)
|
||||
* @method Grid\Column|Collection job_id(string $label = null)
|
||||
* @method Grid\Column|Collection x(string $label = null)
|
||||
* @method Grid\Column|Collection y(string $label = null)
|
||||
* @method Grid\Column|Collection size(string $label = null)
|
||||
|
|
@ -535,6 +545,8 @@ namespace Dcat\Admin {
|
|||
* @property Show\Field|Collection state
|
||||
* @property Show\Field|Collection tracking_number
|
||||
* @property Show\Field|Collection sales_value
|
||||
* @property Show\Field|Collection before_agent_level
|
||||
* @property Show\Field|Collection change_agent_level
|
||||
* @property Show\Field|Collection v
|
||||
* @property Show\Field|Collection cate
|
||||
* @property Show\Field|Collection is_force
|
||||
|
|
@ -641,6 +653,7 @@ namespace Dcat\Admin {
|
|||
* @property Show\Field|Collection is_change
|
||||
* @property Show\Field|Collection out_trade_no
|
||||
* @property Show\Field|Collection auto_complete_at
|
||||
* @property Show\Field|Collection is_settle
|
||||
* @property Show\Field|Collection payable_type
|
||||
* @property Show\Field|Collection payable_id
|
||||
* @property Show\Field|Collection tokenable_type
|
||||
|
|
@ -669,6 +682,8 @@ namespace Dcat\Admin {
|
|||
* @property Show\Field|Collection view_date
|
||||
* @property Show\Field|Collection is_pushed
|
||||
* @property Show\Field|Collection message_type
|
||||
* @property Show\Field|Collection change_quota
|
||||
* @property Show\Field|Collection job_id
|
||||
* @property Show\Field|Collection x
|
||||
* @property Show\Field|Collection y
|
||||
* @property Show\Field|Collection size
|
||||
|
|
@ -769,6 +784,8 @@ namespace Dcat\Admin {
|
|||
* @method Show\Field|Collection state(string $label = null)
|
||||
* @method Show\Field|Collection tracking_number(string $label = null)
|
||||
* @method Show\Field|Collection sales_value(string $label = null)
|
||||
* @method Show\Field|Collection before_agent_level(string $label = null)
|
||||
* @method Show\Field|Collection change_agent_level(string $label = null)
|
||||
* @method Show\Field|Collection v(string $label = null)
|
||||
* @method Show\Field|Collection cate(string $label = null)
|
||||
* @method Show\Field|Collection is_force(string $label = null)
|
||||
|
|
@ -875,6 +892,7 @@ namespace Dcat\Admin {
|
|||
* @method Show\Field|Collection is_change(string $label = null)
|
||||
* @method Show\Field|Collection out_trade_no(string $label = null)
|
||||
* @method Show\Field|Collection auto_complete_at(string $label = null)
|
||||
* @method Show\Field|Collection is_settle(string $label = null)
|
||||
* @method Show\Field|Collection payable_type(string $label = null)
|
||||
* @method Show\Field|Collection payable_id(string $label = null)
|
||||
* @method Show\Field|Collection tokenable_type(string $label = null)
|
||||
|
|
@ -903,6 +921,8 @@ namespace Dcat\Admin {
|
|||
* @method Show\Field|Collection view_date(string $label = null)
|
||||
* @method Show\Field|Collection is_pushed(string $label = null)
|
||||
* @method Show\Field|Collection message_type(string $label = null)
|
||||
* @method Show\Field|Collection change_quota(string $label = null)
|
||||
* @method Show\Field|Collection job_id(string $label = null)
|
||||
* @method Show\Field|Collection x(string $label = null)
|
||||
* @method Show\Field|Collection y(string $label = null)
|
||||
* @method Show\Field|Collection size(string $label = null)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'labels' => [
|
||||
'QuotaV1SendJob' => '老配额分红',
|
||||
'quota-v1-send-jobs' => '老配额分红',
|
||||
],
|
||||
'fields' => [
|
||||
'administrator_id' => '管理员ID',
|
||||
'administrator'=>[
|
||||
'name' => '操作人',
|
||||
],
|
||||
'amount' => '金额',
|
||||
'status' => '状态',
|
||||
'remarks' => '备注',
|
||||
],
|
||||
'options' => [
|
||||
],
|
||||
];
|
||||
Loading…
Reference in New Issue