add migration
parent
b8cd92a70a
commit
50fb013f22
|
|
@ -61,24 +61,24 @@ class UserController extends AdminController
|
||||||
$modal->title('消费值');
|
$modal->title('消费值');
|
||||||
return UserSalesValueLogSimpleTable::make(['id'=>$this->id]);
|
return UserSalesValueLogSimpleTable::make(['id'=>$this->id]);
|
||||||
})->setHeaderAttributes(['style' => 'color:#5b69bc']);
|
})->setHeaderAttributes(['style' => 'color:#5b69bc']);
|
||||||
$grid->column('wallet.balance')->display(function ($value) {
|
// $grid->column('wallet.balance')->display(function ($value) {
|
||||||
$value = bcdiv($value, 100, 2);
|
// $value = bcdiv($value, 100, 2);
|
||||||
if ($this->wallet?->is_frozen) {
|
// if ($this->wallet?->is_frozen) {
|
||||||
$value .= " <span class='label' style='background:#b3b9bf'>冻结</span>";
|
// $value .= " <span class='label' style='background:#b3b9bf'>冻结</span>";
|
||||||
}
|
// }
|
||||||
return $value;
|
// return $value;
|
||||||
})->prepend('¥')->filter(
|
// })->prepend('¥')->filter(
|
||||||
PriceBetween::make()
|
// PriceBetween::make()
|
||||||
);
|
// );
|
||||||
$grid->column('balance.balance')->display(function ($value) {
|
// $grid->column('balance.balance')->display(function ($value) {
|
||||||
$value = bcdiv($value, 100, 2);
|
// $value = bcdiv($value, 100, 2);
|
||||||
if ($this->balance?->is_frozen) {
|
// if ($this->balance?->is_frozen) {
|
||||||
$value .= " <span class='label' style='background:#b3b9bf'>冻结</span>";
|
// $value .= " <span class='label' style='background:#b3b9bf'>冻结</span>";
|
||||||
}
|
// }
|
||||||
return $value;
|
// return $value;
|
||||||
})->prepend('¥')->filter(
|
// })->prepend('¥')->filter(
|
||||||
PriceBetween::make()
|
// PriceBetween::make()
|
||||||
);
|
// );
|
||||||
|
|
||||||
$grid->column('created_at')->sortable();
|
$grid->column('created_at')->sortable();
|
||||||
$grid->column('register_ip');
|
$grid->column('register_ip');
|
||||||
|
|
@ -217,11 +217,11 @@ class UserController extends AdminController
|
||||||
$form->display('id');
|
$form->display('id');
|
||||||
// $form->text('username');
|
// $form->text('username');
|
||||||
$form->mobile('phone')->rules('unique:users,phone')->required();
|
$form->mobile('phone')->rules('unique:users,phone')->required();
|
||||||
$form->password('password')->required();
|
// $form->password('password')->required();
|
||||||
// 设置错误信息
|
// 设置错误信息
|
||||||
$form->password('password_confirm')->same('password', '两次密码输入不一致')->required();
|
// $form->password('password_confirm')->same('password', '两次密码输入不一致')->required();
|
||||||
$form->text('code', '邀请码');
|
$form->text('code', '邀请码');
|
||||||
$form->ignore(['password_confirm']);
|
// $form->ignore(['password_confirm']);
|
||||||
|
|
||||||
$form->display('created_at');
|
$form->display('created_at');
|
||||||
$form->display('updated_at');
|
$form->display('updated_at');
|
||||||
|
|
|
||||||
|
|
@ -107,11 +107,14 @@ class MiniprogramController extends Controller
|
||||||
'status_remark' => '手机号重复: ' . $phone
|
'status_remark' => '手机号重复: ' . $phone
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($user->phone !== $phone) {
|
||||||
|
$user->update([
|
||||||
|
'phone' => $phone,
|
||||||
|
'phone_verified_at' => now(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
$user->update([
|
|
||||||
'phone' => $phone,
|
|
||||||
'phone_verified_at' => now(),
|
|
||||||
]);
|
|
||||||
DB::commit();
|
DB::commit();
|
||||||
return response()->noContent();
|
return response()->noContent();
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class AddRoleToUserInfos extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('user_infos', function (Blueprint $table) {
|
||||||
|
// type: favoite, agent
|
||||||
|
// level: v3, v2, v1
|
||||||
|
$table->string('role')->default('')->comment('分销身份({type}-{level})');
|
||||||
|
$table->string('role_name')->default('');
|
||||||
|
$table->decimal('profit', 12, 2)->default(0)->comment('累计收益');
|
||||||
|
$table->tinyInteger('is_company')->default(0)->comment('是否员工');
|
||||||
|
$table->unsignedBigInteger('store_id')->nullable()->comment('关联门店');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('user_infos', function (Blueprint $table) {
|
||||||
|
$table->dropColumn(['role', 'role_name', 'profit', 'store_id']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateOrderProfitsTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('order_profits', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->unsignedBigInteger('order_id')->comment('订单ID');
|
||||||
|
$table->unsignedBigInteger('from_user_id')->comment('下单用户');
|
||||||
|
$table->unsignedBigInteger('user_id')->comment('收益用户');
|
||||||
|
$table->string('role')->default('')->comment('收益用户身份');
|
||||||
|
$table->string('role_name')->default('');
|
||||||
|
$table->decimal('growth_value', 12, 2)->comment('成长值');
|
||||||
|
$table->integer('ratio')->comment('比例');
|
||||||
|
$table->decimal('money', 12, 2)->comment('收益金额');
|
||||||
|
$table->tinyInteger('status')->default(0)->comment('状态(0: 待付款, 1: 付款中, 2: 已付款)');
|
||||||
|
$table->timestamp('paid_at')->nullable()->comment('付款时间');
|
||||||
|
$table->text('pay_data')->nullable()->comment('支付信息{pay_way, pay_sn}');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('order_profits');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class AddInvitorIdToOrders extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('orders', function (Blueprint $table) {
|
||||||
|
$table->unsignedBigInteger('store_id')->nullable()->comment('关联门店');
|
||||||
|
$table->unsignedBigInteger('inviter_id')->nullable()->comment('关联员工');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('orders', function (Blueprint $table) {
|
||||||
|
$table->dropColumn(['store_id', 'inviter_id']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue