diff --git a/app/Admin/Controllers/UserController.php b/app/Admin/Controllers/UserController.php
index 7df0c02d..2d78dd0c 100644
--- a/app/Admin/Controllers/UserController.php
+++ b/app/Admin/Controllers/UserController.php
@@ -61,24 +61,24 @@ class UserController extends AdminController
$modal->title('消费值');
return UserSalesValueLogSimpleTable::make(['id'=>$this->id]);
})->setHeaderAttributes(['style' => 'color:#5b69bc']);
- $grid->column('wallet.balance')->display(function ($value) {
- $value = bcdiv($value, 100, 2);
- if ($this->wallet?->is_frozen) {
- $value .= " 冻结";
- }
- return $value;
- })->prepend('¥')->filter(
- PriceBetween::make()
- );
- $grid->column('balance.balance')->display(function ($value) {
- $value = bcdiv($value, 100, 2);
- if ($this->balance?->is_frozen) {
- $value .= " 冻结";
- }
- return $value;
- })->prepend('¥')->filter(
- PriceBetween::make()
- );
+ // $grid->column('wallet.balance')->display(function ($value) {
+ // $value = bcdiv($value, 100, 2);
+ // if ($this->wallet?->is_frozen) {
+ // $value .= " 冻结";
+ // }
+ // return $value;
+ // })->prepend('¥')->filter(
+ // PriceBetween::make()
+ // );
+ // $grid->column('balance.balance')->display(function ($value) {
+ // $value = bcdiv($value, 100, 2);
+ // if ($this->balance?->is_frozen) {
+ // $value .= " 冻结";
+ // }
+ // return $value;
+ // })->prepend('¥')->filter(
+ // PriceBetween::make()
+ // );
$grid->column('created_at')->sortable();
$grid->column('register_ip');
@@ -217,11 +217,11 @@ class UserController extends AdminController
$form->display('id');
// $form->text('username');
$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->ignore(['password_confirm']);
+ // $form->ignore(['password_confirm']);
$form->display('created_at');
$form->display('updated_at');
diff --git a/app/Endpoint/Api/Http/Controllers/Auth/MiniprogramController.php b/app/Endpoint/Api/Http/Controllers/Auth/MiniprogramController.php
index c375736d..43d66e72 100644
--- a/app/Endpoint/Api/Http/Controllers/Auth/MiniprogramController.php
+++ b/app/Endpoint/Api/Http/Controllers/Auth/MiniprogramController.php
@@ -107,11 +107,14 @@ class MiniprogramController extends Controller
'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();
return response()->noContent();
} catch (Throwable $e) {
diff --git a/database/migrations/2022_05_06_133819_add_role_to_user_infos.php b/database/migrations/2022_05_06_133819_add_role_to_user_infos.php
new file mode 100644
index 00000000..896c6480
--- /dev/null
+++ b/database/migrations/2022_05_06_133819_add_role_to_user_infos.php
@@ -0,0 +1,38 @@
+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']);
+ });
+ }
+}
diff --git a/database/migrations/2022_05_06_150951_create_order_profits_table.php b/database/migrations/2022_05_06_150951_create_order_profits_table.php
new file mode 100644
index 00000000..38e5ba95
--- /dev/null
+++ b/database/migrations/2022_05_06_150951_create_order_profits_table.php
@@ -0,0 +1,42 @@
+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');
+ }
+}
diff --git a/database/migrations/2022_05_06_160615_add_invitor_id_to_orders.php b/database/migrations/2022_05_06_160615_add_invitor_id_to_orders.php
new file mode 100644
index 00000000..13808cbd
--- /dev/null
+++ b/database/migrations/2022_05_06_160615_add_invitor_id_to_orders.php
@@ -0,0 +1,33 @@
+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']);
+ });
+ }
+}