6
0
Fork 0

Revert "小程序授权登录"

This reverts commit e1c2e18758.
release
panliang 2022-05-07 10:50:18 +08:00
parent e1c2e18758
commit fdfa755e57
18 changed files with 896 additions and 1098 deletions

View File

@ -1,13 +1,66 @@
# 积趣商城
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400"></a></p>
## Require
<p align="center">
<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>
- php >= 8.0
## About Laravel
## 安装
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
- `composer install`
- 复制配置文件 `cp .env.example .env`, 并配置数据库
- `php artisan key:generate`
- `php artisan migrate` && `php artisan admin:install` && `php artisan db:seed`
- 后台账号: admin, admin
- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
Laravel is accessible, powerful, and provides tools required for large, robust applications.
## Learning Laravel
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 1500 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
## Laravel Sponsors
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).
### Premium Partners
- **[Vehikl](https://vehikl.com/)**
- **[Tighten Co.](https://tighten.co)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Cubet Techno Labs](https://cubettech.com)**
- **[Cyber-Duck](https://cyber-duck.co.uk)**
- **[Many](https://www.many.co.uk)**
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
- **[DevSquad](https://devsquad.com)**
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
- **[OP.GG](https://op.gg)**
- **[CMS Max](https://www.cmsmax.com/)**
- **[WebReinvent](https://webreinvent.com/?utm_source=laravel&utm_medium=github&utm_campaign=patreon-sponsors)**
- **[Lendio](https://lendio.com)**
- **[Romega Software](https://romegasoftware.com)**
## Contributing
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
## Code of Conduct
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
## Security Vulnerabilities
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
## License
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

View File

@ -8,7 +8,7 @@ use App\Admin\Forms\Settings\Custom;
use App\Admin\Forms\Settings\Ios;
use App\Admin\Forms\Settings\Kuaidi100;
use App\Admin\Forms\Settings\Unipush;
use App\Admin\Forms\Settings\{Withdraw, Distribution};
use App\Admin\Forms\Settings\Withdraw;
use App\Admin\Repositories\Setting;
use Dcat\Admin\Admin;
use Dcat\Admin\Form;
@ -107,24 +107,72 @@ class SettingController extends AdminController
->body(function (Row $row) {
$type = Request::query('type', 'app');
$tab = new Tab();
$tabs = [
'app' => ['name' => '系统配置', 'form' => new App(), 'route' => admin_route('settings.index', ['type'=>'app'])],
'withdraw' => ['name' => '提现配置', 'form' => new Withdraw(), 'route' => admin_route('settings.index', ['type'=>'withdraw'])],
'ios' => ['name' => 'IOS配置', 'form' => new Ios(), 'route' => admin_route('settings.index', ['type'=>'ios'])],
'android' => ['name' => 'Android配置', 'form' => new Android(), 'route' => admin_route('settings.index', ['type'=>'android'])],
'kuaidi100' => ['name' => '快递100配置', 'form' => new Kuaidi100(), 'route' => admin_route('settings.index', ['type'=>'kuaidi100'])],
'unipush' => ['name' => 'Uni-push配置', 'form' => new Unipush(), 'route' => admin_route('settings.index', ['type'=>'unipush'])],
'distribution' => ['name' => '分销配置', 'form' => new Distribution(), 'route' => admin_route('settings.index', ['type'=>'distribution'])],
'custom' => ['name' => '自定义配置', 'form' => new Custom(), 'route' => admin_route('settings.index', ['type'=>'custom'])],
];
if (isset($tabs[$type])) {
foreach($tabs as $key => $item) {
if ($key === $type) {
$tab->add($item['name'], $item['form'], true);
} else {
$tab->addLink($item['name'], $item['route']);
}
}
switch ($type) {
case 'app':
$tab->add('系统配置', new App(), true);
$tab->addLink('提现配置', admin_route('settings.index', ['type'=>'withdraw']));
$tab->addLink('Ios配置', admin_route('settings.index', ['type'=>'ios']));
$tab->addLink('Android配置', admin_route('settings.index', ['type'=>'ios']));
$tab->addLink('快递100配置', admin_route('settings.index', ['type'=>'kuaidi100']));
$tab->addLink('Uni-push配置', admin_route('settings.index', ['type'=>'unipush']));
$tab->addLink('自定义配置', admin_route('settings.index', ['type'=>'custom']));
break;
case 'withdraw':
$tab->addLink('系统配置', admin_route('settings.index', ['type'=>'app']));
$tab->add('提现配置', new Withdraw(), true);
$tab->addLink('Ios配置', admin_route('settings.index', ['type'=>'ios']));
$tab->addLink('Android配置', admin_route('settings.index', ['type'=>'android']));
$tab->addLink('快递100配置', admin_route('settings.index', ['type'=>'kuaidi100']));
$tab->addLink('Uni-push配置', admin_route('settings.index', ['type'=>'unipush']));
$tab->addLink('自定义配置', admin_route('settings.index', ['type'=>'custom']));
break;
case 'ios':
$tab->addLink('系统配置', admin_route('settings.index', ['type'=>'app']));
$tab->addLink('提现配置', admin_route('settings.index', ['type'=>'withdraw']));
$tab->add('Ios配置', new Ios(), true);
$tab->addLink('Android配置', admin_route('settings.index', ['type'=>'android']));
$tab->addLink('快递100配置', admin_route('settings.index', ['type'=>'kuaidi100']));
$tab->addLink('Uni-push配置', admin_route('settings.index', ['type'=>'unipush']));
$tab->addLink('自定义配置', admin_route('settings.index', ['type'=>'custom']));
break;
case 'android':
$tab->addLink('系统配置', admin_route('settings.index', ['type'=>'app']));
$tab->addLink('提现配置', admin_route('settings.index', ['type'=>'withdraw']));
$tab->addLink('Ios配置', admin_route('settings.index', ['type'=>'ios']));
$tab->add('Android配置', new Android(), true);
$tab->addLink('快递100配置', admin_route('settings.index', ['type'=>'kuaidi100']));
$tab->addLink('Uni-push配置', admin_route('settings.index', ['type'=>'unipush']));
$tab->addLink('自定义配置', admin_route('settings.index', ['type'=>'custom']));
break;
case 'kuaidi100':
$tab->addLink('系统配置', admin_route('settings.index', ['type'=>'app']));
$tab->addLink('提现配置', admin_route('settings.index', ['type'=>'withdraw']));
$tab->addLink('Ios配置', admin_route('settings.index', ['type'=>'ios']));
$tab->addLink('Android配置', admin_route('settings.index', ['type'=>'android']));
$tab->add('快递100配置', new Kuaidi100(), true);
$tab->addLink('Uni-push配置', admin_route('settings.index', ['type'=>'unipush']));
$tab->addLink('自定义配置', admin_route('settings.index', ['type'=>'custom']));
break;
case 'unipush':
$tab->addLink('系统配置', admin_route('settings.index', ['type'=>'app']));
$tab->addLink('提现配置', admin_route('settings.index', ['type'=>'withdraw']));
$tab->addLink('Ios配置', admin_route('settings.index', ['type'=>'ios']));
$tab->addLink('Android配置', admin_route('settings.index', ['type'=>'android']));
$tab->addLink('快递100配置', admin_route('settings.index', ['type'=>'kuaidi100']));
$tab->add('Uni-push配置', new Unipush(), true);
$tab->addLink('自定义配置', admin_route('settings.index', ['type'=>'custom']));
break;
case 'custom':
$tab->addLink('系统配置', admin_route('settings.index', ['type'=>'app']));
$tab->addLink('提现配置', admin_route('settings.index', ['type'=>'withdraw']));
$tab->addLink('Ios配置', admin_route('settings.index', ['type'=>'ios']));
$tab->addLink('Android配置', admin_route('settings.index', ['type'=>'android']));
$tab->addLink('快递100配置', admin_route('settings.index', ['type'=>'kuaidi100']));
$tab->addLink('Uni-push配置', admin_route('settings.index', ['type'=>'unipush']));
$tab->add('自定义配置', new Custom(), true);
break;
default:
break;
}
$row->column(12, $tab->withCard());
});

View File

@ -1,79 +0,0 @@
<?php
namespace App\Admin\Controllers;
use App\Models\Store;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
use Carbon\Carbon;
class StoreController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new Store(), function (Grid $grid) {
$grid->column('id');
$grid->column('title');
$grid->column('image')->image('', 100, 100);
$grid->column('created_at');
$grid->column('updated_at');
$grid->disableCreateButton(false);
$grid->enableDialogCreate();
$grid->setDialogFormDimensions('40%', '70%');
$grid->showEditButton();
$grid->filter(function (Grid\Filter $filter) {
$filter->panel();
$filter->like('title')->width(3);
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new Store(), function (Show $show) {
$show->field('id');
$show->field('title');
$show->field('image');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new Store(), function (Form $form) {
$form->display('id');
$form->text('title');
$form->image('image')
->move('store/'.Carbon::now()->toDateString())
->saveFullUrl()
->removable(false)
->retainable()
->autoUpload();
$form->display('created_at');
$form->display('updated_at');
});
}
}

View File

@ -1,68 +0,0 @@
<?php
namespace App\Admin\Forms\Settings;
use App\Models\Setting;
use App\Services\{SettingService, DistributeService};
use Dcat\Admin\Widgets\Form;
/**
* 分销设置
*/
class Distribution extends Form
{
/**
* Handle the form request.
*
* @param array $input
*
* @return mixed
*/
public function handle(array $input)
{
Setting::where('key', 'distribution')->updateOrCreate([
'key' => 'distribution',
], ['value' => $input]);
//清配置缓存
app(SettingService::class)->cleanCache('distribution');
return $this
->response()
->success('配置更新成功!')
->refresh();
}
/**
* Build a form here.
*/
public function form()
{
$values = Setting::where('key', 'distribution')->value('value');
$levels = DistributeService::$levels;
$favoite = $levels['favoite'];
$agent = $levels['agent'];
$this->fieldset('爱好者-返利', function (Form $form) use ($favoite) {
foreach($favoite as $item) {
$form->number('favoite-profit-' . $item['level'], $item['name'])->min(0)->max(100)->help('例如: 40, 即表示: 40%');
}
});
$this->fieldset('爱好者-升级', function (Form $form) use ($favoite) {
foreach($favoite as $item) {
$form->number('favoite-level-' . $item['level'], $item['name'])->min(0)->help('例如: 1000');
}
})->collapsed();
$this->fieldset('代理-返利', function (Form $form) use ($agent) {
foreach($agent as $item) {
$form->number('agent-profit-' . $item['level'], $item['name'])->min(0)->max(100)->help('例如: 40, 即表示: 40%');
}
})->collapsed();
}
public function default()
{
$values = Setting::where('key', 'distribution')->value('value');
return $values;
}
}

View File

@ -156,8 +156,6 @@ Route::group([
['index']
)->names('sales_value_logs');
$router->resource('store', 'StoreController')->names('store');
//商城端-砍价活动
$router->resource('bargain-activities', 'BargainActivityController')->names('bargain_activities');
$router->resource('bargain-orders', 'BargainOrderController')->only(['index', 'show'])->names('bargain_orders');

View File

@ -1,157 +0,0 @@
<?php
namespace App\Endpoint\Api\Http\Controllers\Auth;
use Throwable;
use App\Helpers\PhoneNumber;
use App\Enums\SocialiteType;
use Illuminate\Http\Request;
use App\Exceptions\BizException;
use Illuminate\Support\Facades\DB;
use App\Models\{User, SocialiteUser};
use App\Endpoint\Api\Http\Controllers\Controller;
use EasyWeChat\Factory;
class MiniprogramController extends Controller
{
public function login(Request $request)
{
$request->validate([
'code' => 'required'
], [
'code.required' => '授权码必填'
]);
$app = $this->getWechatApp();
$result = $app->auth->session($request->input('code'));
if (data_get($result, 'errcode')) {
throw new BizException(data_get($result, 'errmsg'));
}
$openid = data_get($result, 'openid');
$type = SocialiteType::WechatMiniProgram->value;
if (!$openid) {
throw new BizException('授权失败, 未找到 openid');
}
$time = now();
$ip = $request->realIp();
$inviter = $this->findUserByCode($request->input('invite_code', ''));
try {
DB::beginTransaction();
$user_social = SocialiteUser::where(['socialite_id' => $openid, 'socialite_type' => $type])->first();
if (!$user_social) {
$attributes = [
'register_ip' => $ip,
'last_login_at' => $time,
'last_login_ip' => $ip,
];
$user = User::create($attributes, $inviter);
$user->socialites()->create([
'socialite_id' => $openid,
'socialite_type' => $type,
]);
} else {
$user = $user_social->user;
}
$token = $user->createToken($type);
DB::commit();
return response()->json([
'token' => $token->plainTextToken,
]);
} catch (Throwable $e) {
DB::rollBack();
report($e);
throw new BizException($e->getMessage());
}
}
public function bindPhone(Request $request)
{
$user = $request->user();
$request->validate([
'code' => 'required'
], [
'code.required' => '授权码必填'
]);
$app = $this->getWechatApp();
$result = $app->phone_number->getUserPhoneNumber($request->input('code'));
if (data_get($result, 'errcode')) {
throw new BizException(data_get($result, 'errmsg'));
}
$phone = data_get($result, 'phone_info.purePhoneNumber');
try {
DB::beginTransaction();
// 检测手机号是否已经注册
$old_user = User::where('phone', $phone)->where('status', User::STATUS_ACTIVE)->where('id', '!=', $user->id)->first();
if ($old_user) {
// 禁用老用户
$old_user->update([
'phone' => '',
'status' => User::STATUS_DISABLED,
'status_remark' => '手机号重复: ' . $phone
]);
}
$user->update([
'phone' => $phone,
'phone_verified_at' => now(),
]);
DB::commit();
return response()->noContent();
} catch (Throwable $e) {
DB::rollBack();
report($e);
throw new BizException($e->getMessage());
}
}
/**
* 通过邀请码搜索用户
*
* @param string $code
* @return \App\Models\User|null
*
* @throws \App\Exceptions\BizException
*/
protected function findUserByCode(string $code): ?User
{
if ($code === '') {
return null;
}
$user = User::when(PhoneNumber::validate($code), function ($query) use ($code) {
$query->where('phone', $code);
}, function ($query) use ($code) {
$query->whereRelation('userInfo', 'code', $code);
})->first();
if ($user === null) {
throw new BizException(__('Inviter does not exist'));
}
return $user;
}
protected function getWechatApp($getway = 'default')
{
return Factory::miniProgram(config('wechat.mini_program.' . $getway));
}
}

View File

@ -36,7 +36,6 @@ use App\Endpoint\Api\Http\Controllers\SmsCodeController;
use App\Endpoint\Api\Http\Controllers\UserBankController;
use App\Endpoint\Api\Http\Controllers\UserCouponController;
use App\Endpoint\Api\Http\Controllers\ZoneController;
use App\Endpoint\Api\Http\Controllers\Auth\MiniprogramController;
use Illuminate\Support\Facades\Route;
Route::group([
@ -57,14 +56,6 @@ Route::group([
Route::post('register', RegisterController::class);
Route::post('reset-password', ResetPasswordController::class);
// 微信小程序
Route::group(['prefix' => 'wechat-mini'], function () {
Route::post('login', [MiniprogramController::class, 'login']);
Route::group(['middleware' => ['auth:api', \App\Endpoint\Api\Http\Middleware\CheckUserStatus::class]], function () {
Route::post('bind-phone', [MiniprogramController::class, 'bindPhone']);
});
});
Route::get('ads', [AdController::class, 'index']);
// 商品分类

View File

@ -1,12 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Dcat\Admin\Traits\HasDateTimeFormatter;
class Store extends Model
{
use HasFactory, HasDateTimeFormatter;
}

View File

@ -1,67 +0,0 @@
<?php
namespace App\Services;
use App\Models\{User, Order, SalesValueLog};
/**
* 分销模块
*/
class DistributeService
{
public static $levels = [
'favoite' => [
['name' => '金', 'level' => 'v3'],
['name' => '银', 'level' => 'v2'],
['name' => '铜', 'level' => 'v1'],
],
'agent' => [
['name' => '省', 'level' => 'v3'],
['name' => '市', 'level' => 'v2'],
['name' => '区', 'level' => 'v1'],
]
];
/**
* 用户下单后, 更新成长值, 添加返现记录
*
* @param \App\Models\Order $order
*
* @return mixed
*/
public function storeByOrder(Order $order)
{
// 订单未取消
if ($order->isCancelled) {
return false;
}
// 订单成长值
$sales_value = $order->sales_value;
$user = $order->user;
$user->salesValueLogs()->create([
'order_id' => $order->id,
'order_user_id' => $user_id,
'type' => SalesValueLog::TYPE_INDIVIDUAL,
'change_sales_value' => $sales_value
]);
$user->userInfo()->increment('growth_value', $sales_value);
// 上级返现
$parent_ids = array_reverse($user->userInfo->parent_ids);
$parents = User::with(['userInfo'])->whereIn('id', $parent_ids)->where('role', '!=', '')->get();
// 没有上级是代理身份
if ($parents->count() === 0) {
return false;
}
$setting = new SettingService();
$conf = $setting->get('distribution');
foreach($parents as $item) {
$slug = explode('-', $item->userInfo->role);
$role = $slug[0];
$level = $slug[1];
$ratio = data_get($conf, $role . '-profit-' . $level);
}
}
}

View File

@ -77,10 +77,7 @@
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"easywechat-composer/easywechat-composer": true
}
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true

View File

@ -11,7 +11,7 @@ return [
| login page.
|
*/
'name' => '管理后台',
'name' => '子春生-管理后台',
/*
|--------------------------------------------------------------------------
@ -22,7 +22,7 @@ return [
| `img` tag, eg '<img src="http://logo-url" alt="Admin logo">'.
|
*/
'logo' => '管理后台',
'logo' => '<img src="/images/logo.png" width="35"> &nbsp;子春生-管理后台',
/*
|--------------------------------------------------------------------------
@ -34,7 +34,7 @@ return [
| '<img src="http://logo-url" alt="Admin logo">'.
|
*/
'logo-mini' => '',
'logo-mini' => '<img src="/images/logo.png">',
/*
|--------------------------------------------------------------------------
@ -96,7 +96,7 @@ return [
| Html title for all pages.
|
*/
'title' => '管理后台',
'title' => '子春生-管理后台',
/*
|--------------------------------------------------------------------------
@ -264,7 +264,7 @@ return [
'upload' => [
// Disk in `config/filesystem.php`.
'disk' => env('FILESYSTEM_DRIVER'),
'disk' => 'aliyun',
// Image and file upload path under the disk above.
'directory' => [

View File

@ -1,37 +0,0 @@
<?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->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']);
});
}
}

View File

@ -1,42 +0,0 @@
<?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');
}
}

View File

@ -1,33 +0,0 @@
<?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']);
});
}
}

View File

@ -1,33 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateStoresTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('stores', function (Blueprint $table) {
$table->id();
$table->string('title')->comment('标题');
$table->string('image')->comment('封面图');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('stores');
}
}

View File

@ -14,7 +14,7 @@ class AdminSeeder extends Seeder
public function run()
{
$this->call([
AdminMenuSeeder::class,
// AdminMenuSeeder::class,
AdminPermissionSeeder::class,
]);
}

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +0,0 @@
<?php
return [
'labels' => [
'Store' => '门店',
'store' => '门店',
],
'fields' => [
'title' => '标题',
'image' => '封面图',
],
'options' => [
],
];