Commit 1d5d5949 by lizhilin

上传

parents
File added
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_size = 2
[docker-compose.yml]
indent_size = 4
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=
BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
MEMCACHED_HOST=127.0.0.1
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_HOST=
PUSHER_PORT=443
PUSHER_SCHEME=https
PUSHER_APP_CLUSTER=mt1
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
* text=auto
*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php
/.github export-ignore
CHANGELOG.md export-ignore
.styleci.yml export-ignore
/node_modules
/public/build
/public/hot
/public/storage
/public
/storage/*.key
/vendor
.env
.env.backup
.env.production
.phpunit.result.cache
Homestead.json
Homestead.yaml
auth.json
npm-debug.log
yarn-error.log
/.fleet
/.idea
/.vscode
<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" alt="Laravel Logo"></a></p>
<p align="center">
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.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>
## 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:
- [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.
You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch.
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 2000 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)**
- **[WebReinvent](https://webreinvent.com/?utm_source=laravel&utm_medium=github&utm_campaign=patreon-sponsors)**
- **[Lendio](https://lendio.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).
<?php
namespace App\Admin\Actions;
use Dcat\Admin\Actions\Action;
use Dcat\Admin\Actions\Response;
use Illuminate\Support\Facades\Storage;
/**
* 下载导入模板
* Class DownloadTemplate
*
* @package App\Admin\Actions
*/
class DownloadTemplateExcel extends Action
{
/**
* @return string
*/
protected $title = '<button class="btn btn-primary"><i class="feather icon-download"></i> 下载导入模板</button>';
/**
* Handle the action request.
*
* @return Response
*/
public function handle()
{
$file_name = '';
switch ($this->getKey()) {
case 'good':
$file_name = '商品资源库导入模版';
break;
}
return $this->response()->download('/excelTemplate/' . $file_name . '.xlsx');
}
public function parameters()
{
return [
'mode' => '',
];
}
}
<?php
namespace App\Admin\Actions;
use App\Command\Log;
use Dcat\Admin\Actions\Action;
use Dcat\Admin\Actions\Response;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
/**
* 导出商品
*
* @package App\Admin\Actions
*/
class GoodsExcel extends Action
{
protected $request_param = [];
protected $request_filename = '';
protected $title = '';
/**
* 接收参数
*/
public function __construct($param = [], $filename = '', $title = '')
{
$this->request_param = $param;
$this->request_filename = $filename;
parent::__construct($title);
$this->title = $title;
}
//protected $title = '<button class="btn btn-primary"><i class="feather icon-download"></i> 下载模板</button>';
/**
* 按钮文本
*
* @return string|void
*/
public function title()
{
return '<button class="btn btn-primary"><i class="feather icon-download"></i> ' . $this->title . '</button>';
}
/**
* Handle the action request.
*
* @return Response
*/
public function handle(Request $request)
{
$param = $request->get('param');
$filename = $request->get('filename');
//调用导出接口
return $this->response()->download('/goods-export?filename=' . $filename . '&param=' . json_encode($param) . '&_export_=1');
}
public function parameters()
{
return [
'mode' => '',
'param' => $this->request_param,
'filename' => $this->request_filename,
'title' => $this->title,
];
}
}
<?php
namespace App\Admin\Actions;
use Dcat\Admin\Actions\Response;
use App\Admin\Forms\MerchantStoreForms;
use App\Models\Good;
use Dcat\Admin\Grid\RowAction;
use Dcat\Admin\Traits\HasPermissions;
use Illuminate\Contracts\Auth\Authenticatable;
//use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\Request;
use Dcat\Admin\Widgets\Modal;
use App\Models\GoodSku;
use App\Models\MerchantGoodSku;
class MerchantStore extends RowAction
{
protected $type = 0;
protected $title = '';
protected $goods_id = 0;
/**
* 接收参数
* @type 1:增加库存 2:减少库存
*/
public function __construct($type = 0, $title = '', $goods_id = 0)
{
$this->type = $type;
$this->goods_id = $goods_id;
parent::__construct($title);
$this->title = $title;
}
/**
* @return string
*/
//protected $title = '<i class="feather icon-stop-circle"> 增加库存 </i>';
/**
* 按钮文本
*
* @return string|void
*/
public function title()
{
return '<i class="feather icon-stop-circle"></i> ' . $this->title . $this->type . '';
}
/**
* Handle the action request.
*
* @param Request $request
*
* @return Response
*/
public function handle(Request $request)
{
$id = $this->getKey() ?? 0;
$type = $request->get('type');
return $this->response()->success('成功')->refresh();
}
/**
* 渲染模态框.
* @return Modal
*/
public function render()
{
$mgs_id = $this->getKey() ?? 0;
$goodObj = Good::where("id", $this->goods_id)->first();
//获取商品规格信息
if ($this->type == 1) {
$dataList = GoodSku::where("goods_id", $this->goods_id)->get();
} else {
$dataList = MerchantGoodSku::where("mgs_id", $mgs_id)->get();
foreach ($dataList as $kk => $vv) {
$skuObj = GoodSku::find($vv['attr_id']);
$dataList[$kk]['attr_val'] = $skuObj->attr_val;
}
}
$dataArr = $dataList ? $dataList->toArray() : [];
$html = '';
foreach ($dataArr as $kk => $vv) {
$html .= '<tr>';
if ($this->type == 2) {
$html .= '<input type="hidden" name="sskuid[]" value="' . $vv['id'] . '">';
}
$html .= '<input type="hidden" name="goods_id" value="' . $this->goods_id . '">';
$html .= '<input type="hidden" name="mgs_id" value="' . $mgs_id . '">';
$html .= '<input type="hidden" name="typeid" value="' . $this->type . '">';
$html .= '<td style="text-align:center;vertical-align: middle;">' . $goodObj->goods_name . '<input type="hidden" name="attr_id[]" value="' . $vv['id'] . '"></td>';
$html .= '<td style="text-align:center;vertical-align: middle;">' . $vv['attr_val'] . '</td>';
$html .= '<td ><input type="text" name="stock[]" value="" class="form-control field_remark _normal_" placeholder=""></td>';
$html .= '<td style="text-align:center;vertical-align: middle;">' . $vv['stock'] . '</td>';
$html .= '</tr>';
}
// 这里直接创建一个modal框 model的内容由工具表单提供,这里也需要创建一个工具表单才行
return Modal::make()
->lg()
->title($this->title)
->button("$this->title")
// ->body('<form action="' . $actionUrl . '" method="post" class="form-horizontal" accept-charset="UTF-8" pjax-container="1" >
// <div class="row">
// <div class="col-md-12">
// <table class="table">
// <thead>
// <tr>
// <th width="20%" style="text-align:center;">商品名称</th>
// <th width="20%" style="text-align:center;">商品规格</th>
// <th width="20%" style="text-align:center;">增加库存</th>
// <th width="20%" style="text-align:center;">剩余库存</th>
// </tr>
// </thead>
// <tbody>
// <!-- 表格数据 -->
// <!--<tr>
// <td style="text-align:center;vertical-align: middle;">数据1</td>
// <td style="text-align:center;vertical-align: middle;">蓝色、大号</td>
// <td ><input type="text" name="remark" value="" class="form-control field_remark _normal_" placeholder=""></td>
// <td style="text-align:center;vertical-align: middle;">123</td>
// </tr>-->
// ' . $html . '
// <!-- 更多行数据 -->
// </tbody>
// </table>
// </div>
// <div class="col-md-8"><button type="submit" class="btn btn-primary pull-right"><i class="feather icon-save"></i> 提交</button></div>
// </div>
// </form>
// ');
->body(MerchantStoreForms::make(['id' => $this->type]))
->onShown(
<<<js
$("#storeTitle").html('{$this->title}');
$("#tabletr").html('"+ $html +"');
js
);
//->button("<button class='btn btn-sm btn-primary'>$this->title</button>"); // 这个button就是对应上面的按钮
}
/**
* @return string|array|void
*/
public function confirm()
{
// return ['Confirm?', 'contents'];
}
/**
* @param Model|Authenticatable|HasPermissions|null $user
*
* @return bool
*/
protected function authorize($user): bool
{
return true;
}
/**
* @return array
*/
protected function parameters()
{
return [];
}
}
<?php
namespace App\Admin\Controllers;
use App\Admin\Repositories\Article;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use App\Models\Category;
use Dcat\Admin\Http\Controllers\AdminController;
use Dcat\Admin\Widgets\Modal;
use Dcat\Admin\Widgets\Card;
class ArticleController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(Article::with(['cat']), function (Grid $grid) {
$grid->model()->orderBy('created_at', 'DESC');
$grid->column('id')->sortable();
$grid->column('title');
$grid->column('cat.title', '分类名称');
$grid->column('content')->if(function ($column) {
return $column->getValue();
})->display('点击查看')->modal(function ($modal) {
//设置弹窗标题
$modal->title('文章内容');
$card = new Card(null, $this->content);
return "<div style='padding:10px 10px 0;width:100%;'>$card</div>";
})->else(function ($column) {
return '';
});
// $grid->column('created_at');
// $grid->column('updated_at')->sortable();
$grid->disableViewButton();
$grid->disableRowSelector();
$grid->filter(function (Grid\Filter $filter) {
// 更改为 panel 布局
$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 Article(), function (Show $show) {
$show->field('id');
$show->field('title');
$show->field('cat_id');
$show->field('content');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new Article(), function (Form $form) {
$form->display('id');
$form->text('title');
$form->select('cat_id', '商品分类')
->options(Category::selectOptions())
->saving(function ($v) {
return $v ?? 0;
});
$form->image('cover', '封面')
->url('upload/user')
->autoUpload();
$form->editor('content');
$form->disableCreatingCheck();
$form->disableEditingCheck();
$form->disableViewCheck();
$form->disableDeleteButton();
$form->disableViewButton();
});
}
}
<?php
namespace App\Admin\Controllers;
use Dcat\Admin\Http\Controllers\AuthController as BaseAuthController;
class AuthController extends BaseAuthController
{
protected $view = 'admin.login';
}
<?php
namespace App\Admin\Controllers;
use App\Models\Carousel;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class CarouselController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new Carousel(), function (Grid $grid) {
$grid->addTableClass(['table-text-left']);
$grid->model()->orderBy('created_at', 'DESC');
$grid->column('id')->sortable()->width('10%');
$grid->column('title')->width('30%');
$grid->column('imgUrl')->image('', 100, 100)->width('20%');
$grid->column('status')->switch();
$grid->disableViewButton();
$grid->disableEditButton();
$grid->enableDialogCreate();
$grid->showQuickEditButton();
//$grid->disableFilterButton();
$grid->filter(function (Grid\Filter $filter) {
// 更改为 panel 布局
$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 Carousel(), function (Show $show) {
$show->field('id');
$show->field('title');
$show->field('imgUrl');
$show->field('status');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new Carousel(), function (Form $form) {
$form->text('title');
$form->image('imgUrl')
->accept('jpg,jpeg,png')
->maxSize(4096)
->url('upload/carousel')
->help('仅支持jpg、jpeg、png格式图片上传(商城页 750px*340px、首页 750px*750px、文章页 750px*750px)')
->autoUpload();
$form->switch('status')->default(1);
});
}
}
<?php
namespace App\Admin\Controllers;
use App\Models\Category;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Layout\Content;
use Dcat\Admin\Layout\Row;
use Dcat\Admin\Tree;
use Dcat\Admin\Http\Controllers\AdminController;
class CategoryController extends AdminController
{
public function index(Content $content)
{
return $content->header('分类')
->description('列表')
->body(function (Row $row) {
$tree = new Tree(new Category());
$tree->branch(function ($branch) {
return "{$branch['title']}";
});
$row->column(12, $tree);
$tree->disableCreateButton();
});
return $content;
}
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new Category(), function (Grid $grid) {
$grid->column('id')->sortable();
$grid->column('parent_id');
$grid->column('title');
$grid->column('icon');
$grid->column('order');
$grid->column('show');
$grid->column('created_at');
$grid->column('updated_at')->sortable();
$grid->filter(function (Grid\Filter $filter) {
$filter->equal('id');
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new Category(), function (Show $show) {
$show->field('id');
$show->field('parent_id');
$show->field('title');
$show->field('icon');
$show->field('order');
$show->field('show');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new Category(), function (Form $form) {
$form->display('id');
$form->select('parent_id')
->options(Category::selectOptions())
->saving(function ($v) {
return $v ?? 0;
});
$form->text('title');
$form->image('icon', '分类图标')
->accept('jpg,jpeg,png')
->maxSize(4096)
->url('upload/category')
->help('仅支持jpg、jpeg、png格式图片上传(750px * 420px)')
->autoUpload();
$form->text('order')->help('越小越靠前');
$form->switch('show', '状态')->default(1);
// $form->display('created_at');
// $form->display('updated_at');
});
}
}
<?php
namespace App\Admin\Controllers;
use App\Models\CheckNumber;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
use Illuminate\Support\Str;
use Dcat\Admin\Widgets\Modal;
use App\Admin\Forms\GenerateUserCode;
class CheckNumberController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new CheckNumber(), function (Grid $grid) {
$grid->tools(function (Grid\Tools $tools) {
$tools->append(Modal::make()
// 大号弹窗
->lg()
// 弹窗标题
->title('新增')
// 按钮
->button('<button class="btn btn-primary"> 新增</button>')
// 弹窗内容
->body(GenerateUserCode::make()->payload(['className' => CheckNumber::class])));
//->body(ImportExcel::make()->payload(['className' => CheckNumber::class])));
});
$grid->model()->orderBy('id', 'DESC');
$grid->column('id')->sortable();
$grid->column('code', '审核编号');
$grid->column('status', '使用状态')->display(function ($val) {
return $val == 0 ? '未使用' : '已使用';
});;
$grid->column('created_at');
//$randomNumber = $this->generateRandomString(6);
$grid->disableFilterButton();
$grid->disableViewButton();
$grid->disableEditButton();
$grid->disableCreateButton();
$grid->enableDialogCreate();
$grid->filter(function (Grid\Filter $filter) {
$filter->equal('id');
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new CheckNumber(), function (Show $show) {
$show->field('id');
$show->field('code');
$show->field('status')->display(function ($val) {
return $val == 0 ? '未使用' : '已使用';
});
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new CheckNumber(), function (Form $form) {
$form->display('id');
$form->text('number', '生成数量');
//$form->text('status');
$form->display('created_at');
$form->display('updated_at');
});
}
}
<?php
namespace App\Admin\Controllers;
use App\Models\City;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
use Illuminate\Http\Request;
class CityController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new City(), function (Grid $grid) {
$grid->column('id')->sortable();
$grid->column('created_at');
$grid->column('updated_at')->sortable();
$grid->filter(function (Grid\Filter $filter) {
$filter->equal('id');
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new City(), function (Show $show) {
$show->field('id');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new City(), function (Form $form) {
$form->display('id');
$form->display('created_at');
$form->display('updated_at');
});
}
public function getList(Request $request)
{
$provinceId = $request->get('q');
return City::where('parent_id', $provinceId)->get(['city_id as id', 'name as text']);
}
}
<?php
namespace App\Admin\Controllers;
use App\Models\Comment;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class CommentController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(Comment::with(['goods']), function (Grid $grid) {
$grid->model()->orderBy('created_at', 'DESC');
$grid->column('id')->sortable();
$grid->column('goods.goods_name', '商品标题');
$grid->column('avatar', '用户头像')->image('', 100, 100);
$grid->column('nickname', '用户昵称');
$grid->column('phone', '用户手机');
$grid->column('content', '评价内容')->limit(20);
$grid->column('addtime', '评价时间');
// $grid->column('updated_at')->sortable();
$grid->disableViewButton();
$grid->disableEditButton();
$grid->filter(function (Grid\Filter $filter) {
// 更改为 panel 布局
$filter->panel();
$filter->like('goods.goods_name', '商品标题')->width(3);
$filter->like('phone', '用户手机')->width(3);
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new Comment(), function (Show $show) {
$show->field('id');
$show->field('title');
$show->field('nickname');
$show->field('avatar');
$show->field('phone');
$show->field('content');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new Comment(), function (Form $form) {
$form->display('id');
$form->number('goods_id', "商品编号")->help('商品列表序号ID');
$form->datetime('addtime', '评价时间')
->format('YYYY-MM-DD HH:mm:ss');
$form->text('nickname');
$form->text('phone');
$form->number('star', '满意度')->min(1)->max(5)->default(5);
$form->textarea('content');
$form->image('avatar', '头像')
->url('upload/user')
->autoUpload();
$form->disableCreatingCheck();
$form->disableEditingCheck();
$form->disableViewCheck();
$form->disableDeleteButton();
$form->disableViewButton();
});
}
}
<?php
namespace App\Admin\Controllers;
use App\Models\CommentTpl;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class CommentTplController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new CommentTpl(), function (Grid $grid) {
$grid->column('id')->sortable();
$grid->column('title')->width(100);
$grid->column('content')->limit(100);
// $grid->column('created_at');
// $grid->column('updated_at')->sortable();
$grid->disableViewButton();
$grid->filter(function (Grid\Filter $filter) {
// 更改为 panel 布局
$filter->panel();
$filter->like('title');
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new CommentTpl(), function (Show $show) {
$show->field('id');
$show->field('title');
$show->field('content');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new CommentTpl(), function (Form $form) {
$form->display('id');
$form->text('title');
$form->textarea('content');
$form->disableCreatingCheck();
$form->disableEditingCheck();
$form->disableViewCheck();
$form->disableDeleteButton();
$form->disableViewButton();
});
}
}
<?php
namespace App\Admin\Controllers;
use App\Command\Log;
use App\Models\Good;
use App\Models\GoodSku;
use App\Models\Category;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
use Dcat\Admin\Widgets\Card;
use Dcat\Admin\Widgets\Modal;
use App\Admin\Forms\ImportExcel;
use App\Admin\Actions\DownloadTemplateExcel;
use Illuminate\Support\Facades\DB;
use App\Admin\Renderable\RenderGoodSku;
use App\Admin\Repositories\GoodSku as SkuRepos;
use App\Admin\Actions\GoodsExcel;
use Illuminate\Http\Request;
use App\Admin\Extensions\GoodsExport;
use Maatwebsite\Excel\Facades\Excel;
class GoodController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new Good(), function (Grid $grid) {
$grid->model()->orderBy('created_at', 'DESC');
$grid->column('id')->sortable();
$grid->column('goods_sn', '商品编号')->width(80);
$grid->column('goods_name')->limit(15)->width(250);
$grid->column('cover_img', '商品图片')->image('', 100, 100);
$grid->column('sku', '规格信息')->expand(function (Grid\Displayers\Expand $expand) {
$expand->button('查看');
return RenderGoodSku::make(['goods_id' => $this->id]);
});
$grid->column('sort', '排序');
$grid->column('is_hot', '是否推荐')->display(function ($val) {
return ($val == 1) ? '是' : '否';
});
$grid->column('is_show', '状态')->switch('', true);
//$grid->column('updated_at')->sortable();
$grid->disableViewButton();
$grid->actions(function (Grid\Displayers\Actions $actions) {
// 假设我们根据模型的 status 字段来控制编辑按钮的显示
if ($actions->row->is_show == 1) {
//则不显示编辑按钮
$actions->disableEdit();
}
});
$grid->filter(function (Grid\Filter $filter) {
// 更改为 panel 布局
$filter->panel();
$filter->like('goods_name')->width(3);
$filter->equal('is_hot', '是否推荐')->select(['1' => '是', '0' => '否'])->width(3);
$filter->equal('is_show', '上架状态')->select(['1' => '是', '0' => '否'])->width(3);
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, Good::with(['category']), function (Show $show) {
$show->field('id');
$show->field('goods_name');
$show->field('category.title', '分类名称');
$show->field('product_no');
$show->field('material');
$show->field('product_no');
$show->field('box_size');
$show->relation('gattr', function ($model) {
$grid = new Grid(new SkuRepos());
$grid->model()->where('goods_id', $model->id);
// 设置路由
$grid->setResource('gattr');
$grid->id();
$grid->content()->limit(10);
$grid->attr_val();
$grid->attr_sn();
$grid->created_at();
$grid->updated_at();
// $grid->filter(function ($filter) {
// $filter->like('content')->width('300px');
// });
return $grid;
});
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
$form = Form::make(new Good(), function (Form $form) {
$form->display('id');
$form->tab('基本信息', function (Form $form) {
$form->text('goods_name', '商品名称')->required();
$form->text('goods_sn', '商品编号');
$form->text('first_commission', '直推佣金比例')->help("比例如:30");
$form->text('second_commission', '简推佣金比例')->help("比例如:10");
$form->text('merchant_commission', '商家佣金比例')->help("比例如:10");
$form->text('sale', '销量');
$form->text('high_opinion', '好评');
//$form->text('box_size');
$form->image('cover_img')
->accept('jpg,jpeg,png')
->maxSize(4096)
->url('upload/goods')
->help('仅支持jpg、jpeg、png格式图片上传(320px * 320px)')
->autoUpload()->required();
$form->multipleImage('carousel', '产品图')
->accept('jpg,jpeg,png')
->maxSize(51200)
->url('upload/goods')
->help('仅支持jpg、jpeg、png格式图片上传(尺寸 750px*750px)')
->limit(5)
->autoUpload()->saveAsJson()->required();
$form->switch('is_show', '上架状态')->default(1);
$form->switch('is_hot', '是否推荐')->default(0);
$form->text('sort', '排序')->default(0)->help('越大越靠前');
$form->disableCreatingCheck();
$form->disableEditingCheck();
$form->disableViewCheck();
$form->disableDeleteButton();
$form->disableViewButton();
})->tab('规格', function (Form $form) {
$sku = $form->model()->sku;
//$str = '{"attrs":{"颜色":["红色","蓝色"],"大小":["20"]},"sku":[{"颜色":"红色","大小":"20","pic":"图片","stock":"106","price":"100","column1":"5","column2":""},{"颜色":"蓝色","大小":"20","pic":"","stock":"89","price":"90","column1":"51","column2":""}]}';
$sku_params = [
[
'name' => '库存', // table 第一行 title
'field' => 'stock', // input 的 field_name 名称
'default' => '', // 默认值
],
];
$form->sku('sku', json_encode($sku_params))->display(true)->customFormat(function ($value) use ($form, $sku) {
return $sku;
})->required();
})->tab('详情', function (Form $form) {
$form->editor('goods_desc');
});
});
//副表保存规格
$form->saved(function (Form $form, $result) {
$goods_id = $form->getKey();
//是否操作规格数据(编辑时)
$skuexist = GoodSku::where("goods_id", $goods_id)->count();
//Log::add('规格数据', $skuArr);
if (isset($_POST['sku'])) {
$skuStr = $_POST['sku'];
$skuArr = json_decode($skuStr, true);
$attrs = isset($skuArr['attrs']) ? $skuArr['attrs'] : [];
$attrsKey = $attrs ? array_keys($attrs) : [];
if ($skuexist == 0) { //新增
$skuArr['sku'] = self::addGoodSkuData($attrsKey, $skuArr['sku'], $goods_id);
} else {
//编辑
$skuArr['sku'] = self::editGoodSkuData($attrsKey, $skuArr['sku'], $goods_id);
}
$skuCon = json_encode($skuArr, JSON_UNESCAPED_UNICODE);
DB::table('li_goods')->where("id", $goods_id)->update(['sku' => $skuCon]);
}
});
$form->submitted(function (Form $form) {
$goods_id = $form->getKey();
$is_show = isset($_POST['is_show']) ? $_POST['is_show'] : 0;
$skuStr = isset($_POST['sku']) ? $_POST['sku'] : '';
$skuArr = json_decode($skuStr, true);
$skuVal = isset($skuArr['sku']) ? $skuArr['sku'] : [];
if (isset($_POST['sku']) && !$skuVal && $is_show) {
$form->responseValidationMessages('sku', "商品规格不为空");
}
});
return $form;
}
public static function addGoodSkuData($attrsKey, $sku, $gid)
{
foreach ($sku as $kk => $vv) {
$attr_name = [];
foreach ($attrsKey as $val) {
array_push($attr_name, $vv[$val]);
}
utf8_array_asort($attr_name);
$attr_val = join("、", $attr_name);
$attr_sn = md5($attr_val);
$goodSkuObj = new GoodSku();
$goodSkuObj->goods_id = $gid;
$goodSkuObj->attr_val = $attr_val;
$goodSkuObj->attr_sn = $attr_sn;
$goodSkuObj->market_price = $vv['market_price'];
$goodSkuObj->cg_price = $vv['cg_price'];
$goodSkuObj->stock = $vv['stock'];
$goodSkuObj->pic = $vv['pic'];
$goodSkuObj->save();
//规格标识
$sku[$kk]['attr_sn'] = $attr_sn;
}
return $sku;
}
public static function editGoodSkuData($attrsKey, $sku, $gid)
{
$existAttrSn = []; //规格数组
$editAttrSn = []; //已编辑存在的规格
$glist = GoodSku::where("goods_id", $gid)->get()->toArray();
foreach ($glist as $key => $val) {
array_push($existAttrSn, $val['attr_sn']);
}
foreach ($sku as $kk => $vv) {
$attr_name = [];
foreach ($attrsKey as $val) {
array_push($attr_name, $vv[$val]);
}
utf8_array_asort($attr_name);
$attr_val = join("、", $attr_name);
$attr_sn = md5($attr_val);
if (in_array($attr_sn, $existAttrSn)) {
$goodSkuObj = GoodSku::where(['attr_sn' => $attr_sn, 'goods_id' => $gid])->first();
$editAttrSn[] = $attr_sn;
} else {
$goodSkuObj = new GoodSku();
$goodSkuObj->goods_id = $gid;
}
$goodSkuObj->attr_val = $attr_val;
$goodSkuObj->pic = $vv['pic'];
$goodSkuObj->attr_sn = $attr_sn;
$goodSkuObj->market_price = $vv['market_price'];
$goodSkuObj->cg_price = $vv['cg_price'];
$goodSkuObj->stock = $vv['stock'];
$goodSkuObj->save();
//规格标识
$sku[$kk]['attr_sn'] = $attr_sn;
}
//取数组差集
$noAttrSn = array_diff($existAttrSn, $editAttrSn);
if ($noAttrSn) {
foreach ($noAttrSn as $k => $v) {
DB::table('li_goods_sku')->where(['goods_id' => $gid, 'attr_sn' => $v])->delete();
}
//清除商家商品记录
DB::table('merchant_store_sku')->where(['goods_id' => $gid])->delete();
}
return $sku;
}
/**
* 导出
*
* @param Request $request
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
*/
public function export(Request $request)
{
$filename = $request->get('filename');
$param = json_decode($request->get('param'));
ob_end_clean();
return Excel::download(new GoodsExport($param), $filename . '.xlsx');
}
}
<?php
namespace App\Admin\Controllers;
use App\Admin\Metrics\Examples;
use App\Http\Controllers\Controller;
use Dcat\Admin\Http\Controllers\Dashboard;
use Dcat\Admin\Layout\Column;
use Dcat\Admin\Layout\Content;
use Dcat\Admin\Layout\Row;
class HomeController extends Controller
{
public function index(Content $content)
{
return $content
->header('Dashboard')
->description('Description...')
->body(function (Row $row) {
$row->column(12, function (Column $column) {
$column->row(function (Row $row) {
$row->column(6, new Examples\NewUsers());
$row->column(6, new Examples\GoodsTotal());
$row->column(12, new Examples\Product());
});
});
// $row->column(12, function (Column $column) {
// $column->row(function (Row $row) {
// //$row->column(12, new Examples\Product());
// });
// // $column->row(new Examples\Sessions());
// // $column->row(new Examples\ProductOrders());
// });
// $row->column(12,'欢迎登录');
});
}
}
<?php
namespace App\Admin\Controllers;
use App\Models\Income;
use App\Models\User;
use App\Models\Merchant;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class IncomeController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new Income(), function (Grid $grid) {
$grid->column('id')->sortable();
//$grid->column('merchant.name', '商户名称');
$grid->column('user_type', '提现类型')->using(Income::USER_TYPE, '');
$grid->column('um_id', '提现人员')->display(function ($vel) {
if ($this->user_type == 1) {
return User::find($vel)->name ?? '';
}
return Merchant::find($vel)->name ?? '';
});
$grid->column('phone', '手机号');
$grid->column('amount');
$grid->column('status');
$grid->column('created_at', '提现时间');
//$grid->column('updated_at')->sortable();
$grid->disableCreateButton();
$grid->disableActions();
$grid->disableRowSelector();
$grid->filter(function (Grid\Filter $filter) {
// 更改为 panel 布局
$filter->panel();
$filter->like('phone', '手机号')->width(4);
$filter->between('created_at', '提现时间')->datetime()->width(4);
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new Income(), function (Show $show) {
$show->field('id');
$show->field('user_id');
$show->field('amount');
$show->field('status');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new Income(), function (Form $form) {
$form->display('id');
$form->text('user_id');
$form->text('amount');
$form->text('status');
$form->display('created_at');
$form->display('updated_at');
});
}
}
<?php
namespace App\Admin\Controllers;
use App\Models\Kefu;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class KefuController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new Kefu(), function (Grid $grid) {
$grid->column('id');
$grid->column('title', '平台客服名称');
$grid->column('contact', '联系方式');
$grid->column('is_type', '拨打/复制')->display(function ($val) {
return $val == 1 ? '复制' : '拨打';
});
$grid->disableFilterButton();
$grid->disableViewButton();
$grid->disableEditButton();
$grid->enableDialogCreate();
$grid->showQuickEditButton();
$grid->filter(function (Grid\Filter $filter) {
$filter->equal('id');
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new Kefu(), function (Show $show) {
$show->field('id');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new Kefu(), function (Form $form) {
$form->display('id');
$form->text('title', '平台客服名称');
$form->text('contact', '联系方式');
$form->select('is_type', '拨打/复制')->options([2 => '拨打', 1 => '复制']);
// $form->display('created_at');
// $form->display('updated_at');
});
}
}
<?php
namespace App\Admin\Controllers;
use App\Models\Merchant;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use App\Models\City;
use Illuminate\Http\Request;
use Dcat\Admin\Http\Controllers\AdminController;
use Illuminate\Support\Facades\DB;
use App\Admin\Renderable\StoreList;
class MerchantController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new Merchant(), function (Grid $grid) {
$grid->column('id')->sortable();
$grid->column('name');
$grid->column('cityinfo', '所在省市')->display(function ($val) {
$proObj = City::where("city_id", $this->province_id)->first();
$cityObj = City::where("city_id", $this->city_id)->first();
$proname = $proObj->name ?? '';
$cityname = $cityObj->name ?? '';
return $proname . " " . $cityname;
});
$grid->column('store', '门店信息')->expand(function (Grid\Displayers\Expand $expand) {
$expand->button('查看');
return StoreList::make(['merchant_id' => $this->id]);
})->width(100);
$grid->column('contacts', '联系人');
$grid->column('phone');
$grid->column('account', '登录账号');
$grid->column('buycode', '直购码');
// $grid->column('created_at');
// $grid->column('updated_at')->sortable();
$grid->disableViewButton();
$grid->filter(function (Grid\Filter $filter) {
// 更改为 panel 布局
$filter->panel();
$filter->like('name')->width(3);
$filter->like('contacts', '联系人')->width(3);
$filter->like('phone')->width(3);
$filter->like('buycode')->width(3);
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new Merchant(), function (Show $show) {
$show->field('id');
$show->field('name');
$show->field('contacter');
$show->field('phone');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
$form = Form::make(Merchant::with(['store_desc']), function (Form $form) {
$form->display('id');
$form->text('name')->required();
$form->text('contacts', '联系人');
$form->text('phone');
$form->text('account');
$form->text('pwd')->help('字母数字组合,长度大于5个字符');
$form->select('province_id', '省份')->options(City::where('parent_id', 0)->get()->pluck('name', 'city_id'))->rules('required')->load('city_id', '/city');
// 城市
$form->select('city_id', '城市');
$form->hasMany('store_desc', '添加门店', function (\Dcat\Admin\Widgets\Form $forms) {
$forms->text('title', '门店名称')->required();
$forms->text('lat_lng', '经纬度')->help('<a href="https://lbs.amap.com/tools/picker" target="_blank">点击获取高德地图坐标</a>');
$forms->text('address', '详细地址');
$forms->text('distance', '配送范围(Km)');
$forms->image('business_license', '营业执照')
->accept('jpg,jpeg,png')
->maxSize(4096)
->url('upload/merchant')
->help('仅支持jpg、jpeg、png格式图片上传')
->autoUpload();
});
$form->disableCreatingCheck();
$form->disableEditingCheck();
$form->disableViewCheck();
$form->disableDeleteButton();
$form->disableViewButton();
});
//副表保存规格
$form->saved(
function (Form $form, $result) {
$merchant_id = $form->getKey();
$account = $form->model()->account;
$pwd = $form->model()->pwd ?? '123456';
//生成商城后台账号
$admin_users = DB::table('store_admin_users')->where("username", $account)->first();
$time = time();
if (!$admin_users) {
$storeAdmin_id = DB::table('store_admin_users')->insertGetId(
['username' => $account, 'password' => bcrypt($pwd), 'name' => $account, 'created_at' => date('Y-m-d H:i:s', $time), 'updated_at' => date('Y-m-d H:i:s', $time)]
);
DB::table('store_admin_role_users')->insert([
'role_id' => 1,
'user_id' => $storeAdmin_id,
'created_at' => date('Y-m-d H:i:s', $time),
'updated_at' => date('Y-m-d H:i:s', $time)
]);
} else {
$storeAdmin_id = $admin_users->id;
if ($pwd != '123456') { //更新密码
$admin_users->password = bcrypt($pwd);
$admin_users->save();
}
}
//首次写入直购码
$merObj = Merchant::where("id", $merchant_id)->first();
if (!$merObj->buycode) {
$flag = 0;
$code = '';
do {
$code = mt_rand(1000, 9999);
$exist = Merchant::where("buycode", $code)->count();
if (!$exist) {
$flag = 1;
}
} while ($flag < 1);
//保存直购码
$merObj->buycode = $code;
$merObj->save();
}
}
);
return $form;
}
}
<?php
namespace App\Admin\Controllers;
use App\Models\MerchantStore;
use App\Models\Merchant;
use App\Models\Good;
use App\Models\MerchantGoodSku;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use App\Models\City;
use App\Models\Store;
use Illuminate\Support\Facades\DB;
use Dcat\Admin\Http\Controllers\AdminController;
use App\Admin\Actions\MerchantStore as MerchantStoreActions;
use Dcat\Admin\Admin;
use Dcat\Admin\Layout\Content;
use Illuminate\Http\Request;
use App\Admin\Renderable\MerchantStoreSkuList;
class MerchantGoodsStoreController extends AdminController
{
// public function index(Content $content)
// {
// echo 11;
// die;
// }
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(MerchantStore::with(['goods', 'merchant']), function (Grid $grid) {
$grid->column('id')->sortable();
$grid->column('goods_sn', '商品编号');
$grid->column('goods.goods_name', '商品名称');
$grid->column('goods.cover_img', '商品图片')->image('', 100, 100);
$grid->column('attr', '商品规格')->expand(function (Grid\Displayers\Expand $expand) {
$expand->button('查看');
return MerchantStoreSkuList::make(['mgs_id' => $this->id]);
})->width(100);
$grid->column('store', '库存')->display(function ($val) {
return MerchantGoodSku::where(['mgs_id' => $this->id])->sum('stock');
});
$grid->column('merchant.name', '商家名称');
$grid->column('merchant.contacts', '联系人');
//$grid->column('created_at');
//$grid->column('updated_at')->sortable();
$grid->disableViewButton();
$grid->disableCreateButton();
$grid->filter(function (Grid\Filter $filter) {
// 更改为 panel 布局
$filter->panel();
$filter->like('goods.goods_name', '商品名称')->width(3);
$filter->like('merchant.name', '商家名称')->width(3);
$filter->like('merchant.contacts', '联系人')->width(3);
});
$grid->actions(function (Grid\Displayers\Actions $actions) {
//当前status
$status = $actions->row->status;
if ($status == 0) {
$actions->append(new MerchantStoreActions(1, '增加库存', $actions->row->goods_id));
$actions->append(new MerchantStoreActions(2, '减少库存', $actions->row->goods_id));
}
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new MerchantStore(), function (Show $show) {
$show->field('id');
$show->field('name');
$show->field('contacter');
$show->field('phone');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
$form = Form::make(new MerchantStore(), function (Form $form) {
$form->display('id');
$form->select('merchant_id', '商家名称')->options(Merchant::whereNull('deleted_at')->get()->pluck('name', 'id'))->rules('required'); //->load('merchat_id', '/get-merchat-list');
$form->select('goods_id', '添加商品')->options((new Good())->limit(100)->get()->pluck('goods_name', 'id'))->rules('required'); //->load('merchat_id', '/get-merchat-list');
// // 城市
// $form->select('city_id', '城市');
// $form->hasMany('store_desc', '添加门店', function (\Dcat\Admin\Widgets\Form $forms) {
// $forms->text('title', '门店名称')->required();
// $forms->text('lat_lng', '经纬度')->help('<a href="https://lbs.amap.com/tools/picker" target="_blank">点击获取高德地图坐标</a>');
// $forms->text('address', '详细地址');
// $forms->text('distance', '配送范围(Km)');
// $forms->image('business_license', '营业执照')
// ->accept('jpg,jpeg,png')
// ->maxSize(4096)
// ->url('upload/merchant')
// ->help('仅支持jpg、jpeg、png格式图片上传')
// ->autoUpload();
// });
$form->disableCreatingCheck();
$form->disableEditingCheck();
$form->disableViewCheck();
$form->disableDeleteButton();
$form->disableViewButton();
});
$form->saved(
function (Form $form, $result) {
$merchant_gid = $form->getKey();
$msObj = MerchantStore::find($merchant_gid);
if ($msObj) {
$goods_id = $msObj->goods_id;
$merchant_id = $msObj->merchant_id;
$goodsObj = Good::where("id", $goods_id)->first();
$merchatObj = Merchant::where("id", $merchant_id)->first();
$params = [
'goods_sn' => $goodsObj->goods_sn,
'goods_name' => $goodsObj->goods_name,
'merchant_name' => $merchatObj->name,
'contacts' => $merchatObj->contacts,
];
DB::table('merchat_goods_store')->where("id", $merchant_gid)->update($params);
}
}
);
return $form;
}
public function getList(Request $request)
{
$mId = $request->get('q');
return Store::where('merchant_id', $mId)->get(['id', 'title as text']);
}
}
<?php
namespace App\Admin\Controllers;
use App\Models\MerchantStoreSkuLog;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class MerchantStoreSkuLogController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(MerchantStoreSkuLog::with(['goods', 'attr', 'mergs']), function (Grid $grid) {
$grid->model()->orderBy('id', 'DESC');
$grid->column('id')->sortable();
$grid->column('goods.goods_sn', '商品编号');
$grid->column('goods.cover_img', '商品图片')->image('', 100, 100);
$grid->column('goods.goods_name', '商品名称');
$grid->column('attr.attr_val', '商品规格');
$grid->column('change', '增减库存');
$grid->column('mergs.merchant_name', '商家名称');
$grid->column('mergs.contacts', '联系人');
$grid->column('created_at', '增减日期');
$grid->filter(function (Grid\Filter $filter) {
$filter->panel();
$filter->like('goods.goods_name', '商品名称')->width(3);
$filter->like('mergs.merchant_name', '商家名称')->width(3);
$filter->like('mergs.contacts', '联系人')->width(3);
$filter->between('created_at', '增减时间')->datetime()->width(6);
});
$grid->disableCreateButton();
//$grid->disableRefreshButton();
$grid->disableViewButton();
$grid->disableEditButton();
$grid->disableRowSelector();
$grid->disableDeleteButton();
$grid->disableActions();
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new MerchantStoreSkuLog(), function (Show $show) {
$show->field('id');
$show->field('goods_sn');
$show->field('attr_name');
$show->field('change');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new MerchantStoreSkuLog(), function (Form $form) {
$form->display('id');
$form->text('goods_sn');
$form->text('attr_name');
$form->text('change');
$form->display('created_at');
$form->display('updated_at');
});
}
}
<?php
namespace App\Admin\Controllers;
use App\Admin\Renderable\OrderGoodsList;
use App\Models\OrderGoods;
use App\Models\OrderInfo;
use App\Models\City;
use App\Models\Store;
use App\Models\SystemCity;
use App\Models\UserAddress;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
use App\Admin\Forms\VerifierCodeForm;
class OrderInfoController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(OrderInfo::with(['user', 'merchant']), function (Grid $grid) {
$grid->model()->orderBy('created_at', 'DESC');
$grid->column('id')->sortable();
$grid->column('order_sn', '订单号');
$grid->column('mobile', '手机号');
$grid->column('goods', '商品信息')->expand(function (Grid\Displayers\Expand $expand) {
$expand->button('查看');
return OrderGoodsList::make(['order_id' => $this->id]);
})->width(100);
$grid->column('goods_amount', '订单总金额');
$grid->column('merchant.name', '所属商家');
$grid->column('merchant.province_id', '所在省市')->display(function ($val) {
$proObj = City::where("city_id", $val)->first();
$cityObj = City::where("city_id", $this->merchant->city_id)->first();
$proname = $proObj->name ?? '';
$cityname = $cityObj->name ?? '';
return $proname . " " . $cityname;
});
$grid->column('store_id', '快递代收点')->display(function ($val) {
$res = null;
if ($val) {
$obj = Store::where('id', $val)->first();
$res = $obj->address;
}
return $res;
});
$grid->column('address_id', '送货上门')->display(function ($val) {
$res = '';
if ($val) {
$obj = UserAddress::where('id', $val)->first();
$res = $obj->area;
}
return $res;
});
$grid->column('created_at', '下单时间');
$grid->column('order_status', '订单状态')->display(function ($val) {
$options = OrderInfo::STATUS_OPTIONS;
return $options[$val];
})->if(function ($column) {
return $column->getValue() == 1;
})->display('点击生成核销码')->modal(function (Grid\Displayers\Modal $modal) {
// 标题
$modal->title('生成核销码');
// 自定义图标
$modal->icon('feather icon-edit');
// 传递当前行字段值
return VerifierCodeForm::make()->payload(['id' => $this->id]);
});
$grid->column('verification_code', '核销码')->limit(10);
$grid->column('verifier', '核销员');
$grid->column('verification_at', '核销时间');
//$grid->column('updated_at')->sortable();
//$grid->disableActions();
$grid->disableCreateButton();
$grid->disableViewButton();
$grid->filter(function (Grid\Filter $filter) {
// 更改为 panel 布局
$filter->panel();
$filter->equal('order_sn', '订单号')->width(4);
$filter->like('phone', '手机号')->width(4);
$filter->between('created_at', '创建时间')->datetime()->width(4);
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new OrderInfo(), function (Show $show) {
$show->field('id');
$show->field('order_sn', '订单号');
$show->field('verification_code', '核销码');
// $show->field('order_status')->display(function ($val) {
// $options = OrderInfo::STATUS_OPTIONS;
// return $options[$val];
// });
$show->field('created_at', '下单时间');
//$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new OrderInfo(), function (Form $form) {
//$form->display('id');
$form->display('order_sn');
$form->text('remark', '备注(后台用)');
//订单状态 -1:全部 0:待付款 1:待到货 2:待领取 3: 待评价 4:已完成 7:已取消 8:已退款
$options = [
1 => '待到货',
2 => '待领取',
3 => '待评价',
4 => '已完成',
7 => '已取消',
];
$form->select('order_status', '订单状态')->options($options);
// $form->switch('pay_status')->default(0);
// $form->switch('shipping_status', '发货状态')->default(0);
// $form->datetime('shipping_time', '发货时间');
// $form->text('shipping_name', '物流公司');
// $form->text('shipping_code', '物流单号');
// $form->text('order_amount', '订单应付款');
// $form->display('created_at');
// $form->display('updated_at');
$form->disableEditingCheck();
$form->disableViewCheck();
$form->disableDeleteButton();
$form->disableViewButton();
});
}
}
<?php
namespace App\Admin\Controllers;
use App\Admin\Forms\EditPermission;
use App\Admin\Forms\updatePassword;
use Dcat\Admin\Grid\RowAction;
use App\Models\User;
use App\Models\UserPermission;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Illuminate\Http\Request;
use Dcat\Admin\Http\Controllers\AdminController;
class ShareController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
$uid = request()->get('id');
return Grid::make(User::with(['shuser']), function (Grid $grid) use ($uid) {
$grid->addTableClass(['table-text-center']);
$grid->model()->where('id', $uid)->orderBy('created_at', 'DESC');
//$grid->column('id')->sortable();
$grid->column('name', '昵称');
$grid->column('phone', '手机号');
$grid->column('created_at', '注册时间')->display(function ($val) {
return date("Y-m-d H:i:s", strtotime($this->created_at));
});
$grid->disableCreateButton();
$grid->disableViewButton();
$grid->disableDeleteButton();
$grid->enableDialogCreate();
$grid->disableEditButton();
$grid->disableActions();
$grid->disableRowSelector();
//$grid->simplePaginate();
$grid->filter(function (Grid\Filter $filter) {
// 更改为 panel 布局
$filter->panel();
$filter->like('name', '昵称')->width(3);
$filter->like('phone', '用户手机号')->width(3);
$filter->equal('sp_type', '直推/间推')->select(['1' => '直推', '2' => '间推'])->width(3);
//$filter->between('created_at', '注册时间')->datetime()->width(4);
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new User(), function (Show $show) {
$show->field('id');
$show->field('name');
$show->field('avatar');
$show->field('openid');
$show->field('phone');
$show->field('status');
$show->field('role');
$show->field('department');
$show->field('email');
$show->field('email_verified_at');
$show->field('password');
$show->field('remember_token');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new User(), function (Form $form) {
$form->text('name', '昵称');
$form->switch('status', '状态')->default(1);
// $form->image('avatar', '头像')
// ->url('upload/user-avatar')
// ->deleteUrl('upload/delete-public-cos-file')
// ->autoUpload();
// if ($form->isCreating()) {
// $form->mobile('phone', '手机号')->rules('required|unique:users,phone', ['required' => '手机号码不可为空', 'unique' => '此手机号码已存在,请重新填写']);
// $form->text('password', '密码');
// }
// if ($form->isCreating()) {
// $form->saving(function (Form $form) {
// $form->password = bcrypt($form->password);
// });
// }
});
}
}
<?php
namespace App\Admin\Controllers;
use App\Models\StoreAdminUsers;
use App\Models\Merchant;
use App\Models\Good;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Illuminate\Support\Facades\Hash;
use Dcat\Admin\Http\Controllers\AdminController;
use Illuminate\Support\Facades\DB;
class StoreAdminUsersController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(StoreAdminUsers::with(['merchant', 'store']), function (Grid $grid) {
$grid->model()->where('role_id', 2); //2: 核销员
$grid->column('id')->sortable();
$grid->column('name', '姓名');
$grid->column('username', '登录账号');
$grid->column('merchant.name', '所属商家');
$grid->column('store.title', '所属门店');
// $grid->column('created_at');
// $grid->column('updated_at')->sortable();
$grid->disableViewButton();
$grid->filter(function (Grid\Filter $filter) {
// 更改为 panel 布局
$filter->panel();
$filter->like('name', '姓名')->width(3);
$filter->like('username', '登录账号')->width(3);
$filter->like('merchant.name', '所属商家')->width(3);
$filter->like('store.title', '所属门店')->width(3);
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
// return Show::make($id, new Verifier(), function (Show $show) {
// $show->field('id');
// $show->field('merchant_id');
// $show->field('store_id');
// $show->field('created_at');
// $show->field('updated_at');
// });
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
$form = Form::make(new StoreAdminUsers(), function (Form $form) {
$form->display('id');
//$form->ignore(['merchant_id', 'store_id']); // 忽略password字段
$form->text('name')->required();
$form->text('username');
if ($form->isCreating()) {
$form->password('password', '密码')->saving(function ($password) {
return bcrypt($password);
})->help('字母数字组合,长度大于5个字符');
} else {
// $form->password('password', '密码')->customFormat(function ($v) {
// return $v;
// })
// ->help('密码为空则不修改');
}
$form->hidden('role_id')->default(2);
// 如果是创建模式,执行相关操作
$form->select('merchant_id', '商家名称')
->options(Merchant::whereNull('deleted_at')->get()->pluck('name', 'id'))
//->rules('required')
->load('store_id', '/get-store-list')
->saving(function (Form $form, $data) {
// 当编辑记录时,设置选中的父分类和子分类
if ($form->isEditing()) {
$form->html('<script>
$(document).ready(function() {
$("#merchant_id").val(' . $data->merchant_id . '); // 设置父分类的选中值
$("#store_id").trigger("change"); // 触发事件加载子级选项
});
</script>');
}
});
$form->select('store_id', '门店名称');
$form->disableCreatingCheck();
$form->disableEditingCheck();
$form->disableViewCheck();
$form->disableDeleteButton();
$form->disableViewButton();
});
// 判断是否处于创建模式
if ($form->isCreating()) {
}
// 判断是否处于编辑模式
if ($form->isEditing()) {
// 如果是编辑模式,执行相关操作
$form->select('merchant_id', '显示名称')
->options([
1 => '选项1',
2 => '选项2',
3 => '选项3',
])
->value(function () {
// 获取模型对
return 1;
});
}
//副表保存规格
// $form->saved(
// function (Form $form, $result) {
// $store_admin_users_id = $form->getKey();
// $merchant_id = $form->model()->merchant_id;
// $store_id = $form->model()->store_id;
// //更新信息
// $verifier = DB::table('verifier')->where("store_admin_users_id", $store_admin_users_id)->first();
// $time = time();
// if (!$verifier) {
// $v_id = DB::table('verifier')->insertGetId(
// ['store_admin_users_id' => $store_admin_users_id, 'merchant_id' => $merchant_id, 'store_id' => $store_id, 'created_at' => date('Y-m-d H:i:s', $time), 'updated_at' => date('Y-m-d H:i:s', $time)]
// );
// } else {
// $verifier->merchant_id = $merchant_id;
// $verifier->store_id = $store_id;
// $verifier->save();
// }
// }
// );
return $form;
}
}
<?php
namespace App\Admin\Controllers;
use App\Models\SystemSetting;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class SystemSettingController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new SystemSetting(), function (Grid $grid) {
$grid->column('id')->sortable();
$grid->column('title');
$grid->column('cover')->image('', 100, 100);
$grid->column('is_show', '状态')->switch();
$grid->column('created_at');
//$grid->column('updated_at')->sortable();
$grid->disableViewButton();
$grid->filter(function (Grid\Filter $filter) {
$filter->like('title');
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new SystemSetting(), function (Show $show) {
$show->field('id');
$show->field('title');
$show->field('cover');
$show->field('content');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new SystemSetting(), function (Form $form) {
//$form->display('id');
$form->image('bj_invite', '邀请页背景图')
->accept('jpg,jpeg,png')
->maxSize(4096)
->url('upload/category')
->help('仅支持jpg、jpeg、png格式图片上传(750px * 420px)')
->autoUpload();
$form->editor('cp_brief', '公司介绍');
//$form->display('created_at');
//$form->display('updated_at');
$form->disableCreatingCheck();
$form->disableEditingCheck();
$form->disableViewCheck();
$form->disableDeleteButton();
$form->disableViewButton();
});
}
}
<?php
namespace App\Admin\Controllers;
use Dcat\Admin\Traits\HasUploadedFile;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
use Intervention\Image\Facades\Image;
class UploadController
{
use HasUploadedFile;
public function merchantUpload()
{
$disk = $this->disk();
// 判断是否是删除文件请求
if ($this->isDeleteRequest()) {
// 删除文件并响应
return $this->deleteFileAndResponse();
}
// 获取上传的文件
$file = $this->file();
//获取文件扩展名
$ext = $file->getClientOriginalExtension();
$img = Image::make($file->getRealPath())
->resize(640, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->encode($ext, 90);
$dir = '/merchant/' . date("Ymd");
$newName = md5(uniqid()) . '.' . $ext;
$path = "{$dir}/$newName";
$result = $disk->put($path, $img);
return $result
? $this->responseUploaded($path, $disk->url($path))
: $this->responseErrorMessage('文件上传失败');
}
public function userUpload()
{
$disk = $this->disk();
// 判断是否是删除文件请求
if ($this->isDeleteRequest()) {
// 删除文件并响应
return $this->deleteFileAndResponse();
}
// 获取上传的文件
$file = $this->file();
//获取文件扩展名
$ext = $file->getClientOriginalExtension();
$img = Image::make($file->getRealPath())
->resize(640, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->encode($ext, 90);
$dir = '/user';
$newName = md5(uniqid()) . '.' . $ext;
$path = "{$dir}/$newName";
$result = $disk->put($path, $img);
return $result
? $this->responseUploaded($path, $disk->url($path))
: $this->responseErrorMessage('文件上传失败');
}
public function goodsUpload()
{
$disk = $this->disk();
// 判断是否是删除文件请求
if ($this->isDeleteRequest()) {
// 删除文件并响应
return $this->deleteFileAndResponse();
}
// 获取上传的文件
$file = $this->file();
//获取文件扩展名
$ext = $file->getClientOriginalExtension();
$img = Image::make($file->getRealPath())
->resize(640, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->encode($ext, 90);
$dir = '/goods/' . date("Ymd");
$newName = md5(uniqid()) . '.' . $ext;
$path = "{$dir}/$newName";
$result = $disk->put($path, $img);
return $result
? $this->responseUploaded($path, $disk->url($path))
: $this->responseErrorMessage('文件上传失败');
}
//商品规格图
public function uploadSkuImage(Request $request)
{
if ($request->hasFile('file')) {
$file = $request->file('file');
//$disk = Storage::disk('cosv5');
// $ext = $file->getClientOriginalExtension();
$disk = $this->disk();
// $url = 'sku';
// $res = $disk->put($url, $file);
//获取文件扩展名
$ext = $file->getClientOriginalExtension();
$img = Image::make($file->getRealPath())
->resize(640, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->encode($ext, 90);
$dir = '/goods/' . date("Ymd");
$newName = md5(uniqid()) . '.' . $ext;
$path = "{$dir}/$newName";
$result = $disk->put($path, $img);
$url = $result ? $path : '';
// 返回格式
return ['url' => env('IMAGE_URL') . $url];
}
return [];
}
public function carouselUpload()
{
$disk = $this->disk();
// 判断是否是删除文件请求
if ($this->isDeleteRequest()) {
// 删除文件并响应
return $this->deleteFileAndResponse();
}
// 获取上传的文件
$file = $this->file();
//获取文件扩展名
$ext = $file->getClientOriginalExtension();
$img = Image::make($file->getRealPath())
->resize(640, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->encode($ext, 90);
$dir = '/carousel';
$newName = md5(uniqid()) . '.' . $ext;
$path = "{$dir}/$newName";
$result = $disk->put($path, $img);
return $result
? $this->responseUploaded($path, $disk->url($path))
: $this->responseErrorMessage('文件上传失败');
}
public function articlelUpload()
{
$disk = $this->disk();
// 判断是否是删除文件请求
if ($this->isDeleteRequest()) {
// 删除文件并响应
return $this->deleteFileAndResponse();
}
// 获取上传的文件
$file = $this->file();
//获取文件扩展名
$ext = $file->getClientOriginalExtension();
$img = Image::make($file->getRealPath())
->resize(640, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->encode($ext, 90);
$dir = '/article';
$newName = md5(uniqid()) . '.' . $ext;
$path = "{$dir}/$newName";
$result = $disk->put($path, $img);
return $result
? $this->responseUploaded($path, $disk->url($path))
: $this->responseErrorMessage('文件上传失败');
}
}
<?php
namespace App\Admin\Controllers;
use App\Models\UserBuycodeCheck;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class UserBuycodeCheckController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(UserBuycodeCheck::with(['user']), function (Grid $grid) {
$grid->column('id')->sortable();
$grid->column('user.avatar', '用户头像')->image('', 100, 100);
$grid->column('user.nickname', '用户昵称');
$grid->column('user.phone', '手机号');
$grid->column('before_code');
$grid->column('after_code');
$grid->column('status');
// $grid->column('created_at');
// $grid->column('updated_at')->sortable();
$grid->filter(function (Grid\Filter $filter) {
// 更改为 panel 布局
$filter->panel();
$filter->equal('user.nickname', '用户昵称')->width(4);
$filter->like('user.phone', '手机号')->width(4);
$filter->equal('status', '审核状态')->select(['0' => '待审核', '1' => '已通过', '2' => '已驳回'])->width(3);
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new UserBuycodeCheck(), function (Show $show) {
$show->field('id');
$show->field('before_code');
$show->field('after_code');
$show->field('status');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new UserBuycodeCheck(), function (Form $form) {
$form->display('id');
$form->text('before_code');
$form->text('after_code');
$form->text('status');
$form->display('created_at');
$form->display('updated_at');
});
}
}
<?php
namespace App\Admin\Controllers;
use App\Admin\Forms\EditPermission;
use App\Admin\Forms\updatePassword;
use App\Models\User;
use App\Models\UserPermission;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
use App\Admin\Forms\UserCheckForm;
class UserCheckController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new User(), function (Grid $grid) {
$grid->addTableClass(['table-text-center']);
$grid->model()->where(['status' => 0])->orderBy('created_at', 'DESC');
$grid->column('id')->sortable();
$grid->column('avatar', '头像')->image('', 50, 50);
$grid->column('company', '公司名称');
$grid->column('phone', '手机号');
$grid->column('status')
->display('点击审核')->modal(function (Grid\Displayers\Modal $modal) {
// 标题
$modal->title('点击审核');
// 自定义图标
$modal->icon('feather icon-edit');
// 传递当前行字段值
return UserCheckForm::make()->payload(['id' => $this->id]);
});
$grid->column('created_at', '注册时间')->display(function ($val) {
return date("Y-m-d H:i:s", strtotime($this->created_at));
});
$grid->disableActions();
$grid->disableCreateButton();
$grid->filter(function (Grid\Filter $filter) {
// 更改为 panel 布局
$filter->panel();
$filter->like('phone')->width(3);
$filter->like('company')->width(3);
$filter->between('created_at', '创建时间')->datetime()->width(6);
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new User(), function (Show $show) {
$show->field('id');
$show->field('name');
$show->field('avatar');
$show->field('openid');
$show->field('phone');
$show->field('status');
$show->field('role');
$show->field('department');
$show->field('email');
$show->field('email_verified_at');
$show->field('password');
$show->field('remember_token');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new User(), function (Form $form) {
$form->text('name', '昵称');
$form->text('company', '公司名称');
$form->text('score', '积分');
// $form->image('avatar', '头像')
// ->url('upload/user-avatar')
// ->deleteUrl('upload/delete-public-cos-file')
// ->autoUpload();
// if ($form->isCreating()) {
// $form->mobile('phone', '手机号')->rules('required|unique:users,phone', ['required' => '手机号码不可为空', 'unique' => '此手机号码已存在,请重新填写']);
// $form->text('password', '密码');
// }
// if ($form->isCreating()) {
// $form->saving(function (Form $form) {
// $form->password = bcrypt($form->password);
// });
// }
});
}
}
<?php
namespace App\Admin\Controllers;
use App\Models\UserCollect;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class UserCollectController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new UserCollect(), function (Grid $grid) {
$grid->column('id')->sortable();
$grid->column('created_at');
$grid->column('updated_at')->sortable();
$grid->filter(function (Grid\Filter $filter) {
$filter->equal('id');
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new UserCollect(), function (Show $show) {
$show->field('id');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new UserCollect(), function (Form $form) {
$form->display('id');
$form->display('created_at');
$form->display('updated_at');
});
}
}
<?php
namespace App\Admin\Controllers;
use App\Admin\Forms\EditPermission;
use App\Admin\Forms\updatePassword;
use Dcat\Admin\Grid\RowAction;
use App\Models\User;
use App\Models\UserPermission;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class UserController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(User::with(['shuser']), function (Grid $grid) {
$grid->addTableClass(['table-text-center']);
$grid->model()->orderBy('created_at', 'DESC');
$grid->column('id')->sortable();
$grid->column('avatar', '头像')->image('', 50, 50);
$grid->column('name', '昵称');
$grid->column('phone', '手机号');
$grid->column('balance', '总金额');
$grid->column('shuser.name', '所属上级');
$grid->column('buycode', '直购码');
//$grid->column('status', '状态')->switch('', true);
$grid->column('created_at', '注册时间')->display(function ($val) {
return date("Y-m-d H:i:s", strtotime($this->created_at));
});
$grid->disableCreateButton();
$grid->disableViewButton();
$grid->disableDeleteButton();
$grid->enableDialogCreate();
$grid->disableEditButton();
$grid->showQuickEditButton();
//$grid->simplePaginate();
$grid->actions(function (Grid\Displayers\Actions $actions) {
// 添加一个按钮,并设置其属性
$actions->append('<a href="/user-share?id=' . $this->id . '" alt="查看下级" target="_blank">查看详情</a>');
// 或者使用 RowAction 来添加按钮
//$actions->append(RowAction::make('自定义按钮')->route('custom.route'));
});
$grid->filter(function (Grid\Filter $filter) {
// 更改为 panel 布局
$filter->panel();
$filter->like('name')->width(3);
$filter->like('phone')->width(3);
$filter->like('buycode', '直购码')->width(3);
$filter->like('buycode', '所属上级')->width(3);
//$filter->equal('role', '身份')->select(['1' => '用户', '2' => '代理商'])->width(3);
$filter->between('created_at', '注册时间')->datetime()->width(4);
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new User(), function (Show $show) {
$show->field('id');
$show->field('name');
$show->field('avatar');
$show->field('openid');
$show->field('phone');
$show->field('status');
$show->field('role');
$show->field('department');
$show->field('email');
$show->field('email_verified_at');
$show->field('password');
$show->field('remember_token');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new User(), function (Form $form) {
$form->text('name', '昵称');
$form->switch('status', '状态')->default(1);
// $form->image('avatar', '头像')
// ->url('upload/user-avatar')
// ->deleteUrl('upload/delete-public-cos-file')
// ->autoUpload();
// if ($form->isCreating()) {
// $form->mobile('phone', '手机号')->rules('required|unique:users,phone', ['required' => '手机号码不可为空', 'unique' => '此手机号码已存在,请重新填写']);
// $form->text('password', '密码');
// }
// if ($form->isCreating()) {
// $form->saving(function (Form $form) {
// $form->password = bcrypt($form->password);
// });
// }
});
}
}
<?php
namespace App\Admin\Controllers;
use App\Admin\Repositories\Verifier;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class VerifierController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new Verifier(), function (Grid $grid) {
$grid->column('id')->sortable();
$grid->column('merchant_id');
$grid->column('store_id');
$grid->column('created_at');
$grid->column('updated_at')->sortable();
$grid->filter(function (Grid\Filter $filter) {
$filter->equal('id');
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new Verifier(), function (Show $show) {
$show->field('id');
$show->field('merchant_id');
$show->field('store_id');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new Verifier(), function (Form $form) {
$form->display('id');
$form->text('merchant_id');
$form->text('store_id');
$form->display('created_at');
$form->display('updated_at');
});
}
}
<?php
namespace App\Admin\Extensions;
use App\Models\Good as GoodModel;
use App\Models\Category as CategoryModel;
use App\Models\GoodSku as GoodSkuModel;
use Illuminate\Support\Facades\DB;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;
class GoodsExport implements FromCollection, WithHeadings
{
private $row;
private $data;
private $headings;
/**
* TaskDataExcelExpoter constructor.
* @param array $param 筛选条件
* @param array $data 数据
* @param array $headings 表头
*/
public function __construct($param = [], $data = [], $headings = [])
{
//表头设定
$headings = [[
'goods_id' => '商品ID',
'goods_name' => '商品名称',
'catname' => '分类',
'sku' => '规格信息',
'product_no' => '型号',
'material' => '材质',
'box_size' => '箱规',
'is_jd' => '是否京东自营',
'supplier' => '供应商联系人',
'su_phone' => '联系方式',
]];
$data = $this->getList($param);
$this->headings = $headings;
$this->data = $data;
}
public function headings(): array
{
return $this->headings;
}
public function collection()
{
return collect($this->data);
}
// 获取导出数据
public function getList($param)
{
$param = json_decode(json_encode($param), true);
$prePage = $param['per_page'] ?? 200;
$start = $param['start'] ?? 0;
$goods_name = $param['search']['goods_name'] ?? '';
$cat_id = $param['search']['cat_id'] ?? 0;
DB::enableQueryLog();
$note_monitor = DB::table('li_goods');
$where = [];
if ($cat_id) {
$where['cat_id'] = $cat_id;
}
if ($goods_name) {
$where['goods_name'] = $goods_name;
}
$note_monitor = $note_monitor->where($where);
// 计算列表总数
$count = $note_monitor->count();
// 获取列表
$data = [];
$list = $note_monitor->orderBy("id", 'desc')->limit($prePage)->offset($start)->get()->toArray();
//$queries = DB::getQueryLog();
foreach ($list as $key => $objVal) {
$tmp = [];
//ID
$tmp['goods_id'] = $objVal->id;
//名称
$tmp['goods_name'] = $objVal->goods_name;
//分类
$catObj = CategoryModel::find($objVal->cat_id);
$tmp['catname'] = $catObj ? $catObj->title : '';
//规格
$skufield = $objVal->sku ? json_decode($objVal->sku, true) : [];
$attrsKey = isset($skufield['attrs']) ? array_keys($skufield['attrs']) : [];
$attrsVal = isset($skufield['attrs']) ? array_values($skufield['attrs']) : [];
$skuData = isset($skufield['sku']) ? $skufield['sku'] : [];
$skuStr = "";
foreach ($skuData as $kk => $vv) {
$attr_sn = isset($vv['attr_sn']) ? $vv['attr_sn'] : '';
if (!$attr_sn) {
continue;
}
$gattr = DB::table("li_goods_sku")->where('goods_id', $objVal->id)->where('attr_sn', $attr_sn)->first();
$skuStr .= " 规格:" . $gattr->attr_val . " 购买数量:" . $vv['numb'] . " 折扣价:" . $vv['price'] . " 采购价:" . $vv['cg_price'] . " 京东价:" . $vv['jd_price'] . " 市场价:" . $vv['market_price'] . " 库存:" . $vv['stock'] . "\n";
}
$tmp['sku'] = $skuStr;
$tmp['product_no'] = $objVal->product_no;
$tmp['material'] = $objVal->material;
$tmp['box_size'] = $objVal->box_size;
$tmp['is_jd'] = ($objVal->is_jd == 1) ? '京东自营' : '非京东自营';
$tmp['supplier'] = $objVal->supplier;
$tmp['su_phone'] = $objVal->su_phone;
array_push($data, $tmp);
}
return $data;
}
}
<?php
namespace App\Admin\Forms;
use App\Models\Performance;
use Dcat\Admin\Contracts\LazyRenderable;
use Dcat\Admin\Traits\LazyWidget;
use Dcat\Admin\Widgets\Form;
class EditParameter extends Form implements LazyRenderable
{
use LazyWidget;
/**
* Handle the form request.
*
* @param array $input
*
* @return mixed
*/
public function handle(array $input)
{
$model = Performance::find($this->payload['id']);
$params = [];
for($i=1;$i<=10;$i++){
$params[] = $input['param'.$i];
}
$model->parameter = json_encode($params,JSON_UNESCAPED_UNICODE);
if(!$model->save()){
return $this
->response()
->error('修改参数失败')
->refresh();
}
return $this
->response()
->success('修改参数成功.')
->refresh();
}
/**
* Build a form here.
*/
public function form()
{
$this->text('param1','参数1');
$this->text('param2','参数2');
$this->text('param3','参数3');
$this->text('param4','参数4');
$this->text('param5','参数5');
$this->text('param6','参数6');
$this->text('param7','参数7');
$this->text('param8','参数8');
$this->text('param9','参数9');
$this->text('param10','参数10');
}
/**
* The data of the form.
*
* @return array
*/
public function default()
{
$params = Performance::find($this->payload['id'])->parameter;
$params = $params ? json_decode($params) : [];
return [
'param1' => $params[0] ?? '',
'param2' => $params[1] ?? '',
'param3' => $params[2] ?? '',
'param4' => $params[3] ?? '',
'param5' => $params[4] ?? '',
'param6' => $params[5] ?? '',
'param7' => $params[6] ?? '',
'param8' => $params[7] ?? '',
'param9' => $params[8] ?? '',
'param10' => $params[9] ?? '',
];
}
}
<?php
namespace App\Admin\Forms;
use App\Models\User;
use App\Models\UserPermission;
use Dcat\Admin\Contracts\LazyRenderable;
use Dcat\Admin\Traits\LazyWidget;
use Dcat\Admin\Widgets\Form;
class EditPermission extends Form implements LazyRenderable
{
use LazyWidget;
/**
* Handle the form request.
*
* @param array $input
*
* @return mixed
*/
public function handle(array $input)
{
$user = User::find($this->payload['id']);
$user->permissions = $input['permissions'];
if(!$user->save()){
return $this
->response()
->error('修改用户权限失败')
->refresh();
}
return $this
->response()
->success('修改用户权限成功.')
->refresh();
}
/**
* Build a form here.
*/
public function form()
{
$this->display('name','姓名');
$this->display('phone','手机');
$this->tree('permissions','权限')
->nodes(UserPermission::all()->toArray())
->treeState(false)
->saveAsJson();
}
/**
* The data of the form.
*
* @return array
*/
public function default()
{
$user = User::find($this->payload['id']);
return [
'permissions' => $user->permissions,
'name' => $user->name,
'phone' => $user->phone,
];
}
}
<?php
namespace App\Admin\Forms;
use App\Models\User;
use Dcat\Admin\Widgets\Form;
use Dcat\Admin\Contracts\LazyRenderable;
use Dcat\Admin\Traits\LazyWidget;
use Illuminate\Support\Facades\DB;
class GenerateUserCode extends Form implements LazyRenderable
{
use LazyWidget;
/**
* Handle the form request.
*
* @param array $input
*
* @return mixed
*/
public function handle(array $input)
{
$num = (int)$input['num'];
if ($num <= 0 || $num > 20) {
$num = 20;
}
$data = [];
$i = 0;
$dcount = 0;
do {
$rndstr = generateRandomString(6);
$exist = DB::table("li_check_number")->where("code", $rndstr)->count();
if (!$exist) {
array_push($data, $rndstr);
}
$dcount = count($data);
} while ($i <= $num && $dcount != $num);
// for ($i = 0; $i <= $num; $i++) {
// $rndstr = generateRandomString(6);
// $exist = DB::table("li_check_number")->where("code", $rndstr)->count();
// if (!$exist) {
// array_push($data, $rndstr);
// }
// }
if ($data) {
foreach ($data as $code) {
$addtime = date("Y-m-d H:i:s");
DB::table("li_check_number")->insert(['code' => $code, 'created_at' => $addtime]);
}
}
return $this->response()->success('确认成功')->refresh();
}
/**
* Build a form here.
*/
public function form()
{
$this->text('num', '生成数量')->required()->help("生成20个以内随机编号(数字+大小写英文)");
}
/**
* The data of the form.
*
* @return array
*/
public function default()
{
// 获取外部传递参数
return [];
}
}
<?php
namespace App\Admin\Forms;
use App\Imports\ImportExcel as uImportExcel;
use App\Jobs\ansyImportExcel;
use Dcat\Admin\Contracts\LazyRenderable;
use Dcat\Admin\Traits\LazyWidget;
use Dcat\Admin\Widgets\Form;
class ImportExcel extends Form implements LazyRenderable
{
use LazyWidget;
/**
* Handle the form request.
*
* @param array $input
*
* @return mixed
*/
public function handle(array $input)
{
$file_path = storage_path('app/public' . $input['e_file']);
dispatch(new ansyImportExcel($this->payload['className'],$file_path));
return $this
->response()
->success('导入成功,请稍后刷新页面查看数据.')
->refresh();
}
/**
* Build a form here.
*/
public function form()
{
$this->file('e_file', '数据文件')
->disk('public')
->accept('xls,xlsx')
->uniqueName()
->move('/import')
->autoUpload()
->help('仅支持xls,xlsx格式文件上传')
->required();
}
/**
* The data of the form.
*
* @return array
*/
public function default()
{
return [
'name' => 'John Doe',
'email' => 'John.Doe@gmail.com',
];
}
}
<?php
namespace App\Admin\Forms;
use App\Models\GoodSku;
use App\Models\MerchantStore;
use App\Models\MerchantGoodSku;
use Dcat\Admin\Widgets\Form;
use Dcat\Admin\Layout\Row;
use Dcat\Admin\Form\NestedForm;
use Dcat\Admin\Widgets\Table;
use Dcat\Admin\Widgets\Tool;
use Dcat\Admin\Contracts\LazyRenderable;
use Dcat\Admin\Traits\LazyWidget;
use Illuminate\Support\Facades\DB;
//
class MerchantStoreForms extends Form implements LazyRenderable
{
use LazyWidget;
protected $modalId = 'show-current-user';
/**
* Handle the form request.
*
* @param array $input
*
* @return mixed
*/
public function handle(array $input)
{
$typeid = (int)$_POST['typeid']; //1:增加 2:编辑
$goods_id = (int)$_POST['goods_id'];
$mgs_id = (int)$_POST['mgs_id'];
$attr_ids = $_POST['attr_id'];
$stocks = $_POST['stock'];
$sskuids = isset($_POST['sskuid']) ? $_POST['sskuid'] : [];
if (!$goods_id || !$mgs_id || !$attr_ids || !$stocks) {
return $this->response()->error('参数错误')->refresh();
}
$logData = [];
if ($typeid == 1) {
foreach ($attr_ids as $kk => $vv) {
$gskuObj = GoodSku::find($vv);
$stockNum = ($gskuObj->stock >= $stocks[$kk] && $stocks[$kk]) ? (int)$stocks[$kk] : 0;
//$tmp['stock'] = $stockNum;
//查下库存记录是否存在
$skuObj = MerchantGoodSku::where(['mgs_id' => $mgs_id, 'goods_id' => $goods_id, 'attr_id' => $vv])->first();
if ($skuObj) {
$skuObj->stock += $stockNum;
$skuObj->save();
} else {
$skuObj = new MerchantGoodSku();
$skuObj->mgs_id = $mgs_id;
$skuObj->goods_id = $goods_id;
$skuObj->attr_id = $vv;
$skuObj->stock = $stockNum;
$skuObj->save();
}
//记录操作日志
$logData[$kk]['mgs_id'] = $mgs_id;
$logData[$kk]['goods_id'] = $goods_id;
$logData[$kk]['attr_id'] = $gskuObj->id;
$logData[$kk]['change'] = $stockNum;
$logData[$kk]['created_at'] = date('Y-m-d H:i:s');
$this->addStoreLog($logData);
}
} else {
if (!$sskuids) {
return $this->response()->error('参数错误')->refresh();
}
foreach ($sskuids as $kk => $vv) {
//商家规格数据
$skuObj = MerchantGoodSku::find($vv);
$store_num = (int)$stocks[$kk]; //减少库存数
$diffnum = $skuObj->stock - $store_num; //减少差值
if ($store_num && $diffnum >= 0) {
$skuObj->stock = $diffnum;
$skuObj->save();
//记录操作日志
$logData[$kk]['mgs_id'] = $mgs_id;
$logData[$kk]['attr_id'] = $skuObj->attr_id;
$logData[$kk]['goods_id'] = $goods_id;
$logData[$kk]['change'] = -$store_num;
$logData[$kk]['created_at'] = date('Y-m-d H:i:s');
$this->addStoreLog($logData);
}
}
}
return $this
->response()
->success('Processed successfully.')
->refresh();
}
private function addStoreLog($data = [])
{
if (!$data) {
return true;
}
DB::table('merchant_store_sku_log')->insert($data);
}
/**
* Build a form here.
*/
public function form()
{
//$this->text('name')->required();
//$this->email('email')->rules('email');
// 异步加载的字段
$this->html('<div class="row">
<div class="col-md-12">
<table class="table">
<thead>
<tr>
<th width="23%" style="text-align:center;">商品名称</th>
<th width="23%" style="text-align:center;">商品规格</th>
<th width="23%" style="text-align:center;" id="storeTitle"></th>
<th width="23%" style="text-align:center;">剩余库存</th>
</tr>
</thead>
<tbody id="tabletr">
<!-- 表格数据 -->
<!--<tr>
<td style="text-align:center;vertical-align: middle;">数据1</td>
<td style="text-align:center;vertical-align: middle;">蓝色、大号</td>
<td ><input type="text" name="remark" value="" class="form-control field_remark _normal_" placeholder=""></td>
<td style="text-align:center;vertical-align: middle;">123</td>
</tr>-->
<!-- 更多行数据 -->
</tbody>
</table>
</div>
</div>', $synchronized = false);
}
public function render2()
{
// // 构建表单
return view('admin.mstore');
//return parent::render();
}
/**
* The data of the form.
*
* @return array
*/
public function default()
{
return [
'name' => '6785678567',
'email' => 'John.Doe@gmail.com',
];
}
}
<?php
namespace App\Admin\Forms;
use App\Models\User;
use Dcat\Admin\Widgets\Form;
use Dcat\Admin\Contracts\LazyRenderable;
use Dcat\Admin\Traits\LazyWidget;
class UserCheckForm extends Form implements LazyRenderable
{
use LazyWidget;
/**
* Handle the form request.
*
* @param array $input
*
* @return mixed
*/
public function handle(array $input)
{
$status = (int)$input['status'];
$order = User::find($this->payload['id']);
$order->status = $status;
$order->save();
return $this->response()->success('确认成功')->refresh();
}
/**
* Build a form here.
*/
public function form()
{
$this->radio('status', '状态')->options([1 => '通过', 2 => '驳回'])->default(1)->required();
}
/**
* The data of the form.
*
* @return array
*/
public function default()
{
// 获取外部传递参数
return [];
}
}
<?php
namespace App\Admin\Forms;
use App\Models\OrderInfo;
use Dcat\Admin\Widgets\Form;
use Dcat\Admin\Contracts\LazyRenderable;
use Dcat\Admin\Traits\LazyWidget;
class VerifierCodeForm extends Form implements LazyRenderable
{
use LazyWidget;
/**
* Handle the form request.
*
* @param array $input
*
* @return mixed
*/
public function handle(array $input)
{
$code = trim($input['verification_code']);
$exist = OrderInfo::where('verification_code', $code)->count();
if ($exist) {
return $this->response()->error('该核销码已存在')->refresh();
}
$order = OrderInfo::find($this->payload['id']);
$order->order_status = 2; //待领取状态
$order->verification_code = $code;
$order->verification_at = date("Y-m-d H:i:s");
$order->save();
return $this->response()->success('确认成功')->refresh();
}
/**
* Build a form here.
*/
public function form()
{
$code = date('Ymd') . mt_rand(1000, 9999) . substr(implode("", array_map('ord', str_split(substr(uniqid(), 7, 13), 1))), 0, 8);
$this->text('verification_code', '核销码')->default($code);
//$this->radio('status', '状态')->options([1 => '通过', 2 => '驳回'])->default(1)->required();
}
/**
* The data of the form.
*
* @return array
*/
public function default()
{
// 获取外部传递参数
return [];
}
}
<?php
namespace App\Admin\Forms;
use App\Models\PersonalAccessToken;
use App\Models\User;
use App\Models\UserPermission;
use Dcat\Admin\Contracts\LazyRenderable;
use Dcat\Admin\Traits\LazyWidget;
use Dcat\Admin\Widgets\Form;
class updatePassword extends Form implements LazyRenderable
{
use LazyWidget;
/**
* Handle the form request.
*
* @param array $input
*
* @return mixed
*/
public function handle(array $input)
{
$user = User::find($this->payload['id']);
$user->password = bcrypt($input['password']);
if(!$user->save()){
return $this
->response()
->error('修改用户密码失败')
->refresh();
}
PersonalAccessToken::where(['tokenable_id'=>$user->id])->delete();
return $this
->response()
->success('修改用户密码成功.')
->refresh();
}
/**
* Build a form here.
*/
public function form()
{
$this->display('name','姓名');
$this->display('phone','手机');
$this->text('password','密码')->required();
}
/**
* The data of the form.
*
* @return array
*/
public function default()
{
$user = User::find($this->payload['id']);
return [
'name' => $user->name,
'phone' => $user->phone,
];
}
}
<?php
namespace App\Admin\Metrics\Examples;
use App\Models\Good as GoodModel;
use Dcat\Admin\Widgets\Metrics\Round;
use Dcat\Admin\Widgets\Metrics\Line;
use Illuminate\Http\Request;
class GoodsTotal extends Line
{
/**
* 初始化卡片内容
*/
protected function init()
{
parent::init();
$this->title('已取货总数');
$this->dropdown([
'1' => '今天',
'7' => '最近7天',
'30' => '最近30天',
'365' => '最近一年',
]);
//$this->chartLabels(['Finished', 'Pending', 'Rejected']);
// $this->dropdown([
// '7' => 'Last 7 Days',
// '28' => 'Last 28 Days',
// '30' => 'Last Month',
// '365' => 'Last Year',
// ]);
}
/**
* 处理请求
*
* @param Request $request
*
* @return mixed|void
*/
public function handle(Request $request)
{
switch ($request->get('option')) {
case '365':
$data = GoodModel::getYearData();
// 卡片内容
$this->withContent($data['total']);
// 图表数据
$this->withChart($data['list']);
break;
case '30':
$data = GoodModel::getNumDayData(30);
// 卡片内容
$this->withContent($data['total']);
// 图表数据
$this->withChart($data['list']);
break;
case '7':
$data = GoodModel::getNumDayData(7);
// 卡片内容
$this->withContent($data['total']);
// 图表数据
$this->withChart($data['list']);
break;
default:
$data = GoodModel::getNumDayData(1);
// 卡片内容
$this->withContent($data['total']);
// 图表数据
$this->withChart($data['list']);
}
}
/**
* 设置图表数据.
*
* @param array $data
*
* @return $this
*/
public function withChart(array $data)
{
$series_data = [];
foreach ($data as $v) {
$series_data[] = $v;
}
return $this->chart([
'series' => [
[
'name' => '订单量',
'data' => $series_data,
],
],
'stroke' => [
'curve' => 'smooth'
],
]);
}
/**
* 设置卡片内容.
*
* @param string $content
*
* @return $this
*/
public function withContent($content)
{
return $this->content(
<<<HTML
<div class="d-flex justify-content-between align-items-center mt-1" style="margin-bottom: 2px">
<h2 class="ml-1 font-lg-1">{$content}</h2>
<span class="mb-0 mr-1 text-80">{$this->title}</span>
</div>
HTML
);
}
}
<?php
namespace App\Admin\Metrics\Examples;
use Dcat\Admin\Admin;
use Dcat\Admin\Widgets\Metrics\Donut;
class NewDevices extends Donut
{
protected $labels = ['Desktop', 'Mobile'];
/**
* 初始化卡片内容
*/
protected function init()
{
parent::init();
$color = Admin::color();
$colors = [$color->primary(), $color->alpha('blue2', 0.5)];
$this->title('New Devices');
$this->subTitle('Last 30 days');
$this->chartLabels($this->labels);
// 设置图表颜色
$this->chartColors($colors);
}
/**
* 渲染模板
*
* @return string
*/
public function render()
{
$this->fill();
return parent::render();
}
/**
* 写入数据.
*
* @return void
*/
public function fill()
{
$this->withContent(44.9, 28.6);
// 图表数据
$this->withChart([44.9, 28.6]);
}
/**
* 设置图表数据.
*
* @param array $data
*
* @return $this
*/
public function withChart(array $data)
{
return $this->chart([
'series' => $data
]);
}
/**
* 设置卡片头部内容.
*
* @param mixed $desktop
* @param mixed $mobile
*
* @return $this
*/
protected function withContent($desktop, $mobile)
{
$blue = Admin::color()->alpha('blue2', 0.5);
$style = 'margin-bottom: 8px';
$labelWidth = 120;
return $this->content(
<<<HTML
<div class="d-flex pl-1 pr-1 pt-1" style="{$style}">
<div style="width: {$labelWidth}px">
<i class="fa fa-circle text-primary"></i> {$this->labels[0]}
</div>
<div>{$desktop}</div>
</div>
<div class="d-flex pl-1 pr-1" style="{$style}">
<div style="width: {$labelWidth}px">
<i class="fa fa-circle" style="color: $blue"></i> {$this->labels[1]}
</div>
<div>{$mobile}</div>
</div>
HTML
);
}
}
<?php
namespace App\Admin\Metrics\Examples;
use Dcat\Admin\Widgets\Metrics\Line;
use App\Models\User as UserModel;
use Illuminate\Http\Request;
class NewUsers extends Line
{
/**
* 初始化卡片内容
*
* @return void
*/
protected function init()
{
parent::init();
$this->title('待取货总数');
$this->dropdown([
'1' => '今天',
'7' => '最近7天',
'30' => '最近30天',
'365' => '最近一年',
]);
}
/**
* 处理请求
*
* @param Request $request
*
* @return mixed|void
*/
public function handle(Request $request)
{
switch ($request->get('option')) {
case '365':
$data = UserModel::getYearData();
// 卡片内容
$this->withContent($data['total']);
// 图表数据
$this->withChart($data['list']);
break;
case '30':
$data = UserModel::getNumDayData(30);
// 卡片内容
$this->withContent($data['total']);
// 图表数据
$this->withChart($data['list']);
break;
case '7':
$data = UserModel::getNumDayData(7);
// 卡片内容
$this->withContent($data['total']);
// 图表数据
$this->withChart($data['list']);
break;
default:
$data = UserModel::getNumDayData(1);
// 卡片内容
$this->withContent($data['total']);
// 图表数据
$this->withChart($data['list']);
}
}
/**
* 设置图表数据.
*
* @param array $data
*
* @return $this
*/
public function withChart(array $data)
{
$series_data = [];
foreach ($data as $v) {
$series_data[] = $v;
}
return $this->chart([
'series' => [
[
'name' => $this->title,
'data' => $series_data,
],
],
'stroke' => [
'curve' => 'smooth'
],
]);
}
// public function withChart(array $data)
// {
// return $this->chart([
// 'series' => [
// [
// 'name' => $this->title,
// 'data' => $data,
// ],
// ],
// ]);
// }
/**
* 设置卡片内容.
*
* @param string $content
*
* @return $this
*/
public function withContent($content)
{
return $this->content(
<<<HTML
<div class="d-flex justify-content-between align-items-center mt-1" style="margin-bottom: 2px">
<h2 class="ml-1 font-lg-1">{$content}</h2>
<span class="mb-0 mr-1 text-80">{$this->title}</span>
</div>
HTML
);
}
}
<?php
namespace App\Admin\Metrics\Examples;
use App\Models\OrderInfo as OrderInfoModel;
use Dcat\Admin\Widgets\Metrics\Round;
use Dcat\Admin\Widgets\Metrics\Line;
use Illuminate\Http\Request;
class OrderTotal extends Line
{
/**
* 初始化卡片内容
*/
protected function init()
{
parent::init();
$this->title('订单量');
$this->dropdown([
'1' => '今天',
'7' => '最近7天',
'30' => '最近30天',
'365' => '最近一年',
]);
//$this->chartLabels(['Finished', 'Pending', 'Rejected']);
// $this->dropdown([
// '7' => 'Last 7 Days',
// '28' => 'Last 28 Days',
// '30' => 'Last Month',
// '365' => 'Last Year',
// ]);
}
/**
* 处理请求
*
* @param Request $request
*
* @return mixed|void
*/
public function handle(Request $request)
{
switch ($request->get('option')) {
case '365':
$data = OrderInfoModel::getYearData();
// 卡片内容
$this->withContent($data['total']);
// 图表数据
$this->withChart($data['list']);
break;
case '30':
$data = OrderInfoModel::getNumDayData(30);
// 卡片内容
$this->withContent($data['total']);
// 图表数据
$this->withChart($data['list']);
break;
case '7':
$data = OrderInfoModel::getNumDayData(7);
// 卡片内容
$this->withContent($data['total']);
// 图表数据
$this->withChart($data['list']);
break;
default:
$data = OrderInfoModel::getNumDayData(1);
// 卡片内容
$this->withContent($data['total']);
// 图表数据
$this->withChart($data['list']);
}
}
/**
* 设置图表数据.
*
* @param array $data
*
* @return $this
*/
public function withChart(array $data)
{
$series_data = [];
foreach ($data as $v) {
$series_data[] = $v;
}
return $this->chart([
'series' => [
[
'name' => '订单量',
'data' => $series_data,
],
],
'stroke' => [
'curve' => 'smooth'
],
]);
}
/**
* 设置卡片内容.
*
* @param string $content
*
* @return $this
*/
public function withContent($content)
{
return $this->content(
<<<HTML
<div class="d-flex justify-content-between align-items-center mt-1" style="margin-bottom: 2px">
<h2 class="ml-1 font-lg-1">{$content}</h2>
<span class="mb-0 mr-1 text-80">{$this->title}</span>
</div>
HTML
);
}
}
<?php
namespace App\Admin\Metrics\Examples;
use Dcat\Admin\Widgets\Metrics\Round;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Dcat\Admin\Widgets\Metrics\Line;
class Product extends Line
{
/**
* 初始化卡片内容
*/
protected function init()
{
parent::init();
//$this->title('Product Orders');
//$this->chartLabels(['Finished', 'Pending', 'Rejected']);
// $this->dropdown([
// '7' => 'Last 7 Days',
// '28' => 'Last 28 Days',
// '30' => 'Last Month',
// '365' => 'Last Year',
// ]);
}
/**
* 处理请求
*
* @param Request $request
*
* @return mixed|void
*/
public function handle(Request $request)
{
switch ($request->get('option')) {
case '365':
case '30':
case '28':
case '7':
default:
$list = DB::table('li_goods')->where('is_show', 1)->orderBy('sale', 'desc')->limit(10)->get();
$html = '';
foreach ($list as $kk => $vv) {
$html .= '<tr>';
$html .= '<td style="width:20%;text-align:left;"><img src="' . env('IMAGE_URL') . $vv->cover_img . '" width="100"></td>';
$html .= '<td style="width:36%;text-align:left;">' . $vv->goods_name . '</td>';
$html .= '<td style="width:33%;">销量:' . $vv->sale . '</td>';
$html .= '</tr>';
}
// 卡片内容
$this->withContent(23043, $html);
// 图表数据
//$this->withChart([70, 52, 26]);
// 总数
$this->chartTotal('Total', 344);
}
}
/**
* 设置图表数据.
*
* @param array $data
*
* @return $this
*/
public function withChart(array $data)
{
return $this->chart([
'series' => $data,
]);
}
/**
* 卡片内容.
*
* @param int $finished
* @param int $pending
* @param int $rejected
*
* @return $this
*/
public function withContent($finished, $dataList)
{
return $this->content(
<<<HTML
<div class="col-sm-12 d-flex flex-column flex-wrap text-center">
<table border="0" cellpadding="8" style="width:98%;border-spacing:8px;margin-bottom:15px;">
{$dataList}
</table>
</div>
HTML
);
}
}
<?php
namespace App\Admin\Metrics\Examples;
use Dcat\Admin\Admin;
use Dcat\Admin\Widgets\Metrics\Bar;
use Illuminate\Http\Request;
class Sessions extends Bar
{
/**
* 初始化卡片内容
*/
protected function init()
{
parent::init();
$color = Admin::color();
$dark35 = $color->dark35();
// 卡片内容宽度
$this->contentWidth(5, 7);
// 标题
$this->title('Avg Sessions');
// 设置下拉选项
$this->dropdown([
'7' => 'Last 7 Days',
'28' => 'Last 28 Days',
'30' => 'Last Month',
'365' => 'Last Year',
]);
// 设置图表颜色
$this->chartColors([
$dark35,
$dark35,
$color->primary(),
$dark35,
$dark35,
$dark35
]);
}
/**
* 处理请求
*
* @param Request $request
*
* @return mixed|void
*/
public function handle(Request $request)
{
switch ($request->get('option')) {
case '7':
default:
// 卡片内容
$this->withContent('2.7k', '+5.2%');
// 图表数据
$this->withChart([
[
'name' => 'Sessions',
'data' => [75, 125, 225, 175, 125, 75, 25],
],
]);
}
}
/**
* 设置图表数据.
*
* @param array $data
*
* @return $this
*/
public function withChart(array $data)
{
return $this->chart([
'series' => $data,
]);
}
/**
* 设置卡片内容.
*
* @param string $title
* @param string $value
* @param string $style
*
* @return $this
*/
public function withContent($title, $value, $style = 'success')
{
// 根据选项显示
$label = strtolower(
$this->dropdown[request()->option] ?? 'last 7 days'
);
$minHeight = '183px';
return $this->content(
<<<HTML
<div class="d-flex p-1 flex-column justify-content-between" style="padding-top: 0;width: 100%;height: 100%;min-height: {$minHeight}">
<div class="text-left">
<h1 class="font-lg-2 mt-2 mb-0">{$title}</h1>
<h5 class="font-medium-2" style="margin-top: 10px;">
<span class="text-{$style}">{$value} </span>
<span>vs {$label}</span>
</h5>
</div>
<a href="#" class="btn btn-primary shadow waves-effect waves-light">View Details <i class="feather icon-chevrons-right"></i></a>
</div>
HTML
);
}
}
<?php
namespace App\Admin\Metrics\Examples;
use Dcat\Admin\Widgets\Metrics\RadialBar;
use Illuminate\Http\Request;
class Tickets extends RadialBar
{
/**
* 初始化卡片内容
*/
protected function init()
{
parent::init();
$this->title('Tickets');
$this->height(400);
$this->chartHeight(300);
$this->chartLabels('Completed Tickets');
$this->dropdown([
'7' => 'Last 7 Days',
'28' => 'Last 28 Days',
'30' => 'Last Month',
'365' => 'Last Year',
]);
}
/**
* 处理请求
*
* @param Request $request
*
* @return mixed|void
*/
public function handle(Request $request)
{
switch ($request->get('option')) {
case '365':
case '30':
case '28':
case '7':
default:
// 卡片内容
$this->withContent(162);
// 卡片底部
$this->withFooter(29, 63, '1d');
// 图表数据
$this->withChart(83);
}
}
/**
* 设置图表数据.
*
* @param int $data
*
* @return $this
*/
public function withChart(int $data)
{
return $this->chart([
'series' => [$data],
]);
}
/**
* 卡片内容
*
* @param string $content
*
* @return $this
*/
public function withContent($content)
{
return $this->content(
<<<HTML
<div class="d-flex flex-column flex-wrap text-center">
<h1 class="font-lg-2 mt-2 mb-0">{$content}</h1>
<small>Tickets</small>
</div>
HTML
);
}
/**
* 卡片底部内容.
*
* @param string $new
* @param string $open
* @param string $response
*
* @return $this
*/
public function withFooter($new, $open, $response)
{
return $this->footer(
<<<HTML
<div class="d-flex justify-content-between p-1" style="padding-top: 0!important;">
<div class="text-center">
<p>New Tickets</p>
<span class="font-lg-1">{$new}</span>
</div>
<div class="text-center">
<p>Open Tickets</p>
<span class="font-lg-1">{$open}</span>
</div>
<div class="text-center">
<p>Response Time</p>
<span class="font-lg-1">{$response}</span>
</div>
</div>
HTML
);
}
}
<?php
namespace App\Admin\Metrics\Examples;
use Dcat\Admin\Widgets\Metrics\Card;
use Illuminate\Contracts\Support\Renderable;
use Illuminate\Http\Request;
class TotalUsers extends Card
{
/**
* 卡片底部内容.
*
* @var string|Renderable|\Closure
*/
protected $footer;
/**
* 初始化卡片.
*/
protected function init()
{
parent::init();
$this->title('Total Users');
$this->dropdown([
'7' => 'Last 7 Days',
'28' => 'Last 28 Days',
'30' => 'Last Month',
'365' => 'Last Year',
]);
}
/**
* 处理请求.
*
* @param Request $request
*
* @return void
*/
public function handle(Request $request)
{
switch ($request->get('option')) {
case '365':
$this->content(mt_rand(600, 1500));
$this->down(mt_rand(1, 30));
break;
case '30':
$this->content(mt_rand(170, 250));
$this->up(mt_rand(12, 50));
break;
case '28':
$this->content(mt_rand(155, 200));
$this->up(mt_rand(5, 50));
break;
case '7':
default:
$this->content(143);
$this->up(15);
}
}
/**
* @param int $percent
*
* @return $this
*/
public function up($percent)
{
return $this->footer(
"<i class=\"feather icon-trending-up text-success\"></i> {$percent}% Increase"
);
}
/**
* @param int $percent
*
* @return $this
*/
public function down($percent)
{
return $this->footer(
"<i class=\"feather icon-trending-down text-danger\"></i> {$percent}% Decrease"
);
}
/**
* 设置卡片底部内容.
*
* @param string|Renderable|\Closure $footer
*
* @return $this
*/
public function footer($footer)
{
$this->footer = $footer;
return $this;
}
/**
* 渲染卡片内容.
*
* @return string
*/
public function renderContent()
{
$content = parent::renderContent();
return <<<HTML
<div class="d-flex justify-content-between align-items-center mt-1" style="margin-bottom: 2px">
<h2 class="ml-1 font-lg-1">{$content}</h2>
</div>
<div class="ml-1 mt-1 font-weight-bold text-80">
{$this->renderFooter()}
</div>
HTML;
}
/**
* 渲染卡片底部内容.
*
* @return string
*/
public function renderFooter()
{
return $this->toString($this->footer);
}
}
<?php
namespace App\Admin\Renderable;
use App\Models\MerchantGoodSku;
use App\Models\Good as GoodModel;
use App\Models\Category;
use Dcat\Admin\Grid;
use Dcat\Admin\Grid\LazyRenderable;
class MerchantStoreSkuList extends LazyRenderable
{
public function grid(): Grid
{
// 获取外部传递的参数
$mgs_id = $this->payload['mgs_id'] ?? [];
return Grid::make(MerchantGoodSku::with(['attr']), function (Grid $grid) use ($mgs_id) {
$grid->addTableClass(['table-text-center']);
$grid->model()->where('mgs_id', $mgs_id);
$grid->column('attr.attr_val', '规格');
// $grid->column('attr.market_price', '零售价');
// $grid->column('attr.cg_price', '代购价');
$grid->column('stock', '剩余库存');
$grid->disableCreateButton();
$grid->disableRefreshButton();
$grid->disablePagination();
$grid->disableViewButton();
$grid->disableEditButton();
$grid->disableRowSelector();
$grid->disableDeleteButton();
$grid->disableActions();
//屏蔽删除
//$grid->actions(new DeleteService());
});
}
}
<?php
namespace App\Admin\Renderable;
use App\Models\OrderGoods;
use App\Models\Good as GoodModel;
use App\Models\Category;
use Dcat\Admin\Grid;
use Dcat\Admin\Grid\LazyRenderable;
class OrderGoodsList extends LazyRenderable
{
public function grid(): Grid
{
// 获取外部传递的参数
$order_id = $this->payload['order_id'] ?? [];
return Grid::make(new OrderGoods(), function (Grid $grid) use ($order_id) {
$grid->addTableClass(['table-text-center']);
$grid->model()->where('order_id', $order_id);
//$grid->column('goods_img', '图片')->image(env("IMAGE_URL"), 50);
$grid->column('goods_name', '标题')->limit(15)->width(300);
$grid->column('goods_attr', '规格')->limit(10);
$grid->column('goods_number', '数量')->limit(10);
$grid->column('goods_price', '价格')->limit(10);
$grid->column('total', '合计')->display(function ($val) {
$num = $this->goods_number;
$price = $this->goods_price;
return sprintf("%.2f", $price * $num);
});
$grid->disableCreateButton();
$grid->disableRefreshButton();
$grid->disablePagination();
$grid->disableViewButton();
$grid->disableEditButton();
$grid->disableRowSelector();
$grid->disableDeleteButton();
$grid->disableActions();
//屏蔽删除
//$grid->actions(new DeleteService());
});
}
}
<?php
namespace App\Admin\Renderable;
use App\Models\OrderGoods;
use App\Models\Good as GoodModel;
use App\Models\Category;
use App\Models\GoodSku;
use Dcat\Admin\Grid;
use Dcat\Admin\Grid\LazyRenderable;
class RenderGoodSku extends LazyRenderable
{
public function grid(): Grid
{
// 获取外部传递的参数
$gid = $this->payload['goods_id'] ?? [];
return Grid::make(new GoodSku(), function (Grid $grid) use ($gid) {
$grid->model()->where('goods_id', $gid);
//规格 购买数量 折扣价 采购价 京东价 零售价 库存
$grid->addTableClass(['table-text-center']);
$grid->model()->where('goods_id', $gid);
$grid->column('attr_val', '规格');
$grid->column('cg_price', '代购价');
$grid->column('market_price', '零售价');
$grid->column('stock', '库存');
$grid->disableCreateButton();
$grid->disableRefreshButton();
$grid->disablePagination();
$grid->disableViewButton();
$grid->disableEditButton();
$grid->disableRowSelector();
$grid->disableDeleteButton();
$grid->disableActions();
//屏蔽删除
//$grid->actions(new DeleteService());
});
}
}
<?php
namespace App\Admin\Renderable;
use App\Models\Store;
use App\Models\Good as GoodModel;
use App\Models\Category;
use Dcat\Admin\Grid;
use Dcat\Admin\Grid\LazyRenderable;
class StoreList extends LazyRenderable
{
public function grid(): Grid
{
// 获取外部传递的参数
$merchant_id = $this->payload['merchant_id'] ?? [];
return Grid::make(new Store(), function (Grid $grid) use ($merchant_id) {
$grid->addTableClass(['table-text-center']);
$grid->model()->where('merchant_id', $merchant_id);
$grid->column('title', '门店名称');
$grid->column('lat_lng', '经纬度');
$grid->column('address', '详细地址');
$grid->column('distance', '配送范围')->display(function ($val) {
return $val > 0 ? $val . " 公里" : '';
});
$grid->disableCreateButton();
$grid->disableRefreshButton();
$grid->disablePagination();
$grid->disableViewButton();
$grid->disableEditButton();
$grid->disableRowSelector();
$grid->disableDeleteButton();
$grid->disableActions();
//屏蔽删除
//$grid->actions(new DeleteService());
});
}
}
<?php
namespace App\Admin\Repositories;
use App\Models\Article as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class Article extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
}
<?php
namespace App\Admin\Repositories;
use Dcat\Admin\Repositories\EloquentRepository;
use App\Models\GoodSku as GoodSkuModel;
class GoodSku extends EloquentRepository
{
protected $eloquentClass = GoodSkuModel::class;
}
<?php
namespace App\Admin\Repositories;
use App\Models\Verifier as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class Verifier extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
}
<?php
use Dcat\Admin\Admin;
use Dcat\Admin\Grid;
use Dcat\Admin\Form;
use Dcat\Admin\Grid\Filter;
use Dcat\Admin\Show;
/**
* Dcat-admin - admin builder based on Laravel.
* @author jqh <https://github.com/jqhph>
*
* Bootstraper for Admin.
*
* Here you can remove builtin form field:
*
* extend custom field:
* Dcat\Admin\Form::extend('php', PHPEditor::class);
* Dcat\Admin\Grid\Column::extend('php', PHPEditor::class);
* Dcat\Admin\Grid\Filter::extend('php', PHPEditor::class);
*
* Or require js and css assets:
* Admin::css('/packages/prettydocs/css/styles.css');
* Admin::js('/packages/prettydocs/js/main.js');
*
*/
<?php
use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Route;
use Dcat\Admin\Admin;
Admin::routes();
Route::group([
'prefix' => config('admin.route.prefix'),
'namespace' => config('admin.route.namespace'),
'middleware' => config('admin.route.middleware'),
], function (Router $router) {
/****************************************************** 图片文件上传组件Start *********************************************************/
$router->match(['put', 'post'], 'upload/user', 'UploadController@userUpload'); //头像图上传
$router->match(['put', 'post'], 'upload/goods', 'UploadController@goodsUpload'); //商品图上传
$router->match(['put', 'post'], 'upload/merchant', 'UploadController@merchantUpload'); //门店图上传
$router->match(['put', 'post'], 'upload/user-avatar', 'UploadController@uploadUserAvatar'); //上传用户头像
$router->match(['put', 'post'], 'upload/carousel', 'UploadController@carouselUpload'); //上传轮播图
$router->match(['put', 'post'], 'upload/article', 'UploadController@articleUpload'); //上传文章图
$router->match(['put', 'post'], 'upload/skuImage', 'UploadController@uploadSkuImage'); //上传商品规格图
//$router->match(['put', 'post'], 'upload/resource-file', 'UploadController@uploadResourceFile'); //上传资源文件
/****************************************************** 图片文件上传组件end *********************************************************/
$router->get('/', 'HomeController@index');
$router->resource('category', 'CategoryController'); //分类管理
$router->resource('article', 'ArticleController'); //文章管理
$router->resource('goods', 'GoodController'); //商品管理
Route::get('goods-export', 'GoodController@export'); //导出
$router->resource('kefu', 'KefuController'); //平台客服
$router->resource('setting', 'SystemSettingController'); //数值设置
$router->resource('orderInfo', 'OrderInfoController'); //订单管理
$router->resource('user', 'UserController'); //用户管理
$router->resource('user-share', 'shareController'); //查看下级
$router->resource('user-check', 'UserCheckController'); //用户审核列表
$router->resource('check-number', 'CheckNumberController'); //审核编号列表
$router->resource('carousel', 'CarouselController'); //轮播图管理
$router->resource('merchant', 'MerchantController'); //商家管理
$router->resource('merchant-store', 'MerchantGoodsStoreController'); //商家库存管理
$router->resource('merchant-store-log', 'MerchantStoreSkuLogController'); //商家库存记录
$router->resource('buycode-check', 'UserBuycodeCheckController'); //直购码审核
$router->resource('verifier', 'StoreAdminUsersController'); //核销员列表
$router->resource('comment', 'CommentController'); //评论列表
$router->resource('comment-tpl', 'CommentTplController'); //评价模板
$router->resource('check-cashout', 'IncomeController'); //提现审核管理
$router->get('city', 'CityController@getList'); //城市选择-联动
$router->get('get-store-list', 'MerchantStoreController@getList'); //门店选择-联动
});
<?php
namespace App\Command;
class Log{
static public function add(string $logKey, mixed $logInfo) :void{
//判断当天的日志文件是否存在
$day = date('Y-m-d');
$logFileName = 'runLog_'.$day.'.log';
$logPath = storage_path("logs/".$logFileName);
file_put_contents($logPath,date('【 H:i:s 】'.$logKey.': ').print_r($logInfo,true),FILE_APPEND);
}
}
<?php
namespace App\Command;
class Tools{
//计算俩地距离
function get_two_point_distance($lat1,$lng1,$lat2,$lng2)
{
$radLat1 = deg2rad($lat1);//deg2rad()函数将角度转换为弧度
$radLat2 = deg2rad($lat2);
$radLng1 = deg2rad($lng1);
$radLng2 = deg2rad($lng2);
$a = $radLat1 - $radLat2;
$b = $radLng1 - $radLng2;
$s = 2 * asin(sqrt(pow(sin($a / 2), 2) + cos($radLat1) * cos($radLat2) * pow(sin($b / 2), 2))) * 6378.137;
return round($s,2);//返回公里数
}
}
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')->hourly();
}
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}
<?php
namespace App\Exceptions;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
use Throwable;
class Handler extends ExceptionHandler
{
/**
* A list of exception types with their corresponding custom log levels.
*
* @var array<class-string<\Throwable>, \Psr\Log\LogLevel::*>
*/
protected $levels = [
//
];
/**
* A list of the exception types that are not reported.
*
* @var array<int, class-string<\Throwable>>
*/
protected $dontReport = [
//
];
/**
* A list of the inputs that are never flashed to the session on validation exceptions.
*
* @var array<int, string>
*/
protected $dontFlash = [
'current_password',
'password',
'password_confirmation',
];
/**
* Register the exception handling callbacks for the application.
*
* @return void
*/
public function register()
{
$this->renderable(function (AuthenticationException $e) {
return [
'code' => 403,
'message' => "未通过身份验证",
'data'=>''
];
});
}
public function render($request, Throwable $exception)
{
/**
* Render an exception into an HTTP response.
*
* 替换渲染功能
* Request::isMethod('post') 请求方法为post
* $exception instanceof MethodNotAllowedHttpException $exception异常是MethodNotAllowedHttpException实例化的结果
* 此方式针对访问不存在的方法GET方法无用,将继续渲染一个404的页面,因此在api.php路由最后定义了一个回退路由,针对GET方法的
*/
// if (Request::isMethod('post') && $exception instanceof MethodNotAllowedHttpException) {
if ($exception instanceof MethodNotAllowedHttpException) {
return response()->json([
'code' => 404,
'msg' => '地址不存在',
'data' => null
], 200
);
}
return parent::render($request, $exception);
}
}
<?php
namespace App\Handlers;
use OSS\OssClient;
require_once '../vendor/aliyuncs/oss-sdk-php/autoload.php';
class AilOss
{
public static $oss;
/**
* @throws \OSS\Core\OssException
*/
public function __construct()
{
$accessKeyId = env('OSS_ACCESS_KEY_ID'); //获取阿里云oss的accessKeyId
$accessKeySecret = env('OSS_ACCESS_KEY_SECRET'); //获取阿里云oss的accessKeySecret
$endpoint = env('OSS_ENDPOINT'); //获取阿里云oss的endPoint
self::$oss = new OssClient($accessKeyId, $accessKeySecret, $endpoint); //实例化OssClient对象
}
/**
*
* 使用阿里云oss上传文件
* @param $object 保存到阿里云oss的文件名
* @param $filepath 文件在本地的绝对路径
* @return bool 上传是否成功
* @throws \OSS\Core\OssException
*/
public function upload($object, $filepath,$bucket ='OSS_BUCKET')
{
$res = false;
$bucket = env($bucket); //获取阿里云oss的bucket
if (self::$oss->uploadFile($bucket, $object, $filepath)) { //调用uploadFile方法把服务器文件上传到阿里云oss
$res = true;
}
return $res;
}
/**
* 删除指定文件
* @param $object string 被删除的文件名
* @return bool 删除是否成功
*/
public function delete(string $object,$bucket = 'OSS_BUCKET')
{
$res = false;
$bucket = env($bucket);
if (self::$oss->deleteObject($bucket, $object)){ //调用deleteObject方法把服务器文件上传到阿里云oss
$res = true;
}
return $res;
}
/**
* 删除指定文件
* @param $object 被删除的文件名
* @return bool 删除是否成功
*/
public function delete_array($objects,$bucket ='OSS_BUCKET')
{
$res = false;
$bucket = env($bucket);
if (self::$oss->deleteObjects($bucket, $objects)){ //调用deleteObject方法把服务器文件上传到阿里云oss
$res = true;
}
return $res;
}
/*获取文件的临时访问URL*/
public function getUrl($OssFilePath,$time = 1800,$bucket ='OSS_BUCKET')
{
// 生成一个带签名的URL,有效期是3600秒,可以直接使用浏览器访问。
$timeout = $time;
$bucket = env($bucket);
return self::$oss->signUrl($bucket,$OssFilePath,$timeout,"GET");
}
/**
* 在OSS中创建虚拟“文件夹”。名称不应以“/”结尾,因为该方法无论如何都会用“/”追加名称。
*
* Internal use only.
*
* @param string $dirName 文件夹名称
* @return bool
*/
public function createDir($dirName,$bucket = 'OSS_BUCKET')
{
$res = false;
$bucket = env($bucket);
if (self::$oss->createObjectDir($bucket, $dirName)) {
$res = true;
}
return $res;
}
/*获取指定目录下的目录与文件*/
public function fileList($dir, $maxKey = 1000, $delimiter = '/', $nextMarker = '') {
$fileList = []; // 获取的文件列表, 数组的一阶表示分页结果
$dirList = []; // 获取的目录列表, 数组的一阶表示分页结果
$storageList = [
'file' => [], // 真正的文件数组
'dir' => [], // 真正的目录数组
];
while (true) {
$options = [
'delimiter' => $delimiter,
'prefix' => $dir,
'max-keys' => $maxKey,
'marker' => $nextMarker,
];
$bucket = env('OSS_BUCKET');
try {
$fileListInfo = self::$oss->listObjects($bucket, $options);
// 得到nextMarker, 从上一次 listObjects 读到的最后一个文件的下一个文件开始继续获取文件列表, 类似分页
} catch (\Exception $e) {
return $e->getMessage(); // 发送错误信息
}
$nextMarker = $fileListInfo->getNextMarker();
$fileItem = $fileListInfo->getObjectList();
$dirItem = $fileListInfo->getPrefixList();
$fileList[] = $fileItem;
$dirList[] = $dirItem;
if ($nextMarker === '') break;
}
foreach ($fileList[0] as $item){
$storageList['file'][] = $this->objectInfoParse($item);
}
foreach ($dirList[0] as $item){
$storageList['dir'][] = $this->prefixInfoParse($item);
}
return $storageList; // 发送正确信息
}
/* 解析 prefixInfo 类 */
private function prefixInfoParse($prefixInfo){
return [
'dir' => $prefixInfo->getPrefix(),
];
}
/* 解析 objectInfo 类 */
public function objectInfoParse($objectInfo) {
return [
'name' => $objectInfo->getKey(),
'size' => $objectInfo->getSize(),
'update_at' => $objectInfo->getLastModified(),
];
}
}
<?php
namespace App\Handlers;
use Intervention\Image\Facades\Image;
use Illuminate\Support\Str;
class FileUploadHandler
{
// 只允许以下后缀名的图片文件上传
protected $allowed_ext = ["png", "jpg", 'jpeg', 'pdf'];
public function save($file)
{
$folder_name = "/" . date("Ymd", time());
$upload_path = public_path() . '/uploads' . $folder_name;
$extension = strtolower($file->getClientOriginalExtension()) ?: 'png';
$filename = time() . '_' . Str::random(10) . '.' . $extension;
if (!in_array($extension, $this->allowed_ext)) {
return false;
}
$file->move($upload_path, $filename);
return "$folder_name/$filename";
}
public function reduceSize($file_path, $max_width)
{
$image = Image::make($file_path);
$image->resize($max_width, null, function ($condition) {
$condition->aspectRatio();
$condition->upsize();
});
$image->save();
}
}
<?php
namespace App\Handlers;
use Qcloud\Cos\Client;
class QqCos
{
public static $cos;
/**
* @throws
*/
public function __construct()
{
$accessKeyId = env('COS_SECRET_ID');
$accessKeySecret = env('COS_SECRET_KEY');
$region = env('COS_REGION');
self::$cos = new Client([
'region' => $region,
'credentials' => [
'secretId' => $accessKeyId,
'secretKey' => $accessKeySecret,
],
]);
}
/**
*
* 使用腾讯云cos上传文件
* @param $object 保存到腾讯云cos的文件名
* @param $filepath 文件在本地的绝对路径
* @return bool 上传是否成功
* @throws
*/
public function upload($object, $filepath, $bucket = 'COS_BUCKET')
{
$res = false;
$bucket = env($bucket);
if (self::$cos->putObject(['Bucket' => $bucket, 'Key' => $object, 'Body' => fopen($filepath, 'rb')])) {
$res = true;
}
return $res;
}
/**
* 删除指定文件
* @param $object string 被删除的文件名
* @return bool 删除是否成功
*/
public function delete(string $object, $bucket = 'COS_BUCKET')
{
$res = false;
$bucket = env($bucket);
$result = self::$cos->deleteObject(['Bucket' => $bucket, 'Key' => $object]);
if ($result) { //调用deleteObject方法删除腾讯云COS文件
$res = true;
}
return $res;
}
/**
* 删除指定文件
* @param $object 被删除的文件名
* @return bool 删除是否成功
*/
public function delete_array($objects, $bucket = 'COS_BUCKET')
{
$res = false;
$bucket = env($bucket);
if (self::$cos->deleteObjects($bucket, $objects)) { //调用deleteObject方法把服务器文件上删除
$res = true;
}
return $res;
}
/*获取文件的临时访问URL*/
public function getUrl($OssFilePath, $time = 1800, $bucket = 'COS_BUCKET')
{
// 生成一个带签名的URL,有效期是3600秒,可以直接使用浏览器访问。
$timeout = $time;
$bucket = env($bucket);
return self::$cos->signUrl($bucket, $OssFilePath, $timeout, "GET");
}
/**
* 在OSS中创建虚拟“文件夹”。名称不应以“/”结尾,因为该方法无论如何都会用“/”追加名称。
*
* Internal use only.
*
* @param string $dirName 文件夹名称
* @return bool
*/
public function createDir($dirName, $bucket = 'COS_BUCKET')
{
$res = false;
$bucket = env($bucket);
if (self::$cos->createObjectDir($bucket, $dirName)) {
$res = true;
}
return $res;
}
/*获取指定目录下的目录与文件*/
public function fileList($dir, $maxKey = 1000, $delimiter = '/', $nextMarker = '')
{
$fileList = []; // 获取的文件列表, 数组的一阶表示分页结果
$dirList = []; // 获取的目录列表, 数组的一阶表示分页结果
$storageList = [
'file' => [], // 真正的文件数组
'dir' => [], // 真正的目录数组
];
while (true) {
$options = [
'delimiter' => $delimiter,
'prefix' => $dir,
'max-keys' => $maxKey,
'marker' => $nextMarker,
];
$bucket = env('OSS_BUCKET');
try {
$fileListInfo = self::$cos->listObjects($bucket, $options);
// 得到nextMarker, 从上一次 listObjects 读到的最后一个文件的下一个文件开始继续获取文件列表, 类似分页
} catch (\Exception $e) {
return $e->getMessage(); // 发送错误信息
}
$nextMarker = $fileListInfo->getNextMarker();
$fileItem = $fileListInfo->getObjectList();
$dirItem = $fileListInfo->getPrefixList();
$fileList[] = $fileItem;
$dirList[] = $dirItem;
if ($nextMarker === '') break;
}
foreach ($fileList[0] as $item) {
$storageList['file'][] = $this->objectInfoParse($item);
}
foreach ($dirList[0] as $item) {
$storageList['dir'][] = $this->prefixInfoParse($item);
}
return $storageList; // 发送正确信息
}
/* 解析 prefixInfo 类 */
private function prefixInfoParse($prefixInfo)
{
return [
'dir' => $prefixInfo->getPrefix(),
];
}
/* 解析 objectInfo 类 */
public function objectInfoParse($objectInfo)
{
return [
'name' => $objectInfo->getKey(),
'size' => $objectInfo->getSize(),
'update_at' => $objectInfo->getLastModified(),
];
}
}
<?php
/**
* 含有中文数组排序
*/
function utf8_array_asort(&$array)
{
if (!isset($array) || !is_array($array)) {
return false;
}
foreach ($array as $k => $v) {
$array[$k] = iconv('UTF-8', 'GBK//IGNORE', $v);
}
asort($array);
foreach ($array as $k => $v) {
$array[$k] = iconv('GBK', 'UTF-8//IGNORE', $v);
}
return true;
}
/**
* 生成随机字符串
*/
function generateRandomString($length = 10)
{
$characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
return $randomString;
}
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\DB;
/**
* api基类
*/
class BaseController extends Controller
{
/**
* 验证码有效时长
* @var int
*/
protected static $expire = 300;
/**
* 最大允许检测的次数
* @var int
*/
protected static $maxCheckNums = 10;
/**
* @param $data mixed 返回的数据
* @param $msg string 状态码
* @param $code int 返回的自定义信息
* @return Response
*/
protected function JsonResponse($data, string $msg = 'Success', int $code = 200): Response
{
//组建返回结果
$result = [
'code' => $code,
'message' => $msg,
'data' => $data,
];
return response($result, 200);
}
public function checkcode($mobile, $code, $event = 'default')
{
$time = time() - self::$expire;
$smsObj = DB::table("li_sms")->where(['mobile' => $mobile, 'event' => $event])
->orderBy('id', 'DESC')
->first();
if ($smsObj) {
$sms = get_object_vars($smsObj);
if ($sms['createtime'] > $time && $sms['times'] <= self::$maxCheckNums) {
$correct = $code == $sms['code'];
if (!$correct) {
$smsObj->times = $smsObj->times + 1;
$smsObj->save();
return false;
} else {
return true;
}
} else {
// 过期则清空该手机验证码
$this->flush($mobile, $event);
return false;
}
} else {
return false;
}
}
public function flush($mobile, $event = 'default')
{
DB::table("li_sms")->where(['mobile' => $mobile, 'event' => $event])
->delete();
return true;
}
}
<?php
namespace App\Http\Controllers\Api;
use App\Command\Log;
use App\Handlers\QqCos;
use App\Handlers\FileUploadHandler;
use App\Models\Carousel;
use App\Models\User;
use App\Models\UserPermission;
use Illuminate\Http\Request;
class CarouselController extends BaseController
{
public function getList()
{
$list = (new Carousel())->select("id", "imgUrl", "title", "status")
->where("status", 1)
->orderBy("id", "desc")
->limit(9)
->get();
foreach ($list as $key => $val) {
$list[$key]['imgUrl'] = ($val->imgUrl ? env('IMAGE_URL') . $val->imgUrl : "");
}
return $this->JsonResponse($list);
}
}
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Api\BaseController;
use App\Models\Category as CategoryModel;
use Illuminate\Http\Request;
class CategoryController extends BaseController
{
public function getList(Request $request)
{
$parent_id = $request->parent_id ?? 0;
$limit = $request->parent_id ?? 50;
$data = [
'list' => []
];
$model = CategoryModel::select(['id', 'parent_id', 'title', 'icon'])
->where(['show' => 1, 'parent_id' => $parent_id])
->orderBy("order", "asc");
$listData = $model->limit($limit)->get();
if ($listData->toArray()) {
foreach ($listData as $item) {
$data['list'][] = [
'id' => $item->id,
'parent_id' => $item->parent_id,
'title' => $item->title,
'icon' => (isset($item->icon) ? env('IMAGE_URL') . $item->icon : '')
];
}
}
return $this->JsonResponse($data);
}
public function getAllList(Request $request)
{
$cat_id = $request->cat_id ?? 0;
$data = [];
$catList = CategoryModel::where(['show' => 1, 'parent_id' => 0])->select("id", 'title', 'brief', 'icon', 'imgUrl', 'is_explore', 'explore', 'linkUrl')->get();
if (!$catList) {
return $this->JsonResponse('', '参数错误', 201);
}
foreach ($catList as $key => $val) {
$tmp = [];
$tmp['id'] = $val->id;
$tmp['title'] = $val->title;
$tmp['brief'] = $val->brief ?? '';
$tmp['cover'] = (isset($val->icon) ? env('IMAGE_URL') . $val->icon : '');
$tmp['imgUrl'] = (isset($val->imgUrl) ? env('IMAGE_URL') . $val->imgUrl : '');
$tmp['is_explore'] = $val->is_explore ?? 0;
$tmp['explore'] = $val->explore ?? '';
$tmp['linkUrl'] = $val->linkUrl ?? '';
$tmp['list'] = [];
$seclist = CategoryModel::select(['id', 'parent_id', 'title', 'icon'])
->where(['show' => 1, 'parent_id' => $val->id])->get();
foreach ($seclist as $kk => $vv) {
$secArr = [
'id' => $vv->id,
'title' => $vv->title,
'cover' => (isset($vv->icon) ? env('IMAGE_URL') . $vv->icon : '')
];
$tmp['list'][] = $secArr;
}
array_push($data, $tmp);
}
return $this->JsonResponse($data);
}
public function getSecList(Request $request)
{
$cat_id = $request->cat_id ?? 0;
$data = $res = [];
$catList = CategoryModel::where(['show' => 1, 'parent_id' => $cat_id])->select("id", 'title', 'parent_id')->get();
if (!$catList) {
return $this->JsonResponse('', '参数错误', 201);
}
$catRows = $catList->toArray();
array_unshift($catRows, ['id' => 0, 'parent_id' => $cat_id, 'title' => '全部']);
return $this->JsonResponse($catRows);
}
public function getThirdList(Request $request)
{
$cat_id = $request->cat_id ?? 0;
$pid = $request->pid ?? null;
$catList = [];
if ($cat_id) {
$catList = CategoryModel::where(['show' => 1, 'parent_id' => $cat_id])
->select("id", 'title', 'icon as cover', 'parent_id')
->get()->toArray();
}
if ($pid) {
$secList = CategoryModel::where(['show' => 1, 'parent_id' => $pid])
->select("id", 'title')
->get()
->toArray();
if ($secList) {
$secArr = [];
foreach ($secList as $key => $val) {
array_push($secArr, $val['id']);
}
$catList = CategoryModel::whereIn("parent_id", $secArr)
->select("id", 'title', 'icon as cover')
->get()
->toArray();
}
}
foreach ($catList as $kk => &$vv) {
$vv['cover'] = (isset($vv['cover']) ? env('IMAGE_URL') . $vv['cover'] : '');
}
// if (!$catList) {
// return $this->JsonResponse('', '参数错误', 201);
// }
return $this->JsonResponse($catList);
}
public function getSecList2(Request $request)
{
$cat_id = $request->cat_id ?? 0;
$data = [
'list' => []
];
$cat = CategoryModel::where(['show' => 1, 'id' => $cat_id])->first();
if (!$cat) {
return $this->JsonResponse('', '参数错误', 201);
}
$data['title'] = $cat->title;
$data['cover'] = (isset($cat->icon) ? env('IMAGE_URL') . $cat->icon : '');
//分类列表
$model = CategoryModel::select(['id', 'parent_id', 'title', 'brief', 'icon'])
->where(['show' => 1, 'parent_id' => $cat_id]);
$listData = $model->limit(50)->get();
if ($listData->toArray()) {
foreach ($listData as $item) {
$data['list'][] = [
'id' => $item->id,
'parent_id' => $item->parent_id,
'title' => $item->title,
//'cover' => (isset($item->icon) ? env('IMAGE_URL') . $item->icon : '')
];
}
}
return $this->JsonResponse($data);
}
}
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Api\BaseController;
use App\Models\Good as GoodModel;
use App\Models\GoodSku;
use App\Models\UserCollect;
use App\Models\Category as CategoryModel;
use App\Models\GoodsAttr as GoodsAttrModel;
use Illuminate\Http\Request;
class GoodController extends BaseController
{
public function getCatGoodList(Request $request)
{
$cat_id = $request->cat_id ?? null;
$pid = $request->pid ?? null;
$kw = $request->kw ?? null;
$order = $request->order ?? 'time';
$sort = $request->sort ?? 'desc';
$page = $request->page ?? 1;
$limit = $request->limit ?? 10;
$data = [
'current_page' => $page,
'total' => 0,
'total_page' => 0,
'list' => []
];
//一级分类
$FirstCat = CategoryModel::select(['id', 'title'])->where('parent_id', 0)->get();
$data['firstCat'] = $FirstCat;
if (!$pid) {
$firstArr = $FirstCat->toArray();
$pid = $firstArr[0]['id'];
}
$model = GoodModel::select(['id', 'goods_name', 'cover_img', 'goods_brief'])
->where(['is_show' => 1]);
if ($cat_id) {
$model = $model->where(['cat_id' => $cat_id]);
}
if ($kw) {
$model = $model->where("goods_name", 'like', "%" . $kw . "%");
}
$order_by = '';
if ($order == 'time') {
$order_by = 'created_at';
} else {
$order_by = 'goods_price';
}
$data['total'] = $model->count();
$data['total_page'] = ceil($data['total'] / $limit);
//$listData = $model->paginate(10);
$listData = $model->offset(($page - 1) * $limit)->limit($limit)->orderBy($order_by, $sort)->get();
if ($listData->toArray()) {
foreach ($listData as $datum) {
$data['list'][] = [
'id' => $datum->id,
'goods_name' => $datum->goods_name,
'goods_price' => $datum->goods_price,
'goods_brief' => $datum->goods_brief,
'cover_img' => $datum->cover_img ? env('IMAGE_URL') . $datum->cover_img : '',
];
}
}
return $this->JsonResponse($data);
}
public function getList(Request $request)
{
$kw = $request->kw ?? null;
$order = $request->order ?? 'time';
$sort = $request->sort ?? 'desc';
$page = $request->page ?? 1;
$limit = $request->limit ?? 10;
$data = [
'current_page' => $page,
'total' => 0,
'total_page' => 0,
'list' => []
];
$model = GoodModel::select(['id', 'goods_name', 'cover_img', 'goods_brief', 'sku'])
->where(['is_show' => 1]);
if ($kw) {
$model = $model->where("goods_name", 'like', "%" . $kw . "%");
}
$order_by = '';
if ($order == 'time') {
$order_by = 'created_at';
} else {
$order_by = 'goods_price';
}
$data['total'] = $model->count();
$data['total_page'] = ceil($data['total'] / $limit);
$listData = $model->offset(($page - 1) * $limit)->limit($limit)
->orderBy("sort", "desc")
->orderBy($order_by, $sort)
->get();
if ($listData->toArray()) {
foreach ($listData as $item) {
$goodsObj = GoodModel::find($item->id);
$skufield = $item->sku ? json_decode($item->sku, true) : [];
$cg_price = $market_price = 0;
if (isset($skufield['sku'][0]['cg_price'])) {
$cg_price = $skufield['sku'][0]['cg_price'];
}
if (isset($skufield['sku'][0]['market_price'])) {
$market_price = $skufield['sku'][0]['market_price'];
}
$data['list'][] = [
'id' => $item->id,
'goods_name' => $item->goods_name,
'dg_price' => sprintf("%.2f", $cg_price),
'market_price' => sprintf("%.2f", $market_price),
'cover_img' => (isset($goodsObj->cover_img) ? env('IMAGE_URL') . $goodsObj->cover_img : ''),
];
}
}
return $this->JsonResponse($data);
}
//推荐商品
public function getIndexGoods(Request $request)
{
$kw = $request->kw ?? null;
$order = $request->order ?? 'time';
$sort = $request->sort ?? 'desc';
$page = $request->page ?? 1;
$limit = $request->limit ?? 10;
$data = [];
$model = GoodModel::select(['id', 'goods_name', 'is_hot', 'cover_img', 'goods_brief', 'sku'])
->where(['is_show' => 1]);
if ($kw) {
$model = $model->where("goods_name", 'like', "%" . $kw . "%");
}
$order_by = '';
if ($order == 'time') {
$order_by = 'created_at';
}
$total = $model->count();
$data = [
'total' => $total,
'total_page' => ceil($total / $limit),
'list' => []
];
$listData = $model->offset(($page - 1) * $limit)->limit($limit)
->orderBy("is_hot", "desc")
->orderBy("sort", "desc")
->orderBy($order_by, $sort)
//->orderBy("id", "desc")
->get();
if ($listData->toArray()) {
foreach ($listData as $datum) {
$skufield = $datum->sku ? json_decode($datum->sku, true) : [];
$dg_price = $market_price = 0;
if (isset($skufield['sku'][0]['cg_price'])) {
$dg_price = $skufield['sku'][0]['cg_price'];
}
if (isset($skufield['sku'][0]['market_price'])) {
$market_price = $skufield['sku'][0]['market_price'];
}
$data['list'][] = [
'id' => $datum->id,
'goods_name' => $datum->goods_name,
'is_hot' => $datum->is_hot,
'dg_price' => sprintf("%.2f", $dg_price),
'market_price' => sprintf("%.2f", $market_price),
'cover_img' => ($datum->cover_img) ? env('IMAGE_URL') . $datum->cover_img : '',
];
}
}
return $this->JsonResponse($data);
}
public function getDetail(Request $request)
{
$mer_id = $request->user() ? $request->user()->merchant_id : 0; //获取绑定的商户ID
$goods_id = $request->goods_id ?? null;
$goods = GoodModel::find($goods_id);
if (!$goods) {
return $this->JsonResponse('', '参数错误', 201);
}
$cover_arr = $goods->carousel ? json_decode($goods->carousel) : [];
$cover = [];
if (!empty($cover_arr)) {
foreach ($cover_arr as $item) {
$cover[] = env('IMAGE_URL') . $item;
}
}
$skufield = $goods->sku ? json_decode($goods->sku, true) : [];
$attrsKey = isset($skufield['attrs']) ? array_keys($skufield['attrs']) : [];
$attrsVal = isset($skufield['attrs']) ? array_values($skufield['attrs']) : [];
$skuOneData = isset($skufield['sku'][0]) ? $skufield['sku'][0] : [];
$attr_txt = '';
$tmp = $attr = [];
if (isset($skufield['attrs'])) {
foreach ($skufield['attrs'] as $kk => $val) {
$tmp['tname'] = $kk;
$tmp['selectedItem'] = 0;
$tmp['tval'] = $val;
array_push($attr, $tmp);
}
}
//规格默认选中 第一条值
foreach ($attrsVal as $item) {
$attr_txt .= $item[0] . ", ";
}
$market_price = isset($skuOneData['market_price']) ? sprintf("%.2f", $skuOneData['market_price']) : '';
$dg_price = isset($skuOneData['cg_price']) ? sprintf("%.2f", $skuOneData['cg_price']) : '';
$stock = isset($skuOneData['stock']) ? $skuOneData['stock'] : 0;
$data = [
'id' => $goods->id,
'goods_img' => $cover,
'dg_price' => $dg_price,
'market_price' => $market_price,
'stock' => $stock,
'goods_name' => $goods->goods_name,
'sale' => $goods->sale ?? 0,
'sku_items' => $skufield,
'attr' => $attr,
'attr_txt' => trim($attr_txt, ", "),
'is_collect' => 0,
//'goods_desc' => $goods->goods_desc ?? ''
];
return $this->JsonResponse($data);
}
public function getAttrKey(Request $request)
{
$goods_id = $request->goods_id ?? null;
$attr_name = $request->attr_name ?? null; //22寸,蓝色,
$goods = GoodModel::find($goods_id);
if (!$goods) {
return $this->JsonResponse('', '参数错误', 201);
}
$attr_sn = '';
if ($attr_name) {
$attrArr = explode(",", $attr_name);
utf8_array_asort($attrArr);
$attrStr = join("、", $attrArr);
$attr_sn = md5($attrStr);
}
if (!$attr_sn) {
return $this->JsonResponse('', '参数错误', 201);
}
$attrObj = GoodSku::where("attr_sn", $attr_sn)->first();
if (!$attrObj) {
return $this->JsonResponse('', '参数错误', 201);
}
$market_price = $attrObj->market_price ? $attrObj->market_price : 0;
$cg_price = $attrObj->cg_price ? $attrObj->cg_price : 0;
$stock = $attrObj->stock ? $attrObj->stock : 0;
$data = [
'market_price' => sprintf('%.2f', $market_price),
'dg_price' => sprintf('%.2f', $cg_price),
'stock' => $stock,
];
return $this->JsonResponse($data);
}
public function isCollect(Request $request)
{
$user_id = $request->user()->id;
$goods_id = $request->goods_id ?? null;
//收藏
$is_collect = 0;
$where = [
'goods_id' => $goods_id,
'uid' => $user_id,
'deleted_at' => null,
];
$is_collect = UserCollect::where($where)->count();
return $this->JsonResponse(['is_collect' => $is_collect]);
}
}
<?php
namespace App\Http\Controllers\Api;
use App\Command\Log;
use App\Models\Kefu as KefuModel;
use Illuminate\Http\Request;
class KefuController extends BaseController
{
public function getList()
{
$list = (new KefuModel())->select("id", "title", "contact", "is_type")
->limit(15)
->get();
return $this->JsonResponse($list);
}
}
<?php
namespace App\Http\Controllers\Api;
use App\Command\Log;
use App\Models\PersonalAccessToken;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
class LoginController extends BaseController
{
/**
* 检验数据的真实性,并且获取解密后的明文.
* @param $encryptedData string 加密的用户数据
* @param $iv string 与用户数据一同返回的初始向量
* @param $data string 解密后的原文
* * <li>-41001: encodingAesKey 非法</li>
* <li>-41003: aes 解密失败</li>
* <li>-41004: 解密后得到的buffer非法</li>
* <li>-41005: base64加密失败</li>
* <li>-41016: base64解密失败</li>
* @return int 成功0,失败返回对应的错误码
*/
private function decryptData($sessionKey, $encryptedData, $iv, &$data)
{
if (strlen($sessionKey) != 24) {
return '-41001';
}
$aesKey = base64_decode($sessionKey);
if (strlen($iv) != 24) {
return '-41002';
}
$aesIV = base64_decode($iv);
$aesCipher = base64_decode($encryptedData);
$result = openssl_decrypt($aesCipher, "AES-128-CBC", $aesKey, 1, $aesIV);
//var_dump($result);exit;
$dataObj = json_decode($result);
if ($dataObj == NULL) {
return '-41003';
}
// $appid = config('-wxsite.wx_xcx_appid');
// if( $dataObj->watermark->appid != $appid )
// {
// return '-41003';
// }
$data = $dataObj;
return '0';
}
public function getOpenid(Request $request)
{
$appid = env('WX_XCX_APPID');
$secret = env('WX_XCX_KEY');
$jsCode = $request->js_code ?? '';
$url = 'https://api.weixin.qq.com/sns/jscode2session?appid=' . $appid . '&secret=' . $secret . '&js_code=' . $jsCode . '&grant_type=authorization_code';
$wx_data = json_decode(file_get_contents($url), true);
if (isset($wx_data['errcode'])) {
Log::add('请求微信接口异常', $wx_data);
return $this->JsonResponse('', '请求微信接口异常', 201);
}
return $this->JsonResponse([
'session_key' => $wx_data['session_key'],
'openid' => $wx_data['openid']
]);
}
public function login(Request $request)
{
$code = $request->code ?? '';
$iv = $request->iv ?? '';
//$openId = $request->openid ?? '';
$encryptedData = $request->encryptedData ?? '';
$result = $this->codeToSession($code);
$openId = $result['openid'];
$session_key = $result['session_key'];
$res = $this->decryptData($session_key, $encryptedData, $iv, $data);
if ($res != 0) {
return $this->JsonResponse('', '参数异常', 201);
}
$user = User::where(['phone' => $data->phoneNumber])->first();
if (!$user) {
$user = new User();
$user->name = 'wx_' . uniqid();
$user->openid = $openId;
$user->phone = $data->phoneNumber;
$user->save();
}
if ($user->openid != $openId) {
$user->openid = $openId;
$user->save();
}
//生成token
$accessToken = 'Bearer ' . $user->createToken('Access-token')->plainTextToken;
Log::add('用户--' . $user->id . '登录', ['token' => $accessToken]);
return $this->JsonResponse([
'Authorization' => $accessToken,
]);
}
public function logout(Request $request)
{
$request->user()->tokens()->delete();
PersonalAccessToken::where(['tokenable_id' => $request->user()->id])->delete();
return $this->JsonResponse('');
}
private function codeToSession($code)
{
$appid = env('WX_XCX_APPID');
$secret = env('WX_XCX_KEY');
if (!$code) {
$this->error('无效参数Code');
}
$url = 'https://api.weixin.qq.com/sns/jscode2session?appid=' . $appid . '&secret=' . $secret . '&js_code=' . $code . '&grant_type=authorization_code';
$wx_data = json_decode(file_get_contents($url), true);
if (isset($wx_data['errcode'])) {
Log::add('请求微信接口异常', $wx_data);
return $this->JsonResponse('', '请求微信接口异常', 201);
}
return $wx_data;
}
public function testLogin()
{
$user = User::find(1);
$accessToken = 'Bearer ' . $user->createToken('Access-token')->plainTextToken;
return $this->JsonResponse(['Authorization' => $accessToken,]);
}
}
<?php
namespace App\Http\Controllers\Api;
use App\Admin\Repositories\OrderInfo;
use App\Command\Log;
use App\Models\UserRefund;
use App\Models\Pay;
use App\Models\UserAddress;
use App\Models\Store;
use App\Models\Good as GoodModel;
use App\Models\GoodSku;
use App\Models\OrderGoods;
use App\Models\OrderInfo as OrderInfoModel;
use App\Models\GoodsAttr as GoodsAttrModel;
use App\Models\UserApplyService as UserApplyServiceModel;
use App\Jobs\CancelOrder;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use League\CommonMark\Node\Query\OrExpr;
class OrderController extends BaseController
{
//立即购买-确认订单
public function CheckoutBuyOrder(Request $request)
{
$userObj = $request->user();
$merchant_id = $userObj->merchant_id ?? 0;
$goods_id = $request->goods_id;
$num = $request->num ?? 1;
$attr_name = $request->attr_name ?? '';
$goodsObj = GoodModel::find($goods_id);
if (!$goodsObj) {
return $this->JsonResponse('', '参数错误', 201);
}
$attr_val = '';
$goods_price = 0;
if ($attr_name) {
$attrArr = explode(",", $attr_name);
utf8_array_asort($attrArr);
$attrStr = join("、", $attrArr);
$attr_sn = md5($attrStr);
$arrObj = GoodSku::where('goods_id', $goods_id)->where('attr_sn', $attr_sn)->first();
$attr_val = $arrObj ? $arrObj->attr_val : '';
$attr_id = $arrObj ? $arrObj->id : 0;
$goods_price = ($arrObj && $merchant_id) ? $arrObj->cg_price : $arrObj->market_price;
}
$data = [];
$data['goods_id'] = $goods_id;
$data['goods_name'] = $goodsObj->goods_name;
$data['goods_img'] = $goodsObj->cover_img ? env('IMAGE_URL') . $goodsObj->cover_img : '';
$data['num'] = $num;
$data['attr_id'] = $attr_id;
$data['goods_price'] = $goods_price;
$data['attr_name'] = $attr_val;
return $this->JsonResponse($data);
}
//创建订单--立即购买
public function CreateBuyOrder(Request $request)
{
$orderObj = new OrderInfoModel();
$userObj = $request->user();
$user_id = $userObj->id;
$merchant_id = $userObj->merchant_id;
$goods_id = $request->goods_id;
$num = $request->num ?? 1;
$attr_id = $request->attr_id ?? 0;
$delivery_type = $request->delivery_type; // 收货方式 1:代收点 2:送货上门
$store_id = $request->store_id ?? 0; //代收点 门店ID
$address_id = $request->address_id ?? 0; //地址ID
$goodsObj = GoodModel::find($goods_id);
if (!$goodsObj) {
return $this->JsonResponse('', '参数错误', 201);
}
$userAddress = '';
if ($address_id) {
$userAddress = UserAddress::where("id", $address_id)->first();
}
$order_sn = $this->getOrderSn();
DB::beginTransaction();
try {
$total_price = 0;
$orderGoods = [];
//商品信息
$goodObj = GoodModel::find($goods_id);
$good_price = 0; //商品单价
//判断是否有规格
$attr_val = '';
if ($attr_id) {
$arrObj = GoodSku::where(['id' => $attr_id, 'goods_id' => $goods_id])->first();
if (!$arrObj) {
return $this->JsonResponse('', '参数错误', 201);
}
$attr_val = $arrObj ? $arrObj->attr_val : '';
$good_price = ($arrObj && $merchant_id) ? $arrObj->cg_price : $arrObj->market_price;
}
//商品总价
$total_price = ($good_price * $num);
$tmp = [];
$tmp['goods_id'] = $goods_id;
$tmp['goods_number'] = $num;
$tmp['goods_price'] = $good_price;
$tmp['goods_attr'] = $attr_val;
$tmp['attr_id'] = $attr_id;
$tmp['goods_name'] = $goodObj->goods_name;
$tmp['goods_img'] = $goodObj->cover_img;
array_push($orderGoods, $tmp);
//订单信息
$orderObj->order_sn = $order_sn;
$orderObj->user_id = $user_id;
$orderObj->address_id = $address_id;
$orderObj->address = $userAddress ? $userAddress->address : '';
$orderObj->consignee = $userAddress ? $userAddress->consignee : '';
$orderObj->mobile = $userAddress ? $userAddress->phone : $userObj->phone;
$orderObj->goods_amount = $total_price;
$orderObj->order_amount = $total_price;
$orderObj->goods_sn = $goodObj->goods_sn;
$orderObj->delivery_type = $delivery_type;
$orderObj->merchant_id = $merchant_id;
$orderObj->store_id = $store_id;
if ($orderObj->save()) {
$order_id = $orderObj->id;
foreach ($orderGoods as $key => $item) {
$orderGoods[$key]['order_id'] = $order_id;
}
DB::table("li_order_goods")->insert($orderGoods);
}
DB::commit();
//15分钟取消订单
//$this->dispatch(new CancelOrder($orderObj, 900));
return $this->JsonResponse(['order_id' => $orderObj->id]);
} catch (\Exception $exception) {
Log::add('创建预支付订单失败', $exception->getMessage());
DB::rollBack();
return $this->JsonResponse('', '创建预支付订单失败', 201);
}
}
//创建订单
public function CreateOrder(Request $request)
{
$orderObj = new OrderInfoModel();
$userObj = $request->user();
$user_id = $userObj->id;
$merchant_id = $userObj->merchant_id;
$catKey = $request->catKey ?? ''; //购物车KeyID拼接 5_1,6_2
$delivery_type = $request->delivery_type; // 收货方式 1:代收点 2:送货上门
$store_id = $request->store_id ?? 0; //代收点 门店ID
$address_id = $request->address_id ?? 0; //地址ID
if (!$catKey) {
return $this->JsonResponse('', '参数错误', 201);
}
$shoppingCart = $userObj->shopping_cart ? json_decode($userObj->shopping_cart, true) : [];
if (empty($shoppingCart)) {
return $this->JsonResponse('', '购物车无资源', 500);
}
$userAddress = '';
if ($address_id) {
$userAddress = UserAddress::where(['uid' => $user_id, 'id' => $address_id])->first();
if (!$userAddress) {
return $this->JsonResponse('', '请选择收货地址', 500);
}
}
$order_sn = $this->getOrderSn();
DB::beginTransaction();
try {
$total_price = 0;
$idsArr = explode(",", $catKey);
$orderGoods = [];
$goods_name = '';
foreach ($idsArr as $key) {
$cartRow = isset($shoppingCart[$key]) ? $shoppingCart[$key] : [];
if (!$cartRow) {
continue;
}
//商品信息
$goods_id = $cartRow['goods_id'];
$goodsObj = GoodModel::find($goods_id);
$goods_img = isset($goodsObj->cover_img) ? $goodsObj->cover_img : '';
$goods_name .= $goodsObj->goods_name . "、";
$tmp = [];
$tmp['goods_id'] = $goods_id;
$tmp['goods_number'] = $cartRow['num'];
$tmp['goods_price'] = $cartRow['goods_price'];
$tmp['goods_attr'] = $cartRow['attr_txt'];
$tmp['attr_id'] = $cartRow['attr_id'];
$tmp['goods_name'] = $goodsObj->goods_name;
$tmp['goods_img'] = $goods_img;
array_push($orderGoods, $tmp);
//总价
$total_price += ((float)$cartRow['goods_price'] * (int)$cartRow['num']);
//删除购物车商品
unset($shoppingCart[$key]);
}
if ($total_price == 0) {
return $this->JsonResponse('', '参数错误', 201);
}
$orderObj->order_sn = $order_sn;
$orderObj->user_id = $user_id;
$orderObj->address_id = $address_id;
$orderObj->address = $userAddress ? $userAddress->address : '';
$orderObj->consignee = $userAddress ? $userAddress->consignee : '';
$orderObj->mobile = $userAddress ? $userAddress->phone : $userObj->phone;
$orderObj->goods_amount = $total_price;
$orderObj->order_amount = $total_price;
//$orderObj->goods_sn = $goodObj->goods_sn;
$orderObj->delivery_type = $delivery_type;
$orderObj->merchant_id = $merchant_id;
$orderObj->store_id = $store_id;
if ($orderObj->save()) {
$order_id = $orderObj->id;
foreach ($orderGoods as $key => $item) {
$orderGoods[$key]['order_id'] = $order_id;
}
DB::table("li_order_goods")->insert($orderGoods);
} else {
return $this->JsonResponse('', '创建购物车订单失败', 201);
}
$userObj->shopping_cart = empty($shoppingCart) ? null : json_encode($shoppingCart, JSON_UNESCAPED_UNICODE);
$userObj->save();
DB::commit();
return $this->JsonResponse(['order_id' => $orderObj->id]);
} catch (\Exception $exception) {
Log::add('创建购物车订单失败', $exception->getMessage());
DB::rollBack();
return $this->JsonResponse('', '创建购物车订单失败', 201);
}
}
private function getOrderSn()
{
$order_sn = '';
$flag = 0;
do {
//'20231229875256';
$order_sn = date('Ymd') . mt_rand(1000, 9999) . substr(implode("", array_map('ord', str_split(substr(uniqid(), 7, 13), 1))), 0, 8);
$rowObj = OrderInfoModel::where('order_sn', $order_sn)->first();
$flag = $rowObj ? 1 : 0;
} while ($flag > 0);
return $order_sn;
}
// 已完成:用户点击确认收货或发货后3天,自动变更为已完成状态
// 售后:已完成状态下48小时内展示申请售后按钮,可申请售后,如超过48小时,则不展示申请售后按钮
public function orderList(Request $request)
{
$status = $request->order_status ?? -1;
$page = $request->page ?? 1;
$limit = $request->limit ?? 10;
$sql = OrderInfoModel::where(['user_id' => $request->user()->id, 'deleted_at' => null]);
if ($status >= 0) {
$sql = $sql->where(['order_status' => $status]);
}
$total = $sql->count();
$data = [
'total' => $total,
'total_page' => ceil($total / $limit),
'list' => []
];
$listData = $sql->offset(($page - 1) * $limit)->limit($limit)->orderBy('created_at', 'DESC')->get();
if ($listData->toArray()) {
foreach ($listData as $item) {
//订单商品
$order_goods = [];
$ogoods = OrderGoods::where(["order_id" => $item->id])->limit(1)->get();
foreach ($ogoods as $key => $valObj) {
$tmp = [];
$tmp['goods_id'] = $valObj->goods_id;
$tmp['goods_name'] = $valObj->goods_name;
$tmp['goods_number'] = $valObj->goods_number;
$tmp['goods_attr'] = $valObj->goods_attr;
$tmp['goods_price'] = $valObj->goods_price;
$tmp['goods_img'] = $valObj->goods_img ? env('IMAGE_URL') . $valObj->goods_img : '';
array_push($order_goods, $tmp);
}
$data['list'][] = [
'order_id' => $item->id,
'order_sn' => $item->order_sn,
'order_status' => $item->order_status,
'status_txt' => OrderInfoModel::STATUS_OPTIONS[$item->order_status],
//'is_apply' => $is_apply,
//'service_status' => $item->service_status,
'order_amount' => $item->order_amount,
'created_at' => date("Y-m-d H:i", strtotime($item->created_at)),
'order_goods' => $order_goods
];
}
}
return $this->JsonResponse($data);
}
public function canceOrder(Request $request)
{
$order_id = $request->order_id ?? null;
$model = OrderInfoModel::find($order_id);
if (!$model) {
return $this->JsonResponse('', '参数错误', 201);
}
if ($model->user_id != $request->user()->id) {
return $this->JsonResponse('', '非本人订单', 201);
}
if (!in_array($model->order_status, [0, 1])) {
return $this->JsonResponse('', '不满足取消条件' . $model->order_status, 500);
}
DB::beginTransaction();
try {
//代发货订单--退款
if ($model->order_status == 1 && $model->order_amount > 0) {
// $order_sn = $model->order_sn;
// $refundMoney = $model->order_amount;
// $refund_no = date("YmdHis"); //退单号
// $result = AliPay::refund($order_sn, $refundMoney, $refund_no);
}
$model->order_status = 7;
$model->save();
DB::commit();
} catch (\Exception $exception) {
DB::rollBack();
Log::add('取消订单失败', $exception->getMessage());
return $this->JsonResponse('', '取消订单失败', 201);
}
return $this->JsonResponse('');
}
public function delOrder(Request $request)
{
$order_id = $request->order_id ?? null;
$model = OrderInfoModel::find($order_id);
if (!$model) {
return $this->JsonResponse('', '参数错误', 201);
}
if ($model->user_id != $request->user()->id) {
return $this->JsonResponse('', '非本人订单', 201);
}
$model->delete();
return $this->JsonResponse('');
}
//确认收货(订单完成--可申请售后)
public function completeOrder(Request $request)
{
$order_id = $request->order_id ?? null;
if (!$order_id) {
return $this->JsonResponse('', '参数错误', 201);
}
$model = OrderInfoModel::find($order_id);
if ($model->user_id != $request->user()->id) {
return $this->JsonResponse('', '非本人订单', 201);
}
$model->shipping_status = 2;
$model->order_status = 2;
$model->received_at = date("Y-m-d H:i:s");
$model->save();
return $this->JsonResponse('');
}
//订单详情
public function OrderInfo(Request $request)
{
$order_id = $request->order_id ?? 0;
$orderObj = OrderInfoModel::find($order_id);
if (!$orderObj) {
return $this->JsonResponse('', '参数错误', 201);
}
$user_id = $request->user()->id;
if ($orderObj->user_id != $user_id) {
return $this->JsonResponse('', '非本人订单', 201);
}
//商品信息
$order_goods = [];
$ogoods = OrderGoods::where(["order_id" => $order_id])->get();
foreach ($ogoods as $key => $valObj) {
$tmp = [];
$tmp['goods_id'] = $valObj->goods_id;
$tmp['goods_name'] = $valObj->goods_name;
$tmp['goods_number'] = $valObj->goods_number;
$tmp['goods_attr'] = $valObj->goods_attr;
$tmp['goods_price'] = $valObj->goods_price;
$tmp['goods_img'] = $valObj->goods_img ? env('IMAGE_URL') . $valObj->goods_img : '';
array_push($order_goods, $tmp);
}
$delivery = [];
if ($orderObj->address_id) {
$addressObj = UserAddress::find($orderObj->address_id);
$delivery['contacts'] = $addressObj->consignee;
$delivery['phone'] = $addressObj->phone;
$delivery['area'] = $addressObj->area;
$delivery['lat'] = $addressObj->lat;
$delivery['lng'] = $addressObj->lng;
}
if ($orderObj->store_id) {
$sObj = Store::find($orderObj->store_id);
$lat_lng = $sObj->lat_lng; //121.47,31.23
$latlngArr = $lat_lng ? explode(",", $lat_lng) : [];
$delivery['contacts'] = $sObj->contacts;
$delivery['phone'] = $sObj->phone;
$delivery['address'] = $sObj->address;
$delivery['lat'] = isset($latlngArr[1]) ? $latlngArr[1] : '';
$delivery['lng'] = isset($latlngArr[0]) ? $latlngArr[0] : '';
}
$data = [
'id' => $orderObj->id,
'order_sn' => $orderObj->order_sn,
'user_id' => $orderObj->user_id,
'order_amount' => $orderObj->order_amount,
//'consignee' => $orderObj->consignee,
'mobile' => $orderObj->mobile,
'delivery' => $delivery,
'delivery_type' => $orderObj->delivery_type,
'delivery_typename' => ($orderObj->delivery_type == 1) ? '快递代收点' : '送货上门',
'created_at' => date("Y-m-d H:i:s", strtotime($orderObj->created_at)),
'order_goods' => $order_goods
];
return $this->JsonResponse($data);
}
//购物车确认订单
public function CheckoutCartOrder(Request $request)
{
$cartKey = $request->cartKey ?? ''; //商品ID拼接 5_1,6_1
if (!$cartKey) {
return $this->JsonResponse('', '参数错误', 201);
}
$gidArr = explode(",", $cartKey);
$user = $request->user();
$shoppingCart = $user->shopping_cart ? json_decode($user->shopping_cart, true) : [];
$data = [];
foreach ($shoppingCart as $kk => $item) {
$tmp = [];
if (!in_array($kk, $gidArr)) {
continue;
}
$goodsObj = GoodModel::find($item['goods_id']);
$tmp['catKey'] = $kk;
$tmp['goods_id'] = $item['goods_id'];
$tmp['goods_name'] = $goodsObj->goods_name;
$tmp['num'] = $item['num'];
$tmp['goods_price'] = sprintf('%.2f', $item['goods_price']);
$tmp['attr_name'] = $item['attr_txt'];
$tmp['goods_img'] = $goodsObj->cover_img ? env('IMAGE_URL') . $goodsObj->cover_img : '';
$tmp['attr_id'] = $item['attr_id'];
array_push($data, $tmp);
}
return $this->JsonResponse($data);
}
}
<?php
namespace App\Http\Controllers\Api;
use App\Command\Log;
use App\Models\Brand;
use App\Models\BrandLevel;
use App\Models\Category;
use App\Models\Manufacturer;
use App\Models\ManufacturerCommand;
use App\Models\User;
use App\Models\UserPermission;
use Illuminate\Http\Request;
class ProductController extends BaseController {
public function getOneLevelCategory(Request $request){
$slug = $request->slug ?? '';
if(!in_array($slug,['manufacturer','performance','marketPrice','sample','advantage'])){
return $this->JsonResponse('','参数错误2',201);
}
$list_data = Category::where(['parent_id'=>0])->select(['id','title'])->get();
$data = [];
$model = 'App\\Models\\'.ucfirst($slug);
if($list_data->toArray()){
foreach ($list_data as $datum){
if($model::where(['cate_1'=>$datum->id])->count() > 0){
$data[] = ['id'=>$datum->id,'title'=>$datum->title];
}
}
}
return $this->JsonResponse($data);
}
public function getSecondaryCategory(Request $request){
$parent_id = $request->parent_id ?? null;
if(!$parent_id){
return $this->JsonResponse('','参数错误',201);
}
$slug = $request->slug ?? '';
if(!in_array($slug,['manufacturer','performance','marketPrice','sample','advantage'])){
return $this->JsonResponse('','参数错误2',201);
}
$model = 'App\\Models\\'.ucfirst($slug);
$cate = Category::find($parent_id);
if(!$cate || $cate->parent_id != 0){
return $this->JsonResponse('','参数错误2',201);
}
$data = [];
//获取二级品类
$twoLevel = Category::where(['parent_id'=>$parent_id])->get();
if($twoLevel->toArray()){
foreach ($twoLevel as $two){
if($model::where(['cate_2'=>$two->id])->count() <= 0){
continue;
}
$twoData = [
'id' => $two->id,
'title' => $two->title,
'level'=>2,
'son'=>[]
];
$threeLevel = Category::where(['parent_id'=>$two->id])->get();
if($threeLevel->toArray()){
foreach ($threeLevel as $three){
if($model::where(['cate_3'=>$three->id])->count() <= 0){
continue;
}
$twoData['son'][] = [
'id' => $three->id,
'title' => $three->title,
'level'=>3,
];
}
}
$data[] = $twoData;
}
}
return $this->JsonResponse($data);
}
public function getFourLevelData(Request $request){
$three_id = $request->three_id ?? null;
$slug = $request->slug ?? '';
if(!in_array($slug,['manufacturer','performance','marketPrice','sample','advantage'])){
return $this->JsonResponse('','参数错误2',201);
}
$page = $request->page ?? 1;
$limit = $request->limit ?? 10;
$search_text = trim($request->search_text) ?? '';
$brand_level = $request->brand_level ?? null;
$brand_level = $brand_level ? json_decode($brand_level,true) : null;
$brand_id = $request->brand ?? null;
$brand_id = $brand_id ? json_decode($brand_id, true) : null;
$f_cate_ids = [];
//var_dump($three_id);exit();
if($three_id){
$f_cate_ids = json_decode($three_id,true);
// $f_cate = Category::whereIn('parent_id',$three_id)->select(['id'])->get();
// if($f_cate->toArray()){
// foreach ($f_cate as $item){
// $f_cate_ids[] = $item->id;
// }
// }
}
$f_cate_ids_2 = [];
$four_id = $request->four_id ?? null;
if($four_id){
$f_cate_ids_2 = json_decode($four_id,true);
// $f_cate = Category::whereIn('parent_id',$three_id)->select(['id'])->get();
// if($f_cate->toArray()){
// foreach ($f_cate as $item){
// $f_cate_ids[] = $item->id;
// }
// }
}
$model = 'App\\Models\\'.ucfirst($slug);
$data = [];
$sql = $model::where(['deleted_at'=>null]);
if (!empty($f_cate_ids)){
$sql = $sql->whereIn('cate_3',$f_cate_ids);
}
if (!empty($f_cate_ids_2)){
$sql = $sql->whereIn('cate_4',$f_cate_ids_2);
}
$specifications = $request->specifications ?? null;
if($specifications){
$sql= $sql->where('specifications','LIKE','%'.$specifications.'%');
}
if($search_text != ''){
switch ($slug){
case 'manufacturer':
$sql= $sql->where('main_products','LIKE','%'.$search_text.'%');
break;
case 'performance':
//$sql = $sql->orWhere('parameter','LIKE','%'.$search_text.'%')->orWhere('scene','LIKE','%'.$search_text.'%');
$sql2 = $model::where('parameter','LIKE','%'.$search_text.'%')->count();
$sql3 = $model::where('scene','LIKE','%'.$search_text.'%')->count();
if($sql2>0 && $sql3>0){
$sql = $sql->where('parameter','LIKE','%'.$search_text.'%')->where('scene','LIKE','%'.$search_text.'%');
}elseif($sql2>0 && $sql3 == 0){
$sql = $sql->where('parameter','LIKE','%'.$search_text.'%');
}elseif($sql2==0 && $sql3>0){
$sql = $sql->where('scene','LIKE','%'.$search_text.'%');
}elseif($sql2 == 0 && $sql3 == 0){
$sql = $sql->where('parameter','LIKE','%'.$search_text.'%')->where('scene','LIKE','%'.$search_text.'%');
}
//$sql = $sql->whereJsonContains('parameter',(string)$search_text);
break;
case 'marketPrice':
$sql = $sql->where('specifications','LIKE','%'.$search_text.'%');
break;
case 'sample':
$sql = $sql->where('project_name','LIKE','%'.$search_text.'%');
break;
case 'advantage':
$sql = $sql->where('characteristic','LIKE','%'.$search_text.'%');
}
}
if ($brand_level){
$sql = $sql->whereIn('brand_level',$brand_level);
}
if($brand_id > 0){
$sql = $sql->whereIn('brand_id',$brand_id);
}
$data['total'] = $sql->count();
$data['list'] = [];
$listData = $sql->offset(($page - 1) * $limit)->limit($limit)->orderBy('created_at','DESC')->get();
if($data['total']>0){
foreach ($listData as $datum){
$specifications = '';
$unit_price = '';
switch ($slug){
case 'performance':
$parameter = $datum->performance ?? null;
$specifications = $parameter ? json_decode($parameter,true)[0] : '';
break;
case 'marketPrice':
$specifications = $datum->specifications ?? '';
$unit_price = $datum->unit_price;
break;
case 'sample':
$specifications = $datum->specifications ?? '';
break;
default :
$specifications = '';
}
$img_arr = $datum->img_url ?? null;
$cover_arr = $img_arr ? json_decode($img_arr,true) : [];
$cover = $cover_arr[0] ?? '';
$data['list'][] = [
'id' => $datum->id,
'cover' => $cover,
'title' => Category::find($datum->cate_4)->title ?? '',
'specifications' => $specifications,
'unit_price'=>$unit_price
];
}
}
return $this->JsonResponse($data);
}
//获取模块单品详情
public function singleItemInfo(Request $request){
$id = $request->id ?? null;
$slug = $request->slug ?? '';
if(!$id || !in_array($slug,['manufacturer','performance','marketPrice','sample','advantage'])){
return $this->JsonResponse('','参数错误2',201);
}
$model = 'App\\Models\\'.ucfirst($slug);
$userPerminssion = $request->user()->permissions ? json_decode($request->user()->permissions, true) : [];
//获取当前模块所有字段
$parent_id = match ($slug) {
'manufacturer' => 1,
'performance' => 2,
'marketPrice' => 3,
'sample' => 4,
'advantage' => 5,
default => 0,
};
$fileds = UserPermission::where(['parent_id'=>$parent_id])->where('slug','!=','add')->get();
$select = [];
foreach ($fileds as $filed){
if(in_array($filed->id, $userPerminssion)){
$select[] = $filed->slug;
}
}
$data = [];
$ysData = $model::where(['id'=>$id])->first();
foreach ($ysData->toArray() as $key=>$datum){
if(in_array($key,$select)){
if(in_array($key, ['cate_1','cate_2','cate_3','cate_4'])){
$data[$key] = Category::find($datum)->title ?? '';
}elseif ($key == 'brand_level'){
$data[$key] = $ysData->brand_level_model->title ?? '';
}elseif ($key == 'brand_id'){
$data['brand'] = $ysData->brand->title ?? '';
}elseif ($key == 'img_url'){
$data['img'] = empty($datum) ? [] : json_decode($datum, true);
}elseif ($key == 'parameter'){
$data['parameter'] = empty($datum) ? [] : json_decode($datum, true);
}elseif($key == 'contacts'){
$val1 =str_replace(',',',',$datum);
$ct_ph = explode(',',$val1);
$data['contact'] = $ct_ph[0] ?? '';
$data['contact_phone'] = $ct_ph[1] ?? '';
}elseif($key == 'jwd'){
$val1 =str_replace(',',',',$datum);
$data['jwd'] = explode(',',$val1) ?? [];
}elseif($key == 'main_products'){
$val1 =str_replace(',',',',$datum);
$data['main_products'] = explode(',',$val1);
}else{
$data[$key] = $datum;
}
}else{
$data[$key] = '';
}
}
return $this->JsonResponse($data);
}
//获取厂家资源评论列表
public function getManufacturerCommand(Request $request){
$id = $request->id ?? 0;
$page = $request->page ?? 1;
$limit = $request->limit ?? 10;
$sql = ManufacturerCommand::where(['m_id'=>$id]);
$data = [];
$data['total'] = $sql->count();
if($page == 1){
$data['is_command'] = (bool)ManufacturerCommand::where(['m_id'=>$id,'user_id'=>$request->user()->id])->first();
}
$data['list'] = [];
$list = $sql->offset(($page - 1) * $limit)
->limit($limit)
->orderBy('created_at','DESC')->get();
if($data['total']>0){
foreach ($list as $item){
$c_user = User::find($item->user_id);
$img = $item->img_url ? json_decode($item->img_url,true) : [];
$data['list'][] = [
'command_id'=>$item->id,
'id'=>$item->m_id,
'user_id'=>$item->user_id,
'username'=>$c_user->name,
'avatar'=>$c_user->avatar,
'sjyhnl'=>$item->sjyhnl,
'ghsx'=>$item->ghsx,
'ghzl'=>$item->ghzl,
'dznl'=>$item->dznl,
'fwphd'=>$item->fwphd,
'pjyj'=>$item->pjyj,
'img'=>$img,
'created_at'=>date('Y-m-d H:i:s',strtotime($item->created_at))
];
}
}
return $this->JsonResponse($data);
}
//评论厂家资源
public function commandManufacturer(Request $request){
$id = $request->id ?? null;
if(!$id){
return $this->JsonResponse('','参数错误',201);
}
$command_id = $request->command_id ?? 0;
$user_id = $request->user()->id;
if($command_id ==0 && ManufacturerCommand::where(['m_id'=>$id,'user_id'=>$user_id])->first()){
return $this->JsonResponse('','当前用户已评论',201);
}
$model = ManufacturerCommand::find($command_id) ?? new ManufacturerCommand();
if($command_id > 0 && $model->user_id && $model->user_id != $user_id){
return $this->JsonResponse('','非本人评论',201);
}
$model->m_id = $id;
$model->user_id = $user_id;
$model->sjyhnl = min(($request->sjyhnl ?? 0), 5);
$model->ghsx = min(($request->ghsx ?? 0), 5);
$model->ghzl = min(($request->ghzl ?? 0), 5);
$model->dznl = min(($request->dznl ?? 0), 5);
$model->fwphd = min(($request->fwphd ?? 0), 5);
$model->pjyj = $request->pjyj ?? '';
$img_arr = [];
$model->img_url = json_encode($request->img_arr ?? []);
$model->save();
return $this->JsonResponse('');
}
//新增模块数据
public function addData(Request $request){
$slug = $request->slug ?? null;
if(!in_array($slug,['manufacturer','performance','marketPrice','sample','advantage'])){
return $this->JsonResponse('','参数错误',201);
}
$parent_id = match ($slug) {
'manufacturer' => 1,
'performance' => 2,
'marketPrice' => 3,
'sample' => 4,
'advantage' => 5,
default => 0,
};
$p_id = UserPermission::where(['slug'=>'add','parent_id'=>$parent_id])->first()->id ?? 0;
$user_pr = $request->user()->permissions ? json_decode($request->user()->permissions,true):[];
if(!in_array($p_id, $user_pr)){
return $this->JsonResponse('','无权限操作',201);
}
$cate_1_id = Category::getIdForNameAndParentId(($request->cate_1 ?? ''),0);
$cate_2_id = Category::getIdForNameAndParentId(($request->cate_2 ?? ''),$cate_1_id);
$cate_3_id = Category::getIdForNameAndParentId(($request->cate_3 ?? ''),$cate_2_id);
$cate_4_id = Category::getIdForNameAndParentId(($request->cate_4 ?? ''),$cate_3_id);
$brand_level = BrandLevel::firstOrCreate(['title'=>($request->brand_level ?? '')])->id;
$brand_id = Brand::firstOrCreate(['title'=>($request->brand ?? '')])->id;
$model = new ('App\\Models\\'.ucfirst($slug))();
$model->cate_1 = $cate_1_id;
$model->cate_2 = $cate_2_id;
$model->cate_3 = $cate_3_id;
$model->cate_4 = $cate_4_id;
$model->brand_level = $brand_level;
$model->brand_id = $brand_id;
$model->img_url = json_encode($request->img_arr ?? []);
switch ($slug){
case 'manufacturer':
$model->company = $request->company ?? '';
$model->company_cate = $request->company_cate ?? '';
$model->position = $request->position ?? '';
$model->jwd = $request->jwd ?? '';
$model->contacts =( $request->contact ?? '').','.($request->phone ?? '');
$model->main_products = $request->main_products ??'';
$model->scale = $request->scale ?? '';
$model->device = $request->device ?? '';
$model->capacity = $request->capacity ?? '';
$model->supply_cycle = $request->supply_cycle ?? 0;
$model->transport = $request->transport ?? 0;
$model->participate_in_zj = $request->participate_in_zj ?? '';
$model->participate_in = $request->participate_in ?? '';
$model->brand_link = $request->brand_link ??'';
break;
case 'performance':
$model->parameter = json_encode(($request->parameter ?? []), JSON_UNESCAPED_UNICODE);
$model->scene = $request->scene ?? '';
$model->installation_method = $request->installation_method ??'';
$model->standard = $request->standard ?? '';
break;
case 'marketPrice':
$model->company = $request->company ?? '';
$model->position = $request->position ?? '';
$model->jwd = $request->jwd ?? '';
$model->contacts =( $request->contact ?? '').','.($request->phone ?? '');
$model->specifications = $request->specifications ??'';
$model->metering = $request->metering ?? '';
$model->unit = $request->unit ?? '';
$model->unit_price = $request->unit_price ?? 0;
$model->pay_way = $request->pay_way ?? '';
$model->source = $request->source ?? '';
$model->quotation_time = $request->quotation_time??'';
break;
case 'sample':
$model->category = $request->category ?? '';
$model->project_name = $request->project_name ?? '';
$model->company = $request->company ?? '';
$model->contacts =( $request->contact ?? '').','.($request->phone ?? '');
$model->specifications = $request->specifications ??'';
$model->used_part = $request->used_part ?? '';
$model->sealed_sample = $request->sealed_sample ?? '';
break;
case 'advantage':
$model->characteristic = $request->characteristic ?? '';
$model->company = $request->company ?? '';
$model->goods = $request->goods ?? '';
$model->contacts =( $request->contact ?? '').','.($request->phone ?? '');
break;
}
if(!$model->save()){
return $this->JsonResponse('','新增失败',201);
}
return $this->JsonResponse('');
}
//获取品牌数据
public function getBrandData(){
return $this->JsonResponse([
'brand_level'=> BrandLevel::select(['id','title'])->get(),
'brand'=>Brand::select(['id','title'])->get()
]);
}
//主营产品获取三级品类id
public function zycpzid(Request $request){
$zycp = $request->zycp ?? null;
if (!$zycp){
return $this->JsonResponse('','参数错误',201);
}
$zycp = str_replace(',',',',$zycp);
$zycp_arr = explode(',',$zycp);
$data = [];
foreach ($zycp_arr as $item){
$ca = Category::where(['title'=>$item])->select(['id'])->get();
if($ca->toArray()){
foreach ($ca as $value){
$data[] = $value['id'];
}
}
}
if(empty($data)){
$data = [-1];
}
return $this->JsonResponse($data);
}
//公司名称转换公司资源库数据id
public function muToMid(Request $request){
$m_name = $request->m_name ?? '';
if(!$m_name){
return $this->JsonResponse('','参数错误',201);
}
$data = Manufacturer::where(['company'=>$m_name])->first()->id ?? null;
return $this->JsonResponse($data);
}
//品牌名称获取品牌id
public function brandNametoId(Request $request){
$brand_name = $request->brand_name ?? '';
return $this->JsonResponse(Brand::where(['title'=>$brand_name])->first()->id ?? null);
}
}
<?php
namespace App\Http\Controllers\Api;
use App\Command\Log;
use App\Models\Store;
use Illuminate\Http\Request;
class StoreController extends BaseController
{
public function getList()
{
$list = (new Store())->select("id", "title", "contact", "is_type")
->limit(15)
->get();
return $this->JsonResponse($list);
}
//代收点列表
public function getDeliveryList(Request $request)
{
$mid = $request->user()->merchant_id;
$lat1 = $request->lat ?? '';
$lng1 = $request->lng ?? '';
$list = Store::where(['merchant_id' => $mid])
->select(['id', 'title', 'lat_lng', 'address', 'contacts', 'phone'])->get();
foreach ($list as $key => $val) {
$atng = $val->lat_lng ? explode(',', $val->lat_lng) : [];
$lat2 = $atng[1];
$lng2 = $atng[0];
$list[$key]['distance'] = ($lat1 && $lat2) ? $this->haversineDistance($lat1, $lng1, $lat2, $lng2) : '';
}
return $this->JsonResponse($list);
}
//送货上门-距离判断
public function checkDistance(Request $request)
{
$mid = $request->user()->merchant_id;
$lat1 = $request->lat ?? '';
$lng1 = $request->lng ?? '';
$flag = false;
$list = Store::where(['merchant_id' => $mid])
->select(['id', 'title', 'lat_lng', 'distance'])->get();
foreach ($list as $key => $val) {
$atng = $val->lat_lng ? explode(',', $val->lat_lng) : [];
$lat2 = $atng[1];
$lng2 = $atng[0];
$res = ($lat1 && $lat2) ? $this->haversineDistance($lat1, $lng1, $lat2, $lng2) : '';
if ($res <= $val->distance) {
$flag = true;
}
}
return $this->JsonResponse(['flag' => $flag]);
}
function haversineDistance($lat1, $lng1, $lat2, $lng2)
{
// 地球半径(单位:千米)
$radius = 6371;
// 将角度转为弧度
$lat1 = deg2rad($lat1);
$lng1 = deg2rad($lng1);
$lat2 = deg2rad($lat2);
$lng2 = deg2rad($lng2);
// 计算经纬度差值
$latDiff = $lat2 - $lat1;
$lngDiff = $lng2 - $lng1;
// 计算Haversine公式中的参数
$a = pow(sin($latDiff / 2), 2) + cos($lat1) * cos($lat2) * pow(sin($lngDiff / 2), 2);
$c = 2 * atan2(sqrt($a), sqrt(1 - $a));
$distance = $radius * $c;
return floor($distance);
}
}
<?php
namespace App\Http\Controllers\Api;
use App\Command\Log;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class SystemController extends BaseController
{
//远程开启、暂停登录
public function update(Request $request)
{
$status = $request->type ? (int)$request->type : 1;
$exist = DB::table('admin_status')->where("slug", 'login')->first();
if (!$exist) {
return $this->JsonResponse('', '配置信息不存在', 201);
}
$updated_at = date("Y-m-d H:i:s");
DB::table('admin_status')->where("slug", 'login')->update(['status' => $status, 'updated_at' => $updated_at]);
return $this->JsonResponse('');
}
}
<?php
namespace App\Http\Controllers\Api;
use App\Command\Log;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
use App\Models\SystemSetting as SystemSettingModel;
use Endroid\QrCode\Color\Color;
use Endroid\QrCode\Encoding\Encoding;
use Endroid\QrCode\ErrorCorrectionLevel\ErrorCorrectionLevelLow;
use Endroid\QrCode\QrCode;
use Endroid\QrCode\Label\Label;
use Endroid\QrCode\Logo\Logo;
use Endroid\QrCode\RoundBlockSizeMode\RoundBlockSizeModeMargin;
use Endroid\QrCode\Writer\PngWriter;
class SystemSettingController extends BaseController
{
public function verificationGrCode(Request $request)
{
$user_id = $request->user()->id;
$code = $request->code;
$writer = new PngWriter();
//$str = "#小程序://留日指南/AYpQ1H8PIFNvUaC";
$qrCode = QrCode::create($code)
->setEncoding(new Encoding('UTF-8'))
->setErrorCorrectionLevel(new ErrorCorrectionLevelLow())
->setSize(300)
->setMargin(10)
->setRoundBlockSizeMode(new RoundBlockSizeModeMargin())
->setForegroundColor(new Color(0, 0, 0))
->setBackgroundColor(new Color(255, 255, 255));
$result = $writer->write($qrCode);
$dataUri = $result->getDataUri();
// 指定保存路径
$folder_name = "/qrcode/" . date("Ymd", time());
$filename = "verifi_code_" . $user_id . ".png";
$savePath = public_path() . "/uploads" . $folder_name . "/";
if (!file_exists($savePath)) {
mkdir($savePath, 0755, true);
}
$result->saveToFile($savePath . $filename);
$filepath = env('IMAGE_URL') . $folder_name . "/" . $filename;
//$qrCode->writeFile($savePath);
return $this->JsonResponse(['qrcode' => $dataUri, 'filepath' => $filepath]);
// 返回二维码图片的Base64编码
//return response()->json(['status' => 'success', 'qrcode' => 'data:image/png;base64,' . base64_encode($qrCode)]);
}
public function qrCode(Request $request)
{
$user_id = $request->user()->id;
$writer = new PngWriter();
$spurl = env("API_URL") . "/share?spuid=" . $user_id;
//$str = "#小程序://留日指南/AYpQ1H8PIFNvUaC";
$qrCode = QrCode::create($spurl)
->setEncoding(new Encoding('UTF-8'))
->setErrorCorrectionLevel(new ErrorCorrectionLevelLow())
->setSize(300)
->setMargin(10)
->setRoundBlockSizeMode(new RoundBlockSizeModeMargin())
->setForegroundColor(new Color(0, 0, 0))
->setBackgroundColor(new Color(255, 255, 255));
$result = $writer->write($qrCode);
$dataUri = $result->getDataUri();
// 指定保存路径
$folder_name = "/qrcode/" . date("Ymd", time());
$filename = "qrcode_" . $user_id . ".png";
$savePath = public_path() . "/uploads" . $folder_name . "/";
if (!file_exists($savePath)) {
mkdir($savePath, 0755, true);
}
$result->saveToFile($savePath . $filename);
$filepath = env('IMAGE_URL') . $folder_name . "/" . $filename;
//$qrCode->writeFile($savePath);
return $this->JsonResponse(['qrcode' => $dataUri, 'filepath' => $filepath]);
// 返回二维码图片的Base64编码
//return response()->json(['status' => 'success', 'qrcode' => 'data:image/png;base64,' . base64_encode($qrCode)]);
}
public function hotKeywords(Request $request)
{
$articleObj = SystemSettingModel::find(1);
if (!$articleObj) {
return $this->JsonResponse('', '参数错误', 201);
}
$keysArr = [];
$keywords = $articleObj->hot_kw;
if ($keywords) {
$keysArr = explode("|", $keywords);
}
shuffle($keysArr);
$result = $keysArr ? array_slice($keysArr, 0, 8) : [];
return $this->JsonResponse($result);
}
public function getBj(Request $request)
{
$articleObj = SystemSettingModel::find(1);
if (!$articleObj) {
return $this->JsonResponse('', '参数错误', 201);
}
$bj = ($articleObj->bj_invite ? env('IMAGE_URL') . $articleObj->bj_invite : "");
return $this->JsonResponse(['bj' => $bj]);
}
}
<?php
namespace App\Http\Controllers\Api;
use App\Command\Log;
use App\Models\UserCollect;
use App\Models\Good as GoodModel;
use App\Models\GoodSku;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class UserCollectController extends BaseController
{
public function collectOpt(Request $request)
{
$gid = $request->goods_id ?? 0;
$userid = $request->user()->id;
if (!GoodModel::find($gid)) {
return $this->JsonResponse('', '参数错误', 201);
}
DB::beginTransaction();
try {
$userAppreciate = UserCollect::where(['goods_id' => $gid, 'uid' => $userid])->first();
if ($userAppreciate) {
$userAppreciate->delete();
} else {
$userAppreciate = UserCollect::withTrashed()->where(['goods_id' => $gid, 'uid' => $userid])->first();
if ($userAppreciate) {
$userAppreciate->deleted_at = null;
$userAppreciate->save();
} else {
$model = new UserCollect();
$model->goods_id = $gid;
$model->uid = $userid;
$model->save();
}
}
DB::commit();
} catch (\Exception $e) {
Log::add('用户收藏失败', $e->getMessage());
DB::rollBack();
}
return $this->JsonResponse('');
}
public function collectList(Request $request)
{
$user_id = $request->user()->id;
$page = $request->page ?? 1;
$limit = $request->limit ?? 10;
$sql = UserCollect::where(['uid' => $user_id, 'deleted_at' => null]);
$data = [
'total' => $sql->count(),
'total_page' => ceil($sql->count() / $limit),
'list' => []
];
$listData = $sql->offset(($page - 1) * $limit)->limit($limit)->orderBy('created_at', 'DESC')->get();
if ($listData->toArray()) {
foreach ($listData as $datum) {
$goods_id = $datum->goods_id;
$goodObj = GoodModel::select(['goods_name', 'cover_img'])->find($goods_id);
$is_jd = (int)$goodObj->is_jd;
$attrRowObj = GoodSku::where("goods_id", $goods_id)->first();
$attrcon = $attrRowObj ? json_decode($attrRowObj->content, true) : [];
$jd_price = isset($attrcon['jd_price']) ? (float)$attrcon['jd_price'] : 0;
$market_price = isset($attrcon['market_price']) ? (float)$attrcon['market_price'] : 0;
$data['list'][] = [
'goods_id' => $goods_id,
'goods_name' => $goodObj->goods_name ?? '',
'attr' => $attrRowObj ? $attrRowObj->attr_val : '',
'goods_price' => $is_jd ? sprintf("%.2f", $jd_price) : sprintf("%.2f", $market_price),
'cover_img' => ($goodObj->cover_img ? env('IMAGE_URL') . $goodObj->cover_img : ''),
'addtime' => date('Y-m-d H:i:s', strtotime($datum->created_at))
];
}
}
return $this->JsonResponse($data);
}
}
<?php
namespace App\Http\Controllers\Api;
use App\Command\Log;
use App\Handlers\QqCos;
use App\Handlers\FileUploadHandler;
use App\Models\Carousel;
use App\Models\GoodSku;
use App\Models\Good;
use App\Models\Merchant;
use App\Models\User;
use App\Models\UserAddress;
use App\Models\UserPermission;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
class UserController extends BaseController
{
//加入购物车
public function addShoppingCart(Request $request)
{
$userObj = $request->user();
$merchant_id = $userObj->merchant_id;
$goods_id = $request->goods_id ?? 0;
$num = $request->num ?? 0;
$attr_name = $request->attr_name ? trim($request->attr_name) : '';
//商品信息
$goodsObj = Good::where("id", $goods_id)->first();
Log::add('添加购物车商品信息===' . $goods_id, []);
if (!$goodsObj) {
return $this->JsonResponse('', '该商品已下架', 500);
}
$goods_price = 0;
//处理规格
$attr_id = 0;
$attr_sn = $attr_txt = '';
if ($attr_name) {
$attrArr = explode(",", $attr_name);
utf8_array_asort($attrArr);
$attrStr = join("、", $attrArr);
$attr_sn = md5($attrStr);
$goodsAttrObj = GoodSku::where("goods_id", $goods_id)->where("attr_sn", $attr_sn)->first();
Log::add('添加购物车商品规格', $goodsAttrObj->toArray());
if (!$goodsAttrObj) {
return $this->JsonResponse('', '该规格参数有误,选择其它规格', 500);
}
$attr_id = $goodsAttrObj->id;
$attr_txt = $goodsAttrObj->attr_val;
$goods_price = $merchant_id ? $goodsAttrObj->cg_price : $goodsAttrObj->market_price;
}
$shoppingCart = isset($userObj->shopping_cart) ? json_decode($userObj->shopping_cart, true) : [];
$key = $goods_id . "_" . $attr_sn;
if (isset($shoppingCart[$key]) && $shoppingCart[$key]['attr_sn'] == $attr_sn) {
$count = $shoppingCart[$key]['num'] + $num;
$shoppingCart[$key] = [
'goods_id' => $goods_id,
'attr_id' => $attr_id,
'num' => $count,
'attr_sn' => $attr_sn,
'attr_txt' => $attr_txt,
'goods_price' => $goods_price,
];
} else {
$shoppingCart[$key] = [
'goods_id' => $goods_id,
'attr_id' => $attr_id,
'num' => $num,
'attr_sn' => $attr_sn,
'attr_txt' => $attr_txt,
'goods_price' => $goods_price,
];
}
//
$resultCart = empty($shoppingCart) ? null : json_encode($shoppingCart, JSON_UNESCAPED_UNICODE);
$userObj->shopping_cart = $resultCart;
$userObj->save();
return $this->JsonResponse('');
}
//购物车详情
public function showShoppingCart(Request $request)
{
$userObj = $request->user();
$shoppingCart = isset($userObj->shopping_cart) ? json_decode($userObj->shopping_cart, true) : [];
$data = [];
if ($shoppingCart) {
foreach ($shoppingCart as $key => $item) {
$tmp = [];
$goodsAttrObj = GoodSku::where("goods_id", $item['goods_id'])->where("attr_sn", $item['attr_sn'])->first();
$goodsObj = Good::where("id", $item['goods_id'])->first();
if (!$goodsAttrObj || !$goodsObj) {
unset($shoppingCart[$key]);
continue;
}
$tmp['catKey'] = $item['goods_id'] . "_" . $item['attr_sn'];
$tmp['goods_id'] = $item['goods_id'];
$tmp['goods_name'] = $goodsObj->goods_name;
$tmp['cover_img'] = isset($goodsObj->cover_img) ? env('IMAGE_URL') . $goodsObj->cover_img : '';
$tmp['num'] = $item['num'];
$tmp['attr_sn'] = $item['attr_sn'];
$tmp['goods_price'] = $item['goods_price'];
$tmp['attr_name'] = $item['attr_txt'];
array_push($data, $tmp);
}
$userObj->shopping_cart = empty($shoppingCart) ? null : json_encode($shoppingCart, JSON_UNESCAPED_UNICODE);
$userObj->save();
}
return $this->JsonResponse($data);
}
//删减减购物车商品
public function reduceShoppingCart(Request $request)
{
$cartKey = $request->cartKey ?? '';
$user = $request->user();
$shoppingCart = isset($user->shopping_cart) ? json_decode($user->shopping_cart, true) : [];
if (empty($shoppingCart)) {
return $this->JsonResponse('', '购物车无资源', 500);
}
if ($cartKey) {
if (isset($shoppingCart[$cartKey])) unset($shoppingCart[$cartKey]);
}
$user->shopping_cart = empty($shoppingCart) ? null : json_encode($shoppingCart, JSON_UNESCAPED_UNICODE);
$user->save();
return $this->JsonResponse('');
}
public function info(Request $request)
{
$user = $request->user();
return $this->JsonResponse([
'user_id' => $user->id,
'nickname' => $user->name,
'avatar' => $user->avatar ? env('IMAGE_URL') . $user->avatar : '',
'phone' => $user->phone,
'phone_sec' => $user->phone ? substr($user->phone, 0, 3) . "****" . substr($user->phone, 7) : '',
//'status' => $user->status,
'merchant_id' => $user->merchant_id,
'role' => 1
]);
}
public function home(Request $request)
{
$carousel = Carousel::where(['status' => 1])->select(['imgUrl', 'linkUrl', 'descr'])->get();
$user_per = $request->user()->permissions ? json_decode($request->user()->permissions, true) : [];
$permission_ids = array_intersect([1, 2, 3, 4, 5], $user_per);
$permission = [];
if (!empty($permission_ids)) {
foreach ([1, 2, 3, 4, 5] as $item) {
if (in_array($item, $user_per)) {
} else {
$permission[] = [
'name' => '',
'slug' => ''
];
}
}
// foreach ($permission_ids as $id){
// $u_p = UserPermission::find($id);
// $permission[] = [
// 'name' => $u_p->name,
// 'slug' => $u_p->slug
// ];
// }
}
return $this->JsonResponse(['carousel' => $carousel, 'permissions' => $permission]);
}
//图片统一上传接口
public function uploadImg(FileUploadHandler $fileUploadHandler, Request $request)
{
$imgFile = $request->img_file ?? null;
if (empty($imgFile)) {
return $this->JsonResponse('', '参数异常', 201);
}
$imgUrl = $fileUploadHandler->save($imgFile);
if (!$imgUrl) {
return $this->JsonResponse('', '上传失败', 201);
}
return $this->JsonResponse(['img_url' => $imgUrl]);
}
//更新用户
public function editUser(Request $request)
{
$name = $request->name ?? '';
$avatar = $request->avatar ?? null;
$company = $request->company ?? '';
$user = $request->user();
if ($name) {
$user->name = $name;
}
if ($avatar) {
if (is_file(public_path() . '/uploads' . $user->avatar)) {
unlink(public_path() . '/uploads' . $user->avatar);
}
$user->avatar = $avatar ? str_replace(env('IMAGE_URL'), '', $avatar) : '';
}
if ($company) {
$user->company = $company;
}
if ($name) {
$user->save();
}
return $this->JsonResponse([
'id' => $user->id,
'name' => $user->name,
'avatar' => ($user->avatar ? env('IMAGE_URL') . $user->avatar : '')
]);
}
//修改密码
public function updatePwd(Request $request)
{
$phone = $request->phone ?? '';
$captcha = $request->code ?? '';
$password = $request->pwd ?? '';
$event = $request->event ?? 'pwd';
if (!$phone || !$captcha) {
return $this->JsonResponse('', '账号或验证码不为空', 500);
}
if (!$this->checkcode($phone, $captcha, $event)) {
return $this->JsonResponse('', '验证码错误或已过期', 500);
}
$user = User::where('phone', $phone)->where('status', 1)->first();
if (!$user) {
return $this->JsonResponse('', '用户不存在或已被禁用', 500);
}
if (strlen($password) < 6) {
return $this->JsonResponse('', '密码长度不低于6个字符', 500);
}
$user->password = Hash::make($password);
$res = $user->save();
if ($res) {
// 删除验证码
$this->flush($phone, 'login');
}
return $this->JsonResponse('');
}
//上传文件
public function uploadFile(FileUploadHandler $fileUploadHandler, Request $request)
{
$file = $request->file_obj ?? null;
$file_path = '';
if ($file) {
$file_path = Env('IMAGE_URL') . $fileUploadHandler->save($file);
}
return $this->JsonResponse($file_path);
}
//获取收货地址列表
public function getUserAddress(Request $request)
{
$list = UserAddress::where(['uid' => $request->user()->id, 'deleted_at' => null])->limit(10)->get();
foreach ($list as $key => $item) {
$list[$key]['area'] = $item->province ? $item->province . " " . $item->city . " " . $item->district : "";
}
return $this->JsonResponse($list);
}
//设置收货地址
public function setUserAddress(Request $request)
{
$address_id = $request->address_id ?? 0;
$consignee = $request->consignee ?? '';
$phone = $request->phone ?? '';
$area = $request->area ?? '';
$address = $request->address ?? '';
$is_default = $request->is_default ?? 0;
$model = UserAddress::find($address_id);
if (!$model) {
$model = new UserAddress();
} elseif ($model->uid != $request->user()->id) {
return $this->JsonResponse('', '参数错误', 201);
}
$model->uid = $request->user()->id;
$count = UserAddress::where('uid', $model->uid)->get()->count();
if ($count > 10) {
return $this->JsonResponse('', '收货地址总数在10条以内', 500);
}
if ($consignee) $model->consignee = $consignee;
if ($phone) $model->phone = $phone;
if ($area) $model->area = $area;
if ($address) $model->address = $address;
if ($is_default !== null) {
$model->is_default = $is_default;
if ($is_default == 1) {
UserAddress::where(['uid' => $request->user()->id])->update(['is_default' => 0]);
}
}
if (!$model->save()) {
return $this->JsonResponse('', '设置收货地址失败', 201);
}
return $this->JsonResponse('');
}
//删除收货地址
public function delUserAddress(Request $request)
{
$address_id = $request->address_id ?? null;
if (!$address_id) {
return $this->JsonResponse('', '参数错误', 201);
}
$address_ids = explode(',', $address_id);
UserAddress::where(['uid' => $request->user()->id])->whereIn('id', $address_ids)->delete();
return $this->JsonResponse('');
}
//用户分享
public function share(Request $request)
{
$shuid = $request->spuid ?? 0;
$exist = User::find($shuid);
if (!$exist) {
return $this->JsonResponse('', '参数错误', 201);
}
$userObj = $request->user();
$user_id = $userObj->id;
$spuid = $userObj->spuid; //是否已有推荐人
if (!$spuid && $user_id != $shuid) {
$userObj->spuid = $shuid;
$userObj->save();
}
return $this->JsonResponse('');
}
//我的邀请
public function getMyShare(Request $request)
{
$user_id = $request->user()->id;
$page = $request->page ?? 1;
$limit = $request->limit ?? 10;
$sql = User::where(['spuid' => $user_id, 'deleted_at' => null]);
$data = [
'total' => $sql->count(),
'total_page' => ceil($sql->count() / $limit),
'list' => []
];
$listData = $sql->offset(($page - 1) * $limit)->limit($limit)->orderBy('created_at', 'DESC')->get();
if ($listData->toArray()) {
foreach ($listData as $item) {
$data['list'][] = [
'name' => $item->name,
'avatar' => ($item->avatar ? env('IMAGE_URL') . $item->avatar : ''),
'addtime' => date('Y-m-d H:i:s', strtotime($item->created_at))
];
}
}
return $this->JsonResponse($data);
}
//绑定直购码
public function bindBuycode(Request $request)
{
$code = $request->code ?? '';
$merObj = Merchant::where("buycode", $code)->first();
if (!$merObj) {
return $this->JsonResponse('', '参数有误,没有该商户', 500);
}
DB::beginTransaction();
try {
$userObj = $request->user();
$userObj->buycode = $code;
$userObj->merchant_id = $merObj->id;
$userObj->save();
DB::commit();
} catch (\Exception $exception) {
Log::add('绑定直购码失败', $exception->getMessage());
DB::rollBack();
return $this->JsonResponse('', '绑定直购码失败', 201);
}
return $this->JsonResponse('');
}
}
<?php
namespace App\Http\Controllers;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
}
<?php
namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
* These middleware are run during every request to your application.
*
* @var array<int, class-string|string>
*/
protected $middleware = [
// \App\Http\Middleware\TrustHosts::class,
\App\Http\Middleware\TrustProxies::class,
\Illuminate\Http\Middleware\HandleCors::class,
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
];
/**
* The application's route middleware groups.
*
* @var array<string, array<int, class-string|string>>
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
'api' => [
\Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
'throttle:10000,1',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];
/**
* The application's route middleware.
*
* These middleware may be assigned to groups or used individually.
*
* @var array<string, class-string|string>
*/
protected $routeMiddleware = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'signed' => \App\Http\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
'acceptJson' => \App\Http\Middleware\AcceptJson::class,
];
}
<?php
namespace App\Http\Middleware;
use Closure;
class AcceptJson
{
/**
* Change the Request headers to "application/json" activating wantsJson()
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, Closure $next)
{
$request->headers->set('Accept', 'application/json');
return $next($request);
}
}
<?php
namespace App\Http\Middleware;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
class Authenticate extends Middleware
{
/**
* Get the path the user should be redirected to when they are not authenticated.
*
* @param \Illuminate\Http\Request $request
* @return string|null
*/
protected function redirectTo($request)
{
if (! $request->expectsJson()) {
return route('login');
}
}
}
<?php
namespace App\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
class EncryptCookies extends Middleware
{
/**
* The names of the cookies that should not be encrypted.
*
* @var array<int, string>
*/
protected $except = [
//
];
}
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
class PreventRequestsDuringMaintenance extends Middleware
{
/**
* The URIs that should be reachable while maintenance mode is enabled.
*
* @var array<int, string>
*/
protected $except = [
//
];
}
<?php
namespace App\Http\Middleware;
use App\Providers\RouteServiceProvider;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
* @param string|null ...$guards
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
*/
public function handle(Request $request, Closure $next, ...$guards)
{
$guards = empty($guards) ? [null] : $guards;
foreach ($guards as $guard) {
if (Auth::guard($guard)->check()) {
return redirect(RouteServiceProvider::HOME);
}
}
return $next($request);
}
}
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
class TrimStrings extends Middleware
{
/**
* The names of the attributes that should not be trimmed.
*
* @var array<int, string>
*/
protected $except = [
'current_password',
'password',
'password_confirmation',
];
}
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Middleware\TrustHosts as Middleware;
class TrustHosts extends Middleware
{
/**
* Get the host patterns that should be trusted.
*
* @return array<int, string|null>
*/
public function hosts()
{
return [
$this->allSubdomainsOfApplicationUrl(),
];
}
}
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Middleware\TrustProxies as Middleware;
use Illuminate\Http\Request;
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var array<int, string>|string|null
*/
protected $proxies;
/**
* The headers that should be used to detect proxies.
*
* @var int
*/
protected $headers =
Request::HEADER_X_FORWARDED_FOR |
Request::HEADER_X_FORWARDED_HOST |
Request::HEADER_X_FORWARDED_PORT |
Request::HEADER_X_FORWARDED_PROTO |
Request::HEADER_X_FORWARDED_AWS_ELB;
}
<?php
namespace App\Http\Middleware;
use Illuminate\Routing\Middleware\ValidateSignature as Middleware;
class ValidateSignature extends Middleware
{
/**
* The names of the query string parameters that should be ignored.
*
* @var array<int, string>
*/
protected $except = [
// 'fbclid',
// 'utm_campaign',
// 'utm_content',
// 'utm_medium',
// 'utm_source',
// 'utm_term',
];
}
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends Middleware
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array<int, string>
*/
protected $except = [
//
];
}
<?php
namespace App\Imports;
use App\Command\Log;
use App\Models\Brand;
use App\Models\Category;
use Illuminate\Http\Request;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
use Maatwebsite\Excel\Concerns\ToCollection;
use function Matrix\trace;
class ImportExcel implements ToCollection
{
private $className = null;
private $filename = null;
public function __construct($className, $filename)
{
$this->className = $className;
//文件存储后临时路径含文件名
$this->filename = $filename;
}
public function sheets(): array
{
// 只处理第一个sheet
return [
0 => $this,
];
}
/**
* @param Collection $collection
*/
public function collection(Collection $rows)
{
set_time_limit(0);
// 去掉表头
unset($rows[0]);
unset($rows[1]);
$data = $this->uploadImg($this->filename);
//Log::add('导入数据', $data);
DB::enableQueryLog();
$i = 0;
foreach ($data as $k => $item) {
if ($k == 0 || $k == 1) {
continue;
}
$i++;
$result = $this->className::CreateImportData($item);
if (!$result['goods_name']) {
continue;
}
$insert[] = $result;
$res = DB::table($this->className::getTableName())->insert($insert);
if ($res) {
$id = DB::getPdo()->lastInsertId();
$this->addGoodSku($result['sku'], $id);
}
}
// if (!empty($insert)) {
// DB::table($this->className::getTableName())->insert($insert);
// }
}
public function getExt($filename)
{
$arr = explode('.', $filename);
return array_pop($arr);
}
private function uploadImg($filepath)
{
$imageFilePath = public_path() . '/uploads/goods/' . date("Ymd") . "/";
if (!file_exists($imageFilePath)) {
mkdir("$imageFilePath", 0777, true);
chown("root", "www");
}
// 实例化阅读器对象。
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader("Xlsx");
// 将文件读取到到$spreadsheet对象中
//$filepath: storage\app/public/import/00c95d181f32fcbfca053e861cc13923.xlsx
$spreadsheet = $reader->load($filepath);
// 获取表中的第一个工作表,如果要获取第二个,把0改为1,依次类推
$worksheet = $spreadsheet->getSheet(0);
$objWorksheet = $spreadsheet->getActiveSheet(0); //getSheet(0)
$data = $objWorksheet->toArray();
foreach ($objWorksheet->getDrawingCollection() as $drawing) {
list($startColumn, $startRow) = \PhpOffice\PhpSpreadsheet\cell\Coordinate::coordinateFromString($drawing->getCoordinates());
$imageFileName = strtolower($drawing->getIndexedFilename()); //获取文件名称
$filename = $drawing->getPath();
$extension = strtolower($drawing->getExtension());
switch ($extension) {
case 'jpg':
case 'jpeg':
$source = imagecreatefromjpeg($drawing->getPath());
imagejpeg($source, $imageFilePath . $imageFileName);
break;
case 'gif':
$source = imagecreatefromgif($drawing->getPath());
imagegif($source, $imageFilePath . $imageFileName);
break;
case 'png':
$source = imagecreatefrompng($drawing->getPath());
imagepng($source, $imageFilePath . $imageFileName);
break;
}
//Log::add('文件列', $startColumn);
$startColumn = $this->ABC2decimal($startColumn);
if ($startColumn != 9) {
//continue;
}
$data[$startRow - 1][$startColumn][] = $imageFileName ? "/goods/" . date("Ymd") . "/" . $imageFileName : '';
}
return $data;
}
public function ABC2decimal($abc)
{
$ten = 0;
$len = strlen($abc);
for ($i = 1; $i <= $len; $i++) {
$char = substr($abc, 0 - $i, 1); //反向获取单个字符
$int = ord($char);
$ten += ($int - 65) * pow(26, $i - 1);
}
return $ten;
}
private function addGoodSku($skuStr, $goods_id)
{
$skuArr = json_decode($skuStr, true);
$attrs = isset($skuArr['attrs']) ? $skuArr['attrs'] : [];
$attrsKey = $attrs ? array_keys($attrs) : [];
$data = [];
$goods_price = 0;
//Log::add('规格数据', $skuArr);
if (isset($skuArr['sku'])) {
foreach ($skuArr['sku'] as $kk => $vv) {
$tmp = [];
$tmp['goods_id'] = $goods_id;
$attr_name = [];
if ($kk == 0) {
$price = isset($vv['price']) ? explode("、", $vv['price']) : [];
$goods_price = isset($price[0]) ? $price[0] : 0;
}
foreach ($attrsKey as $val) {
array_push($attr_name, $vv[$val]);
}
utf8_array_asort($attr_name);
$attr_sn = join("、", $attr_name);
$tmp['attr_val'] = $attr_sn;
$tmp['attr_sn'] = $attr_sn ? md5($attr_sn) : '';
$tmp['content'] = json_encode($vv, JSON_UNESCAPED_UNICODE);
array_push($data, $tmp);
//规格标识
$skuArr['sku'][$kk]['attr_sn'] = $tmp['attr_sn'];
}
$skuCon = json_encode($skuArr, JSON_UNESCAPED_UNICODE);
DB::table('li_goods_sku')->insert($data);
DB::table('li_goods')->where("id", $goods_id)->update(['goods_price' => $goods_price, 'sku' => $skuCon]);
}
}
}
<?php
namespace App\Jobs;
use App\Imports\ImportExcel;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Support\Facades\DB;
use Maatwebsite\Excel\Facades\Excel;
class ansyImportExcel implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
private string $className;
private string $file_path;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($className, $file_path)
{
$this->className = $className;
$this->file_path = $file_path;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$toolOrder = new ImportExcel($this->className, $this->file_path);
Excel::import($toolOrder, $this->file_path);
}
}
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;
class Advantage extends Model
{
use HasDateTimeFormatter;
use SoftDeletes;
protected $table = 'advantage';
protected $fillable = [
'cate_1','cate_2','cate_3','cate_4','characteristic ','brand_level','brand_id','company','goods','contacts'
];
public static function getTableName()
{
return with(new static)->getTable();
}
public function brand(){
return $this->belongsTo(Brand::class,'brand_id','id');
}
public function brand_level_model(){
return $this->belongsTo(BrandLevel::class,'brand_level','id');
}
public static function CreateImportData($item): array
{
$cate_1_id = Category::getIdForNameAndParentId(trim($item[1]),0);
$cate_2_id = Category::getIdForNameAndParentId(trim($item[2]),$cate_1_id);
$cate_3_id = Category::getIdForNameAndParentId(trim($item[3]),$cate_2_id);
$cate_4_id = Category::getIdForNameAndParentId(trim($item[4]),$cate_3_id);
$brand_level = BrandLevel::firstOrCreate(['title'=>trim($item[6])])->id;
$brand_id = Brand::firstOrCreate(['title'=>trim($item[7])])->id;
return [
'cate_1'=>$cate_1_id,
'cate_2'=>$cate_2_id,
'cate_3'=>$cate_3_id,
'cate_4'=>$cate_4_id,
'characteristic'=>trim($item[5]),
'brand_level'=>$brand_level,
'brand_id'=>$brand_id,
'company'=>trim($item[8]),
'goods'=>trim($item[9]),
'contacts'=>trim($item[10]),
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
];
}
}
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
class Article extends Model
{
use HasDateTimeFormatter;
protected $table = 'article';
public function cat()
{
return $this->belongsTo(category::class, 'cat_id');
}
}
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
class Carousel extends Model
{
use HasDateTimeFormatter;
protected $table = 'carousel';
public const SITE_OPTIONS = [
1 => '首页',
2 => '文章页',
3 => '商城页'
];
}
<?php
namespace App\Models;
use App\Models\NewModelTree;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
class Category extends Model
{
use NewModelTree;
use HasDateTimeFormatter;
protected $table = 'li_category';
public static function getIdByName($title)
{
$id = 0;
$row = self::where("title", $title)->first();
if ($row) {
$id = $row->id;
}
return $id;
}
}
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
class CheckNumber extends Model
{
use HasDateTimeFormatter;
protected $table = 'li_check_number';
}
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
class City extends Model
{
use HasDateTimeFormatter;
protected $table = 'city';
}
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
class Comment extends Model
{
use HasDateTimeFormatter;
protected $table = 'Comment';
public function goods()
{
return $this->belongsTo(Good::class, 'goods_id');
}
}
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
class CommentTpl extends Model
{
use HasDateTimeFormatter;
protected $table = 'comment_tpl';
}
<?php
namespace App\Models;
use App\Command\Log;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
class Good extends Model
{
use HasDateTimeFormatter;
protected $table = 'li_goods';
public static function getTableName()
{
return with(new static)->getTable();
}
public function category()
{
return $this->belongsTo(Category::class, 'cat_id');
}
public function gattr()
{
return $this->hasMany(GoodSku::class);
}
public static function CreateImportData($item): array
{
// [0] => 尼克诺拉鸡尾酒杯马天尼高脚古典酒杯日式调酒杯香槟
// [1] => 田园
// [2] => CT2701CRISON
// [3] => 红酒
// [4] => 12
// [5] => 京东自营
// [6] => jd.com
// [7] => Array
// (
// [0] => /goods/20240712/abc7927e8097e25fdae1553c2f582eac.png
// )
// [8] => Array
// (
// [0] => /goods/20240712/b9ae9264d848e8cfcaf9edf62b649b34.png
// )
// [9] => 张强
// [10] => 13856780987
// [11] => 颜色:白色、尺寸:22寸
// 颜色:蓝色、尺寸:22寸
// [12] => 0-199、200-500
// 0-199、200-500
// [13] => 800、780
// 860、790
// [14] => 880
// [15] => 900
// [16] => 920
// [17] => 1000
$result = $item;
$goods_name = $item[0];
$cat_id = Category::getIdByName($result[1]);
$product_no = $item[2];
$material = $item[3];
$box_size = $item[4];
$is_jd = ($item[5] == '京东自营') ? 1 : 0;
$jd_url = $item[6];
$cover_img = $item[7] ? $item[7][0] : null;
$carousel = $item[8] ? json_encode($item[8], JSON_UNESCAPED_UNICODE) : null;
$supplier = $item[9];
$su_phone = $item[10];
//规格处理
$attr_val = isset($item[11]) ? $item[11] : ''; //规格
$attrArr = $attr_val ? explode("\n", $attr_val) : [];
Log::add("规格", $attrArr);
$numb = isset($item[12]) ? $item[12] : ''; //数量
$numArr = $numb ? explode("\n", $numb) : [];
$price = isset($item[13]) ? $item[13] : ''; //折扣价
$priceArr = $price ? explode("\n", $price) : [];
$cg_price = isset($item[14]) ? $item[14] : 0; //采购价
$jd_price = isset($item[15]) ? $item[15] : 0; //京东价
$market_price = isset($item[16]) ? $item[16] : 0; //市场价
$stock = isset($item[16]) ? $item[16] : 0; //库存
$sku = null;
if ($attrArr) {
// 这里是给sku填数据, 数据格式为
$result = $attrs = [];
foreach ($attrArr as $key => $val) {
$rows = explode("、", $val);
foreach ($rows as $kk => $vv) {
$item = explode(":", $vv);
$itkey = trim($item[0]);
if (!isset($attrs[$itkey])) {
$attrs[$itkey][] = $item[1];
} else {
if (!in_array($item[1], $attrs[$itkey])) {
$attrs[$itkey][] = $item[1];
}
}
}
}
$result['attrs'] = $attrs;
//规格值
$skuArr = [];
foreach ($attrArr as $kk => $vv) {
$tmp = [
"numb" => isset($numArr[$kk]) ? $numArr[$kk] : '',
"price" => isset($priceArr[$kk]) ? $priceArr[$kk] : '',
"cg_price" => $cg_price,
"jd_price" => $jd_price,
"market_price" => $market_price,
"stock" => $stock
];
//$vv == 颜色:白色、尺寸:22寸
$ggarr = explode("、", $vv);
foreach ($ggarr as $gg) {
$arr = explode(":", $gg);
if ($arr[0]) {
$tmp[$arr[0]] = $arr[1];
}
}
array_push($skuArr, $tmp);
}
$result['sku'] = $skuArr;
$sku = json_encode($result, JSON_UNESCAPED_UNICODE);
}
$data = [
'goods_name' => $goods_name,
'cat_id' => $cat_id,
'product_no' => $product_no,
'material' => $material,
'box_size' => $box_size,
'is_jd' => $is_jd,
'jd_url' => $jd_url,
'supplier' => $supplier,
'su_phone' => $su_phone,
'cover_img' => $cover_img,
'carousel' => $carousel,
'sku' => $sku,
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s'),
];
return $data;
}
//获取指定天数订单量
public static function getNumDayData($dayNum)
{
$days = [date('Y-m-d')];
for ($i = 1; $i < $dayNum; $i++) {
$days[] = date("Y-m-d", strtotime("-$i day"));
}
$days = array_reverse($days);
$data = [
'total' => 0,
'list' => []
];
$where = [];
foreach ($days as $day) {
$startTime = $day . ' 00:00:00';
$endTime = $day . ' 23:59:59';
$count = self::whereBetween('created_at', [$startTime, $endTime])->where($where)->count();
$data['list'][$day] = $count;
$data['total'] += $count;
}
return $data;
}
//获取最近一年的订单量
public static function getYearData()
{
$y = date('Y');
$m = date('m');
for ($i = 1; $i <= $m; $i++) {
$days[] = $y . '-' . $i;
}
$data = [
'total' => 0,
'list' => []
];
$where = [];
foreach ($days as $day) {
$startTime = $day . '-01 00:00:00';
$m_max_day = date('t', strtotime($startTime));
$endTime = $day . '-' . $m_max_day . ' 23:59:59';
$count = self::whereBetween('created_at', [$startTime, $endTime])->where($where)->count();
$data['list'][$day] = $count;
$data['total'] += $count;
}
return $data;
}
}
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
class GoodSku extends Model
{
use HasDateTimeFormatter;
protected $table = 'li_goods_sku';
}
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;
class Income extends Model
{
use HasDateTimeFormatter;
use SoftDeletes;
protected $table = 'income';
public const USER_TYPE = [
1 => '会员',
2 => '商户',
];
public const STATUS = [
0 => '待审核',
1 => '审核通过',
2 => '拒绝提现'
];
}
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
class Kefu extends Model
{
use HasDateTimeFormatter;
protected $table = 'li_kefu';
}
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;
use App\Models\Store;
class Merchant extends Model
{
use HasDateTimeFormatter;
use SoftDeletes;
protected $table = 'merchant';
public function store_desc()
{
return $this->hasMany(Store::class, 'merchant_id');
}
}
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;
use App\Models\Store;
use App\Models\Merchant;
use App\Models\Good;
class MerchantGoodSku extends Model
{
use HasDateTimeFormatter;
use SoftDeletes;
protected $table = 'merchant_store_sku';
public function goods()
{
return $this->belongsTo(Good::class, 'goods_id');
}
public function merchant()
{
return $this->belongsTo(Merchant::class, 'merchant_id');
}
public function attr()
{
return $this->belongsTo(GoodSku::class, 'attr_id');
}
}
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;
use App\Models\Store;
use App\Models\Merchant;
use App\Models\Good;
class MerchantStore extends Model
{
use HasDateTimeFormatter;
use SoftDeletes;
protected $table = 'merchat_goods_store';
public function store_desc()
{
return $this->hasMany(Store::class, 'merchant_id');
}
public function goods()
{
return $this->belongsTo(Good::class, 'goods_id');
}
public function merchant()
{
return $this->belongsTo(Merchant::class, 'merchant_id');
}
}
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;
class MerchantStoreSkuLog extends Model
{
use HasDateTimeFormatter;
use SoftDeletes;
protected $table = 'merchant_store_sku_log';
public function goods()
{
return $this->belongsTo(Good::class, 'goods_id');
}
public function attr()
{
return $this->belongsTo(GoodSku::class, 'attr_id');
}
public function mergs()
{
return $this->belongsTo(MerchantStore::class, 'mgs_id');
}
}
<?php
// 表中存在软删除时,调用该模块,实现树行结构
namespace App\Models;
use Dcat\Admin\Traits\ModelTree;
trait NewModelTree
{
use ModelTree;
protected function buildSelectOptions(array $nodes = [], $parentId = 0, $prefix = '', $space = '&nbsp;', $cid = 0)
{
$d = '├─';
$prefix = $prefix ?: $d . $space;
$options = [];
if (empty($nodes)) {
if ($cid > 0) {
$where = ['deleted_at' => null, 'c_id' => $cid];
} else {
$where = ['deleted_at' => null];
}
$nodes = self::where($where)->orderBy('order', 'desc')->get()->toArray();
}
foreach ($nodes as $index => $node) {
if ($node[$this->getParentColumn()] == $parentId) {
$currentPrefix = $this->hasNextSibling($nodes, $node[$this->getParentColumn()], $index) ? $prefix : str_replace($d, '└─', $prefix);
$node[$this->getTitleColumn()] = $currentPrefix . $space . $node[$this->getTitleColumn()];
$childrenPrefix = str_replace($d, str_repeat($space, 6), $prefix) . $d . str_replace([$d, $space], '', $prefix);
$children = $this->buildSelectOptions($nodes, $node[$this->getKeyName()], $childrenPrefix);
$options[$node[$this->getKeyName()]] = $node[$this->getTitleColumn()];
if ($children) {
$options += $children;
}
}
}
return $options;
}
}
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;
class OrderGoods extends Model
{
use HasDateTimeFormatter;
//use SoftDeletes;
protected $table = 'li_order_goods';
}
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
class OrderInfo extends Model
{
use HasDateTimeFormatter;
use SoftDeletes;
protected $table = 'li_order_info';
public const STATUS_OPTIONS = [
0 => '待付款',
1 => '待到货',
2 => '待领取',
3 => '待评价',
4 => '已完成',
7 => '已取消',
8 => '已退款',
];
public function user()
{
return $this->belongsTo(User::class, 'user_id');
}
public function merchant()
{
return $this->belongsTo(Merchant::class, 'merchant_id');
}
//获取指定天数订单量
public static function getNumDayData($dayNum)
{
$days = [date('Y-m-d')];
for ($i = 1; $i < $dayNum; $i++) {
$days[] = date("Y-m-d", strtotime("-$i day"));
}
$days = array_reverse($days);
$data = [
'total' => 0,
'list' => []
];
$where = [];
foreach ($days as $day) {
$startTime = $day . ' 00:00:00';
$endTime = $day . ' 23:59:59';
$count = self::whereBetween('created_at', [$startTime, $endTime])->where($where)->count();
$data['list'][$day] = $count;
$data['total'] += $count;
}
return $data;
}
//获取最近一年的订单量
public static function getYearData()
{
$y = date('Y');
$m = date('m');
for ($i = 1; $i <= $m; $i++) {
$days[] = $y . '-' . $i;
}
$data = [
'total' => 0,
'list' => []
];
$where = [];
foreach ($days as $day) {
$startTime = $day . '-01 00:00:00';
$m_max_day = date('t', strtotime($startTime));
$endTime = $day . '-' . $m_max_day . ' 23:59:59';
$count = self::whereBetween('created_at', [$startTime, $endTime])->where($where)->count();
$data['list'][$day] = $count;
$data['total'] += $count;
}
return $data;
}
public static function CreateImportData($item): array
{
// [0] => 北海道香格里拉
// [1] => 江户川区
// [2] => 新左近川亲水公园
// [3] => 3室2厅2卫
// [4] => 21-100
// [5] => 121.23917
// [6] => 31.19145
// [7] => 精装修|有车位
// [8] => 8000-20000
// [9] => Array
// (
// [0] => /housing/20240305/d3f238df7cfe166d878b141e9562e1d0.png
// )
// [10] => 交通配套周边直
$result = $item;
// echo "<pre>";
// print_r($result);
// die;
$tags = $result[7];
if ($tags) {
$tagsArr = explode("|", $tags);
$tmp = [];
foreach ($tagsArr as $key => $val) {
//去除无标签
$exist = DB::table('tag')->where("title", $val)->first();
if ($exist) {
array_push($tmp, $val);
}
}
$tags = json_encode($tmp, JSON_UNESCAPED_UNICODE);
}
$imgs = '';
if ($item[9]) {
$imgs = json_encode($item[9], JSON_UNESCAPED_UNICODE);
}
$name = $result[0];
if ($result[0]) {
$exist = self::where("name", $result[0])->first();
$name = !$exist ? $name : '';
}
$data = [
'name' => $name,
//'area_id' => AreaModel::getIdByName($result[1]),
'position' => $result[2],
'layout_house' => $result[3],
'extent' => $result[4],
'lng' => $result[5],
'lat' => $result[6],
'tags' => $tags,
'rent' => $result[8],
'imgs' => $imgs,
'describe' => $result[10],
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s'),
];
return $data;
}
}
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
class PersonalAccessToken extends Model
{
use HasDateTimeFormatter;
protected $table = 'personal_access_tokens';
}
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
class Store extends Model
{
use HasDateTimeFormatter;
protected $table = 'store';
protected $fillable = ['title', 'merchant_id', 'lat_lng'];
}
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use App\Models\Merchant;
use App\Models\Store;
use Illuminate\Database\Eloquent\Model;
class StoreAdminUsers extends Model
{
use HasDateTimeFormatter;
protected $table = 'store_admin_users';
public function verifier()
{
//return $this->belongsTo(Verifier::class, 'store_admin_users_id');
}
public function merchant()
{
return $this->belongsTo(Merchant::class, 'merchant_id');
}
public function store()
{
return $this->belongsTo(Store::class, 'store_id');
}
}
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
class SystemSetting extends Model
{
use HasDateTimeFormatter;
protected $table = 'li_system_settings';
public $timestamps = false;
}
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
class User extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'email',
'password',
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
public const USER_ROLE = [
1 => '客户',
2 => '代理商',
];
public const USER_STATUS = [
0 => '审核中',
1 => '正常',
2 => '驳回'
];
//分享人信息
public function shuser()
{
return $this->belongsTo(User::class, 'spuid');
}
//获取指定天数注册数
public static function getNumDayData($dayNum)
{
$days = [date('Y-m-d')];
for ($i = 1; $i < $dayNum; $i++) {
$days[] = date("Y-m-d", strtotime("-$i day"));
}
$days = array_reverse($days);
$data = [
'total' => 0,
'list' => []
];
foreach ($days as $day) {
$startTime = $day . ' 00:00:00';
$endTime = $day . ' 23:59:59';
$count = self::whereBetween('created_at', [$startTime, $endTime])->count();
$data['list'][$day] = $count;
$data['total'] += $count;
}
return $data;
}
//获取最近一年的注册人数
public static function getYearData()
{
$y = date('Y');
$m = date('m');
for ($i = 1; $i <= $m; $i++) {
$days[] = $y . '-' . $i;
}
$data = [
'total' => 0,
'list' => []
];
foreach ($days as $day) {
$startTime = $day . '-01 00:00:00';
$m_max_day = date('t', strtotime($startTime));
$endTime = $day . '-' . $m_max_day . ' 23:59:59';
$count = self::whereBetween('created_at', [$startTime, $endTime])->count();
$data['list'][$day] = $count;
$data['total'] += $count;
}
return $data;
}
}
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;
class UserAddress extends Model
{
use HasDateTimeFormatter;
use SoftDeletes;
protected $table = 'user_address';
}
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
class UserBuycodeCheck extends Model
{
use HasDateTimeFormatter;
protected $table = 'user_buycode_check';
public function user()
{
return $this->belongsTo(User::class, 'uid');
}
}
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;
class UserCollect extends Model
{
use HasDateTimeFormatter;
use SoftDeletes;
protected $table = 'li_user_collect';
}
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
class Verifier extends Model
{
use HasDateTimeFormatter;
protected $table = 'verifier';
}
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//
Schema::defaultStringLength(191);
}
}
<?php
namespace App\Providers;
// use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
/**
* The model to policy mappings for the application.
*
* @var array<class-string, class-string>
*/
protected $policies = [
// 'App\Models\Model' => 'App\Policies\ModelPolicy',
];
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
$this->registerPolicies();
//
}
}
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Broadcast;
use Illuminate\Support\ServiceProvider;
class BroadcastServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Broadcast::routes();
require base_path('routes/channels.php');
}
}
<?php
namespace App\Providers;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Event;
class EventServiceProvider extends ServiceProvider
{
/**
* The event to listener mappings for the application.
*
* @var array<class-string, array<int, class-string>>
*/
protected $listen = [
Registered::class => [
SendEmailVerificationNotification::class,
],
];
/**
* Register any events for your application.
*
* @return void
*/
public function boot()
{
//
}
/**
* Determine if events and listeners should be automatically discovered.
*
* @return bool
*/
public function shouldDiscoverEvents()
{
return false;
}
}
<?php
namespace App\Providers;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider
{
/**
* The path to the "home" route for your application.
*
* Typically, users are redirected here after authentication.
*
* @var string
*/
public const HOME = '/home';
/**
* Define your route model bindings, pattern filters, and other route configuration.
*
* @return void
*/
public function boot()
{
$this->configureRateLimiting();
$this->routes(function () {
Route::domain(env('API_URL'))
->middleware('api')
->group(base_path('routes/api.php'));
Route::middleware('web')
->group(base_path('routes/web.php'));
});
}
/**
* Configure the rate limiters for the application.
*
* @return void
*/
protected function configureRateLimiting()
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
});
}
}
<?php
namespace App\Store\Actions\Grid;
use App\Store\Forms\IncomeApply as FormIncomeApply;
use Dcat\Admin\Grid\RowAction;
use Dcat\Admin\Traits\HasPermissions;
use Dcat\Admin\Widgets\Modal;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
class IncomeApply extends RowAction
{
/**
* @return string
*/
protected $title = '<button class="btn btn-custom disable-outline "> 申请提现 </button>';
public function render()
{
$form = FormIncomeApply::make();
return Modal::make()
->lg()
->title('申请提现')
->body($form)
->scrollable(true)
->button($this->title);
}
/**
* @return string|array|void
*/
public function confirm()
{
// return ['Confirm?', 'contents'];
}
/**
* @param Model|Authenticatable|HasPermissions|null $user
*
* @return bool
*/
protected function authorize($user): bool
{
return true;
}
/**
* @return array
*/
protected function parameters()
{
return [];
}
}
<?php
namespace App\Store\Actions\Grid;
use App\Store\Forms\RefundToExamine as FormRefundToExamine;
use Dcat\Admin\Grid\RowAction;
use Dcat\Admin\Traits\HasPermissions;
use Dcat\Admin\Widgets\Modal;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
class RefundToExamine extends RowAction
{
/**
* @return string
*/
protected $title = '<span>退款审核</span>';
public function render()
{
$form = FormRefundToExamine::make()->payload(['id' => $this->getKey()]);
return Modal::make()
->lg()
->title($this->title)
->body($form)
->scrollable(true)
->button($this->title);
}
/**
* @return string|array|void
*/
public function confirm()
{
// return ['Confirm?', 'contents'];
}
/**
* @param Model|Authenticatable|HasPermissions|null $user
*
* @return bool
*/
protected function authorize($user): bool
{
return true;
}
/**
* @return array
*/
protected function parameters()
{
return [];
}
}
<?php
namespace App\Store\Actions\Grid;
use App\Store\Forms\SendOutGoods as FormSendOutGoods;
use Dcat\Admin\Grid\RowAction;
use Dcat\Admin\Traits\HasPermissions;
use Dcat\Admin\Widgets\Modal;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
class SendOutGoods extends RowAction
{
/**
* @return string
*/
protected $title = '<span>订单发货</span>';
public function render()
{
$form = FormSendOutGoods::make()->payload(['id' => $this->getKey()]);
return Modal::make()
->lg()
->title($this->title)
->body($form)
->scrollable(true)
->button($this->title);
}
/**
* @return string|array|void
*/
public function confirm()
{
// return ['Confirm?', 'contents'];
}
/**
* @param Model|Authenticatable|HasPermissions|null $user
*
* @return bool
*/
protected function authorize($user): bool
{
return true;
}
/**
* @return array
*/
protected function parameters()
{
return [];
}
}
<?php
namespace App\Store\Controllers;
use Dcat\Admin\Http\Controllers\AuthController as BaseAuthController;
class AuthController extends BaseAuthController
{
protected $view = 'admin.login';
}
<?php
namespace App\Store\Controllers;
use App\Models\StoreInfo;
use App\Store\Metrics\Examples;
use App\Http\Controllers\Controller;
use Dcat\Admin\Admin;
use Dcat\Admin\Http\Controllers\Dashboard;
use Dcat\Admin\Layout\Column;
use Dcat\Admin\Layout\Content;
use Dcat\Admin\Layout\Row;
use Dcat\Admin\Widgets\Card;
class HomeController extends Controller
{
public function index(Content $content)
{
return $content
->header('主页')
->description('数据总览')
->body(function (Row $row) {
// $row->column(6, function (Column $column) {
// // $row->column(6, new Examples\NewUsers());
// // $row->column(6, new Examples\GoodsTotal());
// $column->row(new Examples\Revenue());
// });
$row->column(6, function (Column $column) {
$column->row(function (Row $row) {
$row->column(6, new Examples\ProductOrders());
$row->column(6, new Examples\StockTotal());
});
});
$row->column(6, function (Column $column) {
$column->row(function (Row $row) {
$row->column(6, new Examples\PickupTotal('已取货状态'));
$row->column(6, new Examples\PickupTotal('待取货状态'));
});
});
$row->column(6, function (Column $column) {
// $store = StoreInfo::where(['store_id'=>Admin::user()->id])->first();
// $total_revenue = $store->total_revenue > 1000 ? round(2,($store->total_revenue/1000)).' 千' : $store->total_revenue;
// $balance = $store->balance > 1000 ? round(2,($store->balance/1000)).' 千' : $store->balance;
// $freeze_balance = $store->freeze_balance > 1000 ? round(2,($store->freeze_balance/1000)).' 千' : $store->freeze_balance;
// $content = '<div style="height: 135px;display: flex;align-items: center;text-align: center;">
// <div style="flex: 1;display: flex;flex-direction: column;border-right: 1px solid #b9c3cd;">
// <h2 style="font-size: 25px;margin-top: 25px;">总收益</h2>
// <p style="color: orange;font-size: 45px;font-weight: bold;">'.$total_revenue.'</p>
// </div>
// <div style="flex: 1;display: flex;flex-direction: column;border-right: 1px solid #b9c3cd;">
// <h2 style="font-size: 25px;margin-top: 25px;">余额(可提现)</h2><p style="color:#21b978;font-size: 45px;font-weight: bold;">'.$balance.'</p>
// </div>
// <div style="flex: 1;display: flex;flex-direction: column;">
// <h2 style="font-size: 25px;margin-top: 25px;">冻结金额(提现中)</h2><p style="color: red;font-size: 45px;font-weight: bold;">'.$freeze_balance.'</p>
// </div></div>';
// $column->row(new Card('',$content));
});
$row->column(12, function (Column $column) {
//$column->row(new Examples\StoreOrderChats());
});
});
}
}
<?php
namespace App\Store\Controllers;
use App\Models\MerchantStore;
use App\Admin\Renderable\MerchantStoreSkuList;
use App\Models\Good;
use App\Models\StoreGoodsCategory;
use App\Models\StoreGoodsTag;
use Dcat\Admin\Admin;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class MerchatGoodsStoreController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(MerchantStore::with(['goods', 'merchant']), function (Grid $grid) {
$grid->addTableClass(['table-text-center']);
$grid->model()->where(['merchant_id' => Admin::user()->id])->orderBy('created_at', 'DESC');
$grid->column('id')->sortable();
$grid->column('goods_sn', '商品编号');
$grid->column('goods.cover_img', '商品图片')->image('', 100, 100);
$grid->column('goods.goods_name', '商品名称');
$grid->column('attr', '商品规格')->expand(function (Grid\Displayers\Expand $expand) {
$expand->button('查看');
return MerchantStoreSkuList::make(['mgs_id' => $this->id]);
})->width(100);
$grid->column('store', '库存');
$grid->setDialogFormDimensions('70%', '90%');
$grid->enableDialogCreate();
$grid->showQuickEditButton();
$grid->disableCreateButton();
$grid->disableEditButton();
$grid->disableViewButton();
$grid->disableActions();
// $grid->simplePaginate();
$grid->disableFilterButton();
$grid->quickSearch('goods.goods_name')->placeholder('搜索商品');
// $grid->filter(function (Grid\Filter $filter) {
// $filter->equal('id');
// });
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new StoreGood(), function (Show $show) {
$show->field('id');
$show->field('title');
$show->field('tags');
$show->field('price');
$show->field('sale_price');
$show->field('small_cover');
$show->field('cover');
$show->field('category_id');
$show->field('intro');
$show->field('look_num');
$show->field('inventory');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new StoreGood(), function (Form $form) {
if ($form->isCreating()) {
$form->hidden('store_id')->value(Admin::user()->id);
}
$form->text('title');
$form->multipleSelect('tags')
->options(StoreGoodsTag::where(['store_id' => Admin::user()->id])->get()->pluck('title', 'id'))
->saving(function ($value) {
return $value ? json_encode($value) : null;
});
$form->currency('price')->symbol('¥');
$form->currency('sale_price')->symbol('¥');
$form->image('small_cover')->accept('jpg,jpeg,png')
->maxSize(4096)
->url('upload/store')
->help('仅支持jpg、jpeg、png格式图片上传')
->autoUpload();
$form->image('cover')->accept('jpg,jpeg,png')
->maxSize(4096)
->url('upload/store')
->help('仅支持jpg、jpeg、png格式图片上传')
->autoUpload();
$form->select('category_id')
->options(StoreGoodsCategory::where(['store_id' => Admin::user()->id])->get()->pluck('title', 'id'))
->default(0)->required();
$form->editor('intro')->imageUrl('upload/store')
->height(400);
$form->number('inventory');
$form->disableDeleteButton();
$form->disableEditingCheck();
$form->disableViewButton();
$form->disableViewCheck();
$form->disableCreatingCheck();
});
}
}
<?php
namespace App\Store\Controllers;
use App\Models\UserAddress;
use App\Models\UserRefund;
use App\Store\Actions\Grid\RefundToExamine;
use App\Store\Actions\Grid\SendOutGoods;
use App\Models\StoreOrder;
use App\Models\OrderInfo;
use App\Models\City;
use App\Models\Store;
use App\Models\User;
use Dcat\Admin\Admin;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
use Dcat\Admin\Widgets\Card;
use App\Admin\Renderable\OrderGoodsList;
class OrderInfoController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new OrderInfo(), function (Grid $grid) {
$grid->addTableClass(['table-text-center']);
$grid->model()->where(['merchant_id' => Admin::user()->id])->orderBy('created_at', 'DESC');
$grid->column('id')->sortable();
$grid->column('order_sn', '订单号');
$grid->column('mobile', '手机号');
$grid->column('goods', '商品信息')->expand(function (Grid\Displayers\Expand $expand) {
$expand->button('查看');
return OrderGoodsList::make(['order_id' => $this->id]);
})->width(100);
$grid->column('goods_amount', '订单总金额');
$grid->column('merchant.name', '所属商家');
$grid->column('merchant.province_id', '所在省市')->display(function ($val) {
$proObj = City::where("city_id", $val)->first();
$cityObj = City::where("city_id", $this->merchant->city_id)->first();
$proname = $proObj->name ?? '';
$cityname = $cityObj->name ?? '';
return $proname . " " . $cityname;
});
$grid->column('store_id', '快递代收点')->display(function ($val) {
$res = null;
if ($val) {
$obj = Store::where('id', $val)->first();
$res = $obj->address;
}
return $res;
});
$grid->column('address_id', '送货上门')->display(function ($val) {
$res = '';
if ($val) {
$obj = UserAddress::where('id', $val)->first();
$res = $obj->area;
}
return $res;
});
$grid->column('created_at', '下单时间');
$grid->column('order_status', '订单状态')->display(function ($val) {
$options = OrderInfo::STATUS_OPTIONS;
return $options[$val];
});
$grid->column('verifier', '核销员');
$grid->column('verification_at', '核销时间');
$grid->simplePaginate();
$grid->disableActions();
$grid->disableCreateButton();
$grid->disableBatchActions();
// $grid->simplePaginate();
// $grid->disableFilterButton();
// $grid->quickSearch('store_goods.title')->placeholder('搜索商品');
$grid->filter(function (Grid\Filter $filter) {
// 更改为 panel 布局
$filter->panel();
$filter->equal('order_sn', '订单号')->width(3);
$filter->like('phone', '手机号')->width(3);
$filter->between('created_at', '创建时间')->datetime()->width(4);
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new StoreOrder(), function (Show $show) {
$show->field('id');
$show->field('order_id');
$show->field('goods_id');
$show->field('num');
$show->field('address_id');
$show->field('status');
$show->field('over_time');
$show->field('voucher');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new StoreOrder(), function (Form $form) {
$form->display('id');
$form->text('order_id');
$form->text('goods_id');
$form->text('num');
$form->text('address_id');
$form->text('status');
$form->text('over_time');
$form->text('voucher');
$form->display('created_at');
$form->display('updated_at');
});
}
}
<?php
namespace App\Store\Controllers;
use App\Models\Income;
use App\Store\Actions\Grid\IncomeApply;
use Dcat\Admin\Admin;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
use Dcat\Admin\Widgets\Card;
class StoreIncomeController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new Income(), function (Grid $grid) {
//$grid->tools(new IncomeApply());
$grid->addTableClass(['table-text-center']);
$grid->model()->where(['user_type' => 2, 'um_id' => Admin::user()->id])->orderBy('created_at', 'DESC');
$grid->column('id')->sortable();
$grid->column('amount', '金额');
$grid->column('status')->using(Income::STATUS)->dot([
0 => 'primary',
1 => 'success',
2 => 'danger'
]);
$grid->column('created_at', '提现时间');
$grid->disableDeleteButton();
$grid->disableViewButton();
$grid->disableCreateButton();
$grid->disableBatchActions();
$grid->disableActions();
$grid->disableRowSelector();
// $grid->selector(function (Grid\Tools\Selector $selector) {
// $selector->selectOne('status', '状态', Income::STATUS);
// });
// $grid->filter(function (Grid\Filter $filter) {
// $filter->equal('id');
// });
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new StoreIncome(), function (Show $show) {
$show->field('id');
$show->field('amout');
$show->field('invoice');
$show->field('feedback');
$show->field('status');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new StoreIncome(), function (Form $form) {
$form->currency('amount', '金额')->symbol('¥')->required();
$form->multipleImage('invoice', '发票信息')
->accept('jpg,jpeg,png')
->maxSize(2048)
->limit(9)
->url('upload/store-invoice')
->help('仅支持jpg、jpeg、png格式图片上传')
->autoUpload()
->saveAsJson();
});
}
}
<?php
namespace App\Store\Controllers;
use Dcat\Admin\Traits\HasUploadedFile;
use Intervention\Image\Facades\Image;
class UploadFileController{
use HasUploadedFile;
public function storeUpload()
{
$disk = $this->disk();
// 判断是否是删除文件请求
if ($this->isDeleteRequest()) {
// 删除文件并响应
return $this->deleteFileAndResponse();
}
// 获取上传的文件
$file = $this->file();
$img = Image::make($file->getRealPath())
->resize(640, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->encode('jpg', 90);
$dir = '/store';
$newName = md5(uniqid()) . '.jpg';
$path = "{$dir}/$newName";
$result = $disk->put($path, $img);
return $result
? $this->responseUploaded($path, $disk->url($path))
: $this->responseErrorMessage('文件上传失败');
}
public function storeInvoiceUpload()
{
$disk = $this->disk();
// 判断是否是删除文件请求
if ($this->isDeleteRequest()) {
// 删除文件并响应
return $this->deleteFileAndResponse();
}
// 获取上传的文件
$file = $this->file();
$img = Image::make($file->getRealPath())
->resize(640, null, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->encode('jpg', 90);
$dir = '/storeInvoice';
$newName = md5(uniqid()) . '.jpg';
$path = "{$dir}/$newName";
$result = $disk->put($path, $img);
return $result
? $this->responseUploaded($path, $disk->url($path))
: $this->responseErrorMessage('文件上传失败');
}
}
<?php
namespace App\Store\Forms;
use App\Command\Log;
use App\Models\StoreIncome;
use App\Models\StoreInfo;
use Dcat\Admin\Admin;
use Dcat\Admin\Widgets\Form;
use Dcat\Admin\Contracts\LazyRenderable;
use Dcat\Admin\Traits\LazyWidget;
use Illuminate\Support\Facades\DB;
class IncomeApply extends Form implements LazyRenderable
{
use LazyWidget;
/**
* Handle the form request.
*
* @param array $input
*
* @return mixed
*/
public function handle(array $input)
{
$store = StoreInfo::where(['store_id'=>Admin::user()->id]);
if($store->balance < $input['amount']){
return $this->response()->error('当前余额不足,提现申请失败')->refresh();
}
DB::beginTransaction();
try {
$model = new StoreIncome();
$model->store_id = Admin::user()->id;
$model->amount = $input['amount'];
$model->invoice = $input['invoice'] ??'';
$model->save();
$store->balance -= $input['amount'];
$store->freeze_balance += $input['amount'];
$store->save();
DB::commit();
Log::add('商城商户提现申请',$model->toArray());
}catch (\Exception $exception){
DB::rollBack();
Log::add('商城商户提现申请失败',$exception);
return $this->response()->error('提现申请失败')->refresh();
}
return $this->response()->success('提现申请成功')->refresh();
}
/**
* Build a form here.
*/
public function form()
{
$this->currency('amount','金额')->symbol('¥')->required();
$this->multipleImage('invoice','发票信息')
->accept('jpg,jpeg,png')
->maxSize(2048)
->limit(9)
->url('upload/store-invoice')
->help('仅支持jpg、jpeg、png格式图片上传')
->autoUpload()
->saveAsJson();
}
/**
* The data of the form.
*
* @return array
*/
public function default()
{
// 获取外部传递参数
return [];
}
}
<?php
namespace App\Store\Forms;
use App\Command\Log;
use App\Models\Pay;
use App\Models\PaymentRecord;
use App\Models\StoreGood;
use App\Models\StoreInfo;
use App\Models\StoreOrder;
use App\Models\UserRefund;
use Dcat\Admin\Widgets\Form;
use Dcat\Admin\Contracts\LazyRenderable;
use Dcat\Admin\Traits\LazyWidget;
use Illuminate\Support\Facades\DB;
class RefundToExamine extends Form implements LazyRenderable
{
use LazyWidget;
/**
* Handle the form request.
*
* @param array $input
*
* @return mixed
*/
public function handle(array $input)
{
$model = StoreOrder::find($this->payload['id']);
DB::beginTransaction();
try {
$userRefund = UserRefund::where([
'order_id'=>$model->order->id,
'son_order_id'=>$model->id
])->first();
if($input['refund_status']){
if($model->order->status == 2){
$store = StoreInfo::find($model->store_id);
$store->total_revenue -= $model->order->pay_money;
$store->balance -= $model->order->pay_money;
$store->save();
}
$wxOrderSn = PaymentRecord::where(['order_id'=>$model->order_id])->first()->other_order;
$r_sn = Pay::refund($wxOrderSn,$model->order->pay_money,$model->order->refund_amount);
$userRefund->refund_no = $r_sn;
$userRefund->status = 1;
$userRefund->save();
$model->status = 4;
$model->save();
$model->order->status = 8;
$model->order->save();
$goods = StoreGood::find($model->goods_id);
$goods->sale_num -= $model->num;
$goods->inventory += $model->num;
$goods->save();
Log::add('审批同意退款完成',$model->toArray());
DB::commit();
}else{
$userRefund->status = 2;
$userRefund->save();
$model->status = $userRefund->son_order_status;
$model->save();
}
DB::commit();
Log::add('退款审批',$model->toArray());
}catch (\Exception $exception){
DB::rollBack();
Log::add('退款审批失败',$exception);
return $this->response()->error('退款审批失败')->refresh();
}
return $this->response()->success('退款审批成功')->refresh();
}
/**
* Build a form here.
*/
public function form()
{
$this->radio('refund_status','退款审批')->options([true=>'同意退款',false=>'拒绝退款'])->required();
}
/**
* The data of the form.
*
* @return array
*/
public function default()
{
// 获取外部传递参数
return [];
}
}
<?php
namespace App\Store\Forms;
use App\Jobs\AutoCompleteOrder;
use App\Models\StoreOrder;
use App\Models\TotalOrder;
use Dcat\Admin\Widgets\Form;
use Dcat\Admin\Contracts\LazyRenderable;
use Dcat\Admin\Traits\LazyWidget;
class SendOutGoods extends Form implements LazyRenderable
{
use LazyWidget;
/**
* Handle the form request.
*
* @param array $input
*
* @return mixed
*/
public function handle(array $input)
{
$model = StoreOrder::find($this->payload['id']);
if($input['logistics']=='' || $input['logistics_code']=='' ){
return $this->response()->error('确认发货失败')->refresh();
}
$model->logistics = $input['logistics'] ??'';
$model->logistics_code = $input['logistics_code'] ??'';
$model->status = 1;
if (!$model->save()) {
return $this->response()->error('确认发货失败')->refresh();
}
$order = TotalOrder::find($model->order_id);
//开启自动完成订单
dispatch(new AutoCompleteOrder($order,(7*24*3600)));
return $this->response()->success('确认发货成功')->refresh();
}
/**
* Build a form here.
*/
public function form()
{
$this->text('logistics','物流名称')->required();
$this->text('logistics_code','物流单号')->required();
}
/**
* The data of the form.
*
* @return array
*/
public function default()
{
// 获取外部传递参数
return [];
}
}
<?php
namespace App\Store\Metrics\Examples;
use Dcat\Admin\Admin;
use Dcat\Admin\Widgets\Metrics\Donut;
class NewDevices extends Donut
{
protected $labels = ['Desktop', 'Mobile'];
/**
* 初始化卡片内容
*/
protected function init()
{
parent::init();
$color = Admin::color();
$colors = [$color->primary(), $color->alpha('blue2', 0.5)];
$this->title('New Devices');
$this->subTitle('Last 30 days');
$this->chartLabels($this->labels);
// 设置图表颜色
$this->chartColors($colors);
}
/**
* 渲染模板
*
* @return string
*/
public function render()
{
$this->fill();
return parent::render();
}
/**
* 写入数据.
*
* @return void
*/
public function fill()
{
$this->withContent(44.9, 28.6);
// 图表数据
$this->withChart([44.9, 28.6]);
}
/**
* 设置图表数据.
*
* @param array $data
*
* @return $this
*/
public function withChart(array $data)
{
return $this->chart([
'series' => $data
]);
}
/**
* 设置卡片头部内容.
*
* @param mixed $desktop
* @param mixed $mobile
*
* @return $this
*/
protected function withContent($desktop, $mobile)
{
$blue = Admin::color()->alpha('blue2', 0.5);
$style = 'margin-bottom: 8px';
$labelWidth = 120;
return $this->content(
<<<HTML
<div class="d-flex pl-1 pr-1 pt-1" style="{$style}">
<div style="width: {$labelWidth}px">
<i class="fa fa-circle text-primary"></i> {$this->labels[0]}
</div>
<div>{$desktop}</div>
</div>
<div class="d-flex pl-1 pr-1" style="{$style}">
<div style="width: {$labelWidth}px">
<i class="fa fa-circle" style="color: $blue"></i> {$this->labels[1]}
</div>
<div>{$mobile}</div>
</div>
HTML
);
}
}
<?php
namespace App\Store\Metrics\Examples;
use Dcat\Admin\Widgets\Metrics\Line;
use Illuminate\Http\Request;
class NewUsers extends Line
{
/**
* 初始化卡片内容
*
* @return void
*/
protected function init()
{
parent::init();
$this->title('New Users');
$this->dropdown([
'7' => 'Last 7 Days',
'28' => 'Last 28 Days',
'30' => 'Last Month',
'365' => 'Last Year',
]);
}
/**
* 处理请求
*
* @param Request $request
*
* @return mixed|void
*/
public function handle(Request $request)
{
$generator = function ($len, $min = 10, $max = 300) {
for ($i = 0; $i <= $len; $i++) {
yield mt_rand($min, $max);
}
};
switch ($request->get('option')) {
case '365':
// 卡片内容
$this->withContent(mt_rand(1000, 5000).'k');
// 图表数据
$this->withChart(collect($generator(30))->toArray());
break;
case '30':
// 卡片内容
$this->withContent(mt_rand(400, 1000).'k');
// 图表数据
$this->withChart(collect($generator(30))->toArray());
break;
case '28':
// 卡片内容
$this->withContent(mt_rand(400, 1000).'k');
// 图表数据
$this->withChart(collect($generator(28))->toArray());
break;
case '7':
default:
// 卡片内容
$this->withContent('89.2k');
// 图表数据
$this->withChart([28, 40, 36, 52, 38, 60, 55,]);
}
}
/**
* 设置图表数据.
*
* @param array $data
*
* @return $this
*/
public function withChart(array $data)
{
return $this->chart([
'series' => [
[
'name' => $this->title,
'data' => $data,
],
],
]);
}
/**
* 设置卡片内容.
*
* @param string $content
*
* @return $this
*/
public function withContent($content)
{
return $this->content(
<<<HTML
<div class="d-flex justify-content-between align-items-center mt-1" style="margin-bottom: 2px">
<h2 class="ml-1 font-lg-1">{$content}</h2>
<span class="mb-0 mr-1 text-80">{$this->title}</span>
</div>
HTML
);
}
}
<?php
namespace App\Store\Metrics\Examples;
use App\Models\OrderInfo as OrderInfoModel;
use Dcat\Admin\Widgets\Metrics\Card;
use Illuminate\Contracts\Support\Renderable;
use Illuminate\Http\Request;
class PickupTotal extends Card
{
/**
* 卡片底部内容.
*
* @var string|Renderable|\Closure
*/
protected $footer;
protected $title;
public function __construct($title = null, $icon = null)
{
parent::__construct();
$this->title = $title;
}
/**
* 初始化卡片.
*/
protected function init()
{
parent::init();
$this->title($this->title);
$this->dropdown([
'30' => '最近30天',
'60' => '最近60天',
'1' => '今天',
'7' => '最近7天',
'365' => '最近一年',
]);
}
/**
* 处理请求.
*
* @param Request $request
*
* @return void
*/
public function handle(Request $request)
{
switch ($request->get('option')) {
case '365':
$data = OrderInfoModel::getYearData();
// 卡片内容
$this->withContent($data['total']);
// 图表数据
//$this->withChart($data['list']);
break;
case '1':
$data = OrderInfoModel::getNumDayData(1);
// 卡片内容
$this->withContent($data['total']);
// 图表数据
//$this->withChart($data['list']);
break;
case '7':
$data = OrderInfoModel::getNumDayData(7);
// 卡片内容
$this->withContent($data['total']);
// 图表数据
//$this->withChart($data['list']);
break;
case '60':
$data = OrderInfoModel::getNumDayData(7);
// 卡片内容
$this->withContent($data['total']);
// 图表数据
//$this->withChart($data['list']);
break;
default:
$data = OrderInfoModel::getNumDayData(30);
// 卡片内容
$this->withContent($data['total']);
// 图表数据
//$this->withChart($data['list']);
}
}
/**
* 设置卡片底部内容.
*
* @param string|Renderable|\Closure $footer
*
* @return $this
*/
public function footer($footer)
{
$this->footer = $footer;
return $this;
}
/**
* 设置卡片内容.
*
* @param string $content
*
* @return $this
*/
public function withContent($content)
{
return $this->content(
<<<HTML
<div class="d-flex justify-content-between align-items-center mt-1" style="margin-bottom: 2px">
<h2 class="ml-1 font-lg-1">{$content}</h2>
</div>
HTML
);
}
}
<?php
namespace App\Store\Metrics\Examples;
use App\Models\OrderInfo as OrderInfoModel;
use Dcat\Admin\Widgets\Metrics\Card;
use Illuminate\Contracts\Support\Renderable;
use Illuminate\Http\Request;
class ProductOrders extends Card
{
/**
* 卡片底部内容.
*
* @var string|Renderable|\Closure
*/
protected $footer;
/**
* 初始化卡片.
*/
protected function init()
{
parent::init();
$this->title('用户已购买总数');
$this->dropdown([
'1' => '今天',
'7' => '最近7天',
'30' => '最近30天',
'365' => '最近一年',
]);
}
/**
* 处理请求.
*
* @param Request $request
*
* @return void
*/
public function handle(Request $request)
{
switch ($request->get('option')) {
case '365':
$data = OrderInfoModel::getYearData();
// 卡片内容
$this->withContent($data['total']);
// 图表数据
//$this->withChart($data['list']);
break;
case '30':
$data = OrderInfoModel::getNumDayData(30);
// 卡片内容
$this->withContent($data['total']);
// 图表数据
//$this->withChart($data['list']);
break;
case '7':
$data = OrderInfoModel::getNumDayData(7);
// 卡片内容
$this->withContent($data['total']);
// 图表数据
//$this->withChart($data['list']);
break;
default:
$data = OrderInfoModel::getNumDayData(1);
// 卡片内容
$this->withContent($data['total']);
// 图表数据
//$this->withChart($data['list']);
}
}
/**
* 设置卡片底部内容.
*
* @param string|Renderable|\Closure $footer
*
* @return $this
*/
public function footer($footer)
{
$this->footer = $footer;
return $this;
}
/**
* 设置卡片内容.
*
* @param string $content
*
* @return $this
*/
public function withContent($content)
{
return $this->content(
<<<HTML
<div class="d-flex justify-content-between align-items-center mt-1" style="margin-bottom: 2px">
<h2 class="ml-1 font-lg-1">{$content}</h2>
</div>
HTML
);
}
}
<?php
namespace App\Store\Metrics\Examples;
use App\Models\StoreOrder;
use Dcat\Admin\Widgets\Metrics\Line;
use Illuminate\Http\Request;
class Revenue extends Line
{
/**
* 初始化卡片内容
*
* @return void
*/
protected function init()
{
parent::init();
$this->title('收益');
$this->dropdown([
'7' => '最近7天',
'30' => '最近30天',
'365' => '最近一年',
]);
}
/**
* 处理请求
*
* @param Request $request
*
* @return mixed|void
*/
public function handle(Request $request)
{
switch ($request->get('option')) {
case '365':
$data = StoreOrder::getYearSale();
// 卡片内容
$total = $data['total'] > 1000 ? round(2,($data['total']/1000)).' 千' : $data['total'];
$this->withContent($total);
// 图表数据
$this->withChart($data['list']);
break;
case '30':
$data = StoreOrder::getNumDaySale(30);
// 卡片内容
$total = $data['total'] > 1000 ? round(2,($data['total']/1000)).' 千' : $data['total'];
$this->withContent($total);
// 图表数据
$this->withChart($data['list']);
break;
case '7':
default:
$data = StoreOrder::getNumDaySale(7);
// 卡片内容
$total = $data['total'] > 1000 ? round(2,($data['total']/1000)).' 千' : $data['total'];
$this->withContent($total);
// 图表数据
$this->withChart($data['list']);
}
}
/**
* 设置图表数据.
*
* @param array $data
*
* @return $this
*/
public function withChart(array $data)
{
$series_data = [];
foreach ($data as $v){
$series_data[] = $v;
}
return $this->chart([
'series' => [
[
'name' =>'收益',
'data' => $series_data,
],
],
]);
}
/**
* 设置卡片内容.
*
* @param string $content
*
* @return $this
*/
public function withContent($content)
{
return $this->content(
<<<HTML
<div class="d-flex justify-content-between align-items-center mt-1" style="margin-bottom: 2px">
<h2 class="ml-1 font-lg-1">{$content}</h2>
<span class="mb-0 mr-1 text-80">{$this->title}</span>
</div>
HTML
);
}
}
<?php
namespace App\Store\Metrics\Examples;
use App\Models\StoreOrder;
use Dcat\Admin\Admin;
use Dcat\Admin\Widgets\Metrics\Bar;
use Illuminate\Http\Request;
class Sessions extends Bar
{
/**
* 初始化卡片内容
*/
protected function init()
{
parent::init();
$color = Admin::color();
$dark35 = $color->dark35();
// 卡片内容宽度
$this->contentWidth(5, 7);
// 标题
$this->title('Avg Sessions');
// 设置下拉选项
$this->dropdown([
'7' => 'Last 7 Days',
'30' => 'Last Month',
'365' => 'Last Year',
]);
// 设置图表颜色
$this->chartColors([
$dark35,
$dark35,
$color->primary(),
$dark35,
$dark35,
$dark35
]);
}
/**
* 处理请求
*
* @param Request $request
*
* @return mixed|void
*/
public function handle(Request $request)
{
switch ($request->get('option')) {
case '30':
$data = StoreOrder::getNumDaySale(30);
$this->withContent($data['total'], $data['balance']);
// 图表数据
$this->withChart([
[
'name' => '收益',
'data' => array_values($data['list']),
],
]);
break;
case '7':
default:
// 卡片内容
$data = StoreOrder::getNumDaySale(30);
$this->withContent($data['total'], $data['balance']);
// 图表数据
$this->withChart([
[
'name' => '收益',
'data' => array_values([51,15,63,88,16,77,51]),
],
]);
}
}
/**
* 设置图表数据.
*
* @param array $data
*
* @return $this
*/
public function withChart(array $data)
{
return $this->chart([
'series' => $data,
]);
}
/**
* 设置卡片内容.
*
* @param string $title
* @param string $value
* @param string $style
*
* @return $this
*/
public function withContent($title, $value, $style = 'success')
{
// 根据选项显示
$label = strtolower(
$this->dropdown[request()->option] ?? 'last 7 days'
);
$minHeight = '183px';
return $this->content(
<<<HTML
<div class="d-flex p-1 flex-column justify-content-between" style="padding-top: 0;width: 100%;height: 100%;min-height: {$minHeight}">
<div class="text-left">
<h1 class="font-lg-2 mt-2 mb-0">{$title}</h1>
<h5 class="font-medium-2" style="margin-top: 10px;">
<span class="text-{$style}">{$value} </span>
<span>vs {$label}</span>
</h5>
</div>
<a href="#" class="btn btn-primary shadow waves-effect waves-light">View Details <i class="feather icon-chevrons-right"></i></a>
</div>
HTML
);
}
}
<?php
namespace App\Store\Metrics\Examples;
use App\Models\OrderInfo as OrderInfoModel;
use Dcat\Admin\Widgets\Metrics\Card;
use Illuminate\Contracts\Support\Renderable;
use Illuminate\Http\Request;
class StockTotal extends Card
{
/**
* 卡片底部内容.
*
* @var string|Renderable|\Closure
*/
protected $footer;
/**
* 初始化卡片.
*/
protected function init()
{
parent::init();
$this->title('库存剩余总数');
$this->dropdown([
'1' => '今天',
'7' => '最近7天',
'30' => '最近30天',
'365' => '最近一年',
]);
}
/**
* 处理请求.
*
* @param Request $request
*
* @return void
*/
public function handle(Request $request)
{
switch ($request->get('option')) {
case '365':
$data = OrderInfoModel::getYearData();
// 卡片内容
$this->withContent($data['total']);
// 图表数据
//$this->withChart($data['list']);
break;
case '30':
$data = OrderInfoModel::getNumDayData(30);
// 卡片内容
$this->withContent($data['total']);
// 图表数据
//$this->withChart($data['list']);
break;
case '7':
$data = OrderInfoModel::getNumDayData(7);
// 卡片内容
$this->withContent($data['total']);
// 图表数据
//$this->withChart($data['list']);
break;
default:
$data = OrderInfoModel::getNumDayData(1);
// 卡片内容
$this->withContent($data['total']);
// 图表数据
//$this->withChart($data['list']);
}
}
/**
* 设置卡片内容.
*
* @param string $content
*
* @return $this
*/
public function withContent($content)
{
return $this->content(
<<<HTML
<div class="d-flex justify-content-between align-items-center mt-1" style="margin-bottom: 2px">
<h2 class="ml-1 font-lg-1">{$content}</h2>
</div>
HTML
);
}
}
<?php
namespace App\Store\Metrics\Examples;
use App\Models\StoreOrder;
use Dcat\Admin\Widgets\Metrics\Line;
use Illuminate\Http\Request;
class StoreOrderChats extends Line
{
/**
* 初始化卡片内容
*
* @return void
*/
protected function init()
{
parent::init();
$this->title('已完成订单');
$this->dropdown([
'7' => '最近7天',
'30' => '最近30天',
'365' => '最近一年',
]);
$this->height(600);
$this->chartHeight(500);
$this->chartOptions = [
'colors' =>['#FF69B4'],
'chart' => [
'type' => 'area',
'dropShadow' => [
'enabled' => true,
'color' => '#000',
'top' => 18,
'left' => 7,
'blur' => 10,
'opacity' => 0.2
],
'toolbar' => [
'show' => false
],
'zoom' => [
//关闭缩放
'enabled' => false
]
],
'stroke' => [
'show' => true,
'width' => 1,
'colors' => ['#77B6EA'],
'curve' => 'smooth'
],
// 'fill' => [
// 'type' => 'gradient',
// 'gradient'=>[
// 'opacityFrom' => 0.6,
// 'opacityTo'=> 0.8
// ]
// ],
'grid' => [
'borderColor' => '#e7e7e7',
'row' => [
'opacity' => 0.5
],
],
//圆点大小
'markers' => [
'size' => 0
],
'dataLabels' => [
'enabled' => false,
'offsetX' => 0,
'style' => [
'fontSize' => '12px',
'colors' => ['#FFFFFF']
]
],
'plotOptions' => [
'line' => [
'horizontal' => true,
'dataLabels' => [
'position' => 'top',
],
]
],
'xaxis' => [
'categories' => [],
],
];
}
/**
* 处理请求
*
* @param Request $request
*
* @return mixed|void
*/
public function handle(Request $request)
{
switch ($request->get('option')) {
case '365':
$data = StoreOrder::getYearOrder();
// 卡片内容
$this->withContent('总量: '.$data['total']);
// 图表数据
$this->withChart($data['list']);
break;
case '30':
$data = StoreOrder::getNumDayOrder(30);
// 卡片内容
$this->withContent('总量: '.$data['total']);
// 图表数据
$this->withChart($data['list']);
break;
case '7':
default:
$data = StoreOrder::getNumDayOrder(7);
// 卡片内容
$this->withContent('总量: '.$data['total']);
// 图表数据
$this->withChart($data['list']);
}
}
/**
* 设置图表数据.
*
* @param array $data
*
* @return $this
*/
public function withChart(array $data)
{
$days = [];
$order_data = [
];
foreach ($data as $k=>$v){
$days[] = $k;
$order_data[] = $v;
}
return $this->chart([
'series' => [
[
'name' =>'完成订单',
'data' =>$order_data
],
],
'xaxis' => [
'categories'=> $days
],
]);
}
/**
* 设置卡片内容.
*
* @param string $content
*
* @return $this
*/
public function withContent($content)
{
return $this->content(
<<<HTML
<div class="d-flex justify-content-between align-items-center mt-1" style="margin-bottom: 2px">
<h2 class="ml-1 font-lg-1">{$content}</h2>
<span class="mb-0 mr-1 text-80">{$this->title}</span>
</div>
HTML
);
}
}
<?php
namespace App\Store\Metrics\Examples;
use Dcat\Admin\Widgets\Metrics\RadialBar;
use Illuminate\Http\Request;
class Tickets extends RadialBar
{
/**
* 初始化卡片内容
*/
protected function init()
{
parent::init();
$this->title('Tickets');
$this->height(400);
$this->chartHeight(300);
$this->chartLabels('Completed Tickets');
$this->dropdown([
'7' => 'Last 7 Days',
'28' => 'Last 28 Days',
'30' => 'Last Month',
'365' => 'Last Year',
]);
}
/**
* 处理请求
*
* @param Request $request
*
* @return mixed|void
*/
public function handle(Request $request)
{
switch ($request->get('option')) {
case '365':
case '30':
case '28':
case '7':
default:
// 卡片内容
$this->withContent(162);
// 卡片底部
$this->withFooter(29, 63, '1d');
// 图表数据
$this->withChart(83);
}
}
/**
* 设置图表数据.
*
* @param int $data
*
* @return $this
*/
public function withChart(int $data)
{
return $this->chart([
'series' => [$data],
]);
}
/**
* 卡片内容
*
* @param string $content
*
* @return $this
*/
public function withContent($content)
{
return $this->content(
<<<HTML
<div class="d-flex flex-column flex-wrap text-center">
<h1 class="font-lg-2 mt-2 mb-0">{$content}</h1>
<small>Tickets</small>
</div>
HTML
);
}
/**
* 卡片底部内容.
*
* @param string $new
* @param string $open
* @param string $response
*
* @return $this
*/
public function withFooter($new, $open, $response)
{
return $this->footer(
<<<HTML
<div class="d-flex justify-content-between p-1" style="padding-top: 0!important;">
<div class="text-center">
<p>New Tickets</p>
<span class="font-lg-1">{$new}</span>
</div>
<div class="text-center">
<p>Open Tickets</p>
<span class="font-lg-1">{$open}</span>
</div>
<div class="text-center">
<p>Response Time</p>
<span class="font-lg-1">{$response}</span>
</div>
</div>
HTML
);
}
}
<?php
namespace App\Store\Metrics\Examples;
use Dcat\Admin\Widgets\Metrics\Card;
use Illuminate\Contracts\Support\Renderable;
use Illuminate\Http\Request;
class TotalUsers extends Card
{
/**
* 卡片底部内容.
*
* @var string|Renderable|\Closure
*/
protected $footer;
/**
* 初始化卡片.
*/
protected function init()
{
parent::init();
$this->title('Total Users');
$this->dropdown([
'7' => 'Last 7 Days',
'28' => 'Last 28 Days',
'30' => 'Last Month',
'365' => 'Last Year',
]);
}
/**
* 处理请求.
*
* @param Request $request
*
* @return void
*/
public function handle(Request $request)
{
switch ($request->get('option')) {
case '365':
$this->content(mt_rand(600, 1500));
//$this->down(mt_rand(1, 30));
break;
case '30':
$this->content(mt_rand(170, 250));
$this->up(mt_rand(12, 50));
break;
case '28':
$this->content(mt_rand(155, 200));
$this->up(mt_rand(5, 50));
break;
case '7':
default:
$this->content(143);
$this->up(15);
}
}
/**
* @param int $percent
*
* @return $this
*/
public function up($percent)
{
return $this->footer(
"<i class=\"feather icon-trending-up text-success\"></i> {$percent}% Increase"
);
}
/**
* @param int $percent
*
* @return $this
*/
public function down($percent)
{
return $this->footer(
"<i class=\"feather icon-trending-down text-danger\"></i> {$percent}% Decrease"
);
}
/**
* 设置卡片底部内容.
*
* @param string|Renderable|\Closure $footer
*
* @return $this
*/
public function footer($footer)
{
$this->footer = $footer;
return $this;
}
/**
* 渲染卡片内容.
*
* @return string
*/
public function renderContent()
{
$content = parent::renderContent();
return <<<HTML
<div class="d-flex justify-content-between align-items-center mt-1" style="margin-bottom: 2px">
<h2 class="ml-1 font-lg-1">{$content}</h2>
</div>
<div class="ml-1 mt-1 font-weight-bold text-80">
{$this->renderFooter()}
</div>
HTML;
}
/**
* 渲染卡片底部内容.
*
* @return string
*/
public function renderFooter()
{
return $this->toString($this->footer);
}
}
<?php
namespace App\Store\Models;
use Illuminate\Database\Seeder;
class AdminTablesSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$createdAt = date('Y-m-d H:i:s');
// create a user.
Administrator::truncate();
Administrator::create([
'username' => 'admin',
'password' => bcrypt('admin'),
'name' => 'Administrator',
'created_at' => $createdAt,
]);
// create a role.
Role::truncate();
Role::create([
'name' => 'Administrator',
'slug' => Role::ADMINISTRATOR,
'created_at' => $createdAt,
]);
// add role to user.
Administrator::first()->roles()->save(Role::first());
//create a permission
Permission::truncate();
Permission::insert([
[
'id' => 1,
'name' => 'Auth management',
'slug' => 'auth-management',
'http_method' => '',
'http_path' => '',
'parent_id' => 0,
'order' => 1,
'created_at' => $createdAt,
],
[
'id' => 2,
'name' => 'Users',
'slug' => 'users',
'http_method' => '',
'http_path' => '/auth/users*',
'parent_id' => 1,
'order' => 2,
'created_at' => $createdAt,
],
[
'id' => 3,
'name' => 'Roles',
'slug' => 'roles',
'http_method' => '',
'http_path' => '/auth/roles*',
'parent_id' => 1,
'order' => 3,
'created_at' => $createdAt,
],
[
'id' => 4,
'name' => 'Permissions',
'slug' => 'permissions',
'http_method' => '',
'http_path' => '/auth/permissions*',
'parent_id' => 1,
'order' => 4,
'created_at' => $createdAt,
],
[
'id' => 5,
'name' => 'Menu',
'slug' => 'menu',
'http_method' => '',
'http_path' => '/auth/menu*',
'parent_id' => 1,
'order' => 5,
'created_at' => $createdAt,
],
[
'id' => 6,
'name' => 'Extension',
'slug' => 'extension',
'http_method' => '',
'http_path' => '/auth/extensions*',
'parent_id' => 1,
'order' => 6,
'created_at' => $createdAt,
],
]);
// Role::first()->permissions()->save(Permission::first());
// add default menus.
Menu::truncate();
Menu::insert([
[
'parent_id' => 0,
'order' => 1,
'title' => 'Index',
'icon' => 'feather icon-bar-chart-2',
'uri' => '/',
'created_at' => $createdAt,
],
[
'parent_id' => 0,
'order' => 2,
'title' => 'Admin',
'icon' => 'feather icon-settings',
'uri' => '',
'created_at' => $createdAt,
],
[
'parent_id' => 2,
'order' => 3,
'title' => 'Users',
'icon' => '',
'uri' => 'auth/users',
'created_at' => $createdAt,
],
[
'parent_id' => 2,
'order' => 4,
'title' => 'Roles',
'icon' => '',
'uri' => 'auth/roles',
'created_at' => $createdAt,
],
[
'parent_id' => 2,
'order' => 5,
'title' => 'Permission',
'icon' => '',
'uri' => 'auth/permissions',
'created_at' => $createdAt,
],
[
'parent_id' => 2,
'order' => 6,
'title' => 'Menu',
'icon' => '',
'uri' => 'auth/menu',
'created_at' => $createdAt,
],
[
'parent_id' => 2,
'order' => 7,
'title' => 'Extensions',
'icon' => '',
'uri' => 'auth/extensions',
'created_at' => $createdAt,
],
]);
(new Menu())->flushCache();
}
}
<?php
namespace App\Store\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Dcat\Admin\Traits\HasPermissions;
use Illuminate\Auth\Authenticatable;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\URL;
/**
* Class Administrator.
*
* @property Role[] $roles
*/
class Administrator extends Model implements AuthenticatableContract
{
use Authenticatable,
HasPermissions,
HasDateTimeFormatter;
const DEFAULT_ID = 1;
protected $fillable = ['username', 'password', 'name', 'avatar'];
/**
* Create a new Eloquent model instance.
*
* @param array $attributes
*/
public function __construct(array $attributes = [])
{
$this->init();
parent::__construct($attributes);
}
protected function init()
{
$connection = config('store.database.connection') ?: config('database.default');
$this->setConnection($connection);
$this->setTable(config('store.database.users_table'));
}
/**
* Get avatar attribute.
*
* @return mixed|string
*/
public function getAvatar()
{
$avatar = $this->avatar;
if ($avatar) {
if (! URL::isValidUrl($avatar)) {
$avatar = Storage::disk(config('store.upload.disk'))->url($avatar);
}
return $avatar;
}
return admin_asset(config('store.default_avatar') ?: '@admin/images/default-avatar.jpg');
}
/**
* A user has and belongs to many roles.
*
* @return BelongsToMany
*/
public function roles(): BelongsToMany
{
$pivotTable = config('store.database.role_users_table');
$relatedModel = config('store.database.roles_model');
return $this->belongsToMany($relatedModel, $pivotTable, 'user_id', 'role_id')->withTimestamps();
}
/**
* 判断是否允许查看菜单.
*
* @param array|Menu $menu
* @return bool
*/
public function canSeeMenu($menu)
{
return true;
}
}
<?php
namespace App\Store\Models;
use Illuminate\Database\Eloquent\Model;
class Extension extends Model
{
protected $fillable = ['name', 'is_enabled', 'version', 'options'];
protected $casts = [
'options' => 'json',
];
/**
* {@inheritDoc}
*/
public function __construct(array $attributes = [])
{
$this->init();
parent::__construct($attributes);
}
protected function init()
{
$connection = config('store.database.connection') ?: config('database.default');
$this->setConnection($connection);
$this->setTable(config('store.database.extensions_table') ?: 'admin_extensions');
}
}
<?php
namespace App\Store\Models;
use Illuminate\Database\Eloquent\Model;
class ExtensionHistory extends Model
{
protected $fillable = ['name', 'type', 'version', 'detail'];
/**
* {@inheritDoc}
*/
public function __construct(array $attributes = [])
{
$this->init();
parent::__construct($attributes);
}
protected function init()
{
$connection = config('store.database.connection') ?: config('database.default');
$this->setConnection($connection);
$this->setTable(config('store.database.extension_histories_table') ?: 'admin_extension_histories');
}
}
<?php
namespace App\Store\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Dcat\Admin\Traits\ModelTree;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Spatie\EloquentSortable\Sortable;
/**
* Class Menu.
*
* @property int $id
*
* @method where($parent_id, $id)
*/
class Menu extends Model implements Sortable
{
use HasDateTimeFormatter,
MenuCache,
ModelTree {
allNodes as treeAllNodes;
ModelTree::boot as treeBoot;
}
/**
* @var array
*/
protected $sortable = [
'sort_when_creating' => true,
];
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['parent_id', 'order', 'title', 'icon', 'uri', 'extension', 'show'];
/**
* Create a new Eloquent model instance.
*
* @param array $attributes
*/
public function __construct(array $attributes = [])
{
parent::__construct($attributes);
$this->init();
}
protected function init()
{
$connection = config('store.database.connection') ?: config('database.default');
$this->setConnection($connection);
$this->setTable(config('store.database.menu_table'));
}
/**
* A Menu belongs to many roles.
*
* @return BelongsToMany
*/
public function roles(): BelongsToMany
{
$pivotTable = config('store.database.role_menu_table');
$relatedModel = config('store.database.roles_model');
return $this->belongsToMany($relatedModel, $pivotTable, 'menu_id', 'role_id')->withTimestamps();
}
public function permissions(): BelongsToMany
{
$pivotTable = config('store.database.permission_menu_table');
$relatedModel = config('store.database.permissions_model');
return $this->belongsToMany($relatedModel, $pivotTable, 'menu_id', 'permission_id')->withTimestamps();
}
/**
* Get all elements.
*
* @param bool $force
* @return static[]|\Illuminate\Support\Collection
*/
public function allNodes(bool $force = false)
{
if ($force || $this->queryCallbacks) {
return $this->fetchAll();
}
return $this->remember(function () {
return $this->fetchAll();
});
}
/**
* Fetch all elements.
*
* @return static[]|\Illuminate\Support\Collection
*/
public function fetchAll()
{
return $this->withQuery(function ($query) {
if (static::withPermission()) {
$query = $query->with('permissions');
}
return $query->with('roles');
})->treeAllNodes();
}
/**
* Determine if enable menu bind permission.
*
* @return bool
*/
public static function withPermission()
{
return config('store.menu.bind_permission') && config('store.permission.enable');
}
/**
* Determine if enable menu bind role.
*
* @return bool
*/
public static function withRole()
{
return (bool) config('store.permission.enable');
}
/**
* Detach models from the relationship.
*
* @return void
*/
protected static function boot()
{
static::treeBoot();
static::deleting(function ($model) {
$model->roles()->detach();
$model->permissions()->detach();
$model->flushCache();
});
static::saved(function ($model) {
$model->flushCache();
});
}
}
<?php
namespace App\Store\Models;
use Dcat\Admin\Admin;
use Illuminate\Support\Facades\Cache;
trait MenuCache
{
protected $cacheKey = 'store_dcat-admin-menus-%d-%s';
/**
* Get an item from the cache, or execute the given Closure and store the result.
*
* @param \Closure $builder
* @return mixed
*/
protected function remember(\Closure $builder)
{
if (! $this->enableCache()) {
return $builder();
}
return $this->getStore()->remember($this->getCacheKey(), null, $builder);
}
/**
* @return bool|void
*/
public function flushCache()
{
if (! $this->enableCache()) {
return;
}
return $this->getStore()->delete($this->getCacheKey());
}
/**
* @return string
*/
protected function getCacheKey()
{
return sprintf($this->cacheKey, (int) static::withPermission(), Admin::app()->getName());
}
/**
* @return bool
*/
public function enableCache()
{
return config('store.menu.cache.enable');
}
/**
* Get cache store.
*
* @return \Illuminate\Contracts\Cache\Repository
*/
public function getStore()
{
return Cache::store(config('store.menu.cache.store', 'file'));
}
}
<?php
namespace App\Store\Models;
use Dcat\Admin\Support\Helper;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Dcat\Admin\Traits\ModelTree;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
use Spatie\EloquentSortable\Sortable;
class Permission extends Model implements Sortable
{
use HasDateTimeFormatter,
ModelTree {
ModelTree::boot as treeBoot;
}
/**
* @var array
*/
protected $fillable = ['parent_id', 'name', 'slug', 'http_method', 'http_path'];
/**
* @var array
*/
public static $httpMethods = [
'GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS', 'HEAD',
];
protected $titleColumn = 'name';
/**
* {@inheritDoc}
*/
public function __construct(array $attributes = [])
{
$this->init();
parent::__construct($attributes);
}
protected function init()
{
$connection = config('store.database.connection') ?: config('database.default');
$this->setConnection($connection);
$this->setTable(config('store.database.permissions_table'));
}
/**
* Permission belongs to many roles.
*
* @return BelongsToMany
*/
public function roles(): BelongsToMany
{
$pivotTable = config('store.database.role_permissions_table');
$relatedModel = config('store.database.roles_model');
return $this->belongsToMany($relatedModel, $pivotTable, 'permission_id', 'role_id');
}
/**
* @return BelongsToMany
*/
public function menus(): BelongsToMany
{
$pivotTable = config('store.database.permission_menu_table');
$relatedModel = config('store.database.menu_model');
return $this->belongsToMany($relatedModel, $pivotTable, 'permission_id', 'menu_id')->withTimestamps();
}
/**
* If request should pass through the current permission.
*
* @param Request $request
* @return bool
*/
public function shouldPassThrough(Request $request): bool
{
if (! $this->http_path) {
return false;
}
$method = $this->http_method;
$matches = array_map(function ($path) use ($method) {
if (Str::contains($path, ':')) {
[$method, $path] = explode(':', $path);
$method = explode(',', $method);
}
$path = Str::contains($path, '.') ? $path : ltrim(admin_base_path($path), '/');
return compact('method', 'path');
}, $this->http_path);
foreach ($matches as $match) {
if ($this->matchRequest($match, $request)) {
return true;
}
}
return false;
}
/**
* Get options for Select field in form.
*
* @param \Closure|null $closure
* @return array
*/
public static function selectOptions(\Closure $closure = null)
{
$options = (new static())->withQuery($closure)->buildSelectOptions();
return collect($options)->all();
}
/**
* @param string $path
* @return mixed
*/
public function getHttpPathAttribute($path)
{
return explode(',', $path);
}
/**
* @param $path
*/
public function setHttpPathAttribute($path)
{
if (is_array($path)) {
$path = implode(',', $path);
}
return $this->attributes['http_path'] = $path;
}
/**
* If a request match the specific HTTP method and path.
*
* @param array $match
* @param Request $request
* @return bool
*/
protected function matchRequest(array $match, Request $request): bool
{
if (! $path = trim($match['path'], '/')) {
return false;
}
if (! Helper::matchRequestPath($path, $request->decodedPath())) {
return false;
}
$method = collect($match['method'])->filter()->map(function ($method) {
return strtoupper($method);
});
return $method->isEmpty() || $method->contains($request->method());
}
/**
* @param $method
*/
public function setHttpMethodAttribute($method)
{
if (is_array($method)) {
$this->attributes['http_method'] = implode(',', $method);
}
}
/**
* @param $method
* @return array
*/
public function getHttpMethodAttribute($method)
{
if (is_string($method)) {
return array_filter(explode(',', $method));
}
return $method;
}
/**
* Detach models from the relationship.
*
* @return void
*/
protected static function boot()
{
static::treeBoot();
parent::boot();
static::deleting(function ($model) {
$model->roles()->detach();
});
}
}
<?php
namespace App\Store\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
class Role extends Model
{
use HasDateTimeFormatter;
const ADMINISTRATOR = 'administrator';
const ADMINISTRATOR_ID = 1;
protected $fillable = ['name', 'slug'];
/**
* {@inheritDoc}
*/
public function __construct(array $attributes = [])
{
$this->init();
parent::__construct($attributes);
}
protected function init()
{
$connection = config('store.database.connection') ?: config('database.default');
$this->setConnection($connection);
$this->setTable(config('store.database.roles_table'));
}
/**
* A role belongs to many users.
*
* @return BelongsToMany
*/
public function administrators(): BelongsToMany
{
$pivotTable = config('store.database.role_users_table');
$relatedModel = config('store.database.users_model');
return $this->belongsToMany($relatedModel, $pivotTable, 'role_id', 'user_id');
}
/**
* A role belongs to many permissions.
*
* @return BelongsToMany
*/
public function permissions(): BelongsToMany
{
$pivotTable = config('store.database.role_permissions_table');
$relatedModel = config('store.database.permissions_model');
return $this->belongsToMany($relatedModel, $pivotTable, 'role_id', 'permission_id')->withTimestamps();
}
/**
* @return BelongsToMany
*/
public function menus(): BelongsToMany
{
$pivotTable = config('store.database.role_menu_table');
$relatedModel = config('store.database.menu_model');
return $this->belongsToMany($relatedModel, $pivotTable, 'role_id', 'menu_id')->withTimestamps();
}
/**
* Check user has permission.
*
* @param $permission
* @return bool
*/
public function can(?string $permission): bool
{
return $this->permissions()->where('slug', $permission)->exists();
}
/**
* Check user has no permission.
*
* @param $permission
* @return bool
*/
public function cannot(?string $permission): bool
{
return ! $this->can($permission);
}
/**
* Get id of the permission by id.
*
* @param array $roleIds
* @return \Illuminate\Support\Collection
*/
public static function getPermissionId(array $roleIds)
{
if (! $roleIds) {
return collect();
}
$related = config('store.database.role_permissions_table');
$model = new static();
$keyName = $model->getKeyName();
return $model->newQuery()
->leftJoin($related, $keyName, '=', 'role_id')
->whereIn($keyName, $roleIds)
->get(['permission_id', 'role_id'])
->groupBy('role_id')
->map(function ($v) {
$v = $v instanceof Arrayable ? $v->toArray() : $v;
return array_column($v, 'permission_id');
});
}
/**
* @param string $slug
* @return bool
*/
public static function isAdministrator(?string $slug)
{
return $slug === static::ADMINISTRATOR;
}
/**
* Detach models from the relationship.
*
* @return void
*/
protected static function boot()
{
parent::boot();
static::deleting(function ($model) {
$model->administrators()->detach();
$model->permissions()->detach();
});
}
}
<?php
namespace App\Store\Models;
use Illuminate\Database\Eloquent\Model;
class Setting extends Model
{
protected $primaryKey = 'slug';
public $incrementing = false;
protected $fillable = ['slug', 'value'];
/**
* {@inheritDoc}
*/
public function __construct(array $attributes = [])
{
$this->init();
parent::__construct($attributes);
}
protected function init()
{
$connection = config('store.database.connection') ?: config('database.default');
$this->setConnection($connection);
$this->setTable(config('store.database.settings_table') ?: 'admin_settings');
}
}
<?php
use Dcat\Admin\Admin;
use Dcat\Admin\Grid;
use Dcat\Admin\Form;
use Dcat\Admin\Grid\Filter;
use Dcat\Admin\Show;
use Dcat\Admin\Form\Field\Editor;
use Dcat\Admin\Support\JavaScript;
Editor::resolving(function (Editor $editor) {
// 设置默认配置
$editor->options([
'toolbar' => [
'code undo redo restoredraft | cut copy paste pastetext | forecolor backcolor bold italic underline strikethrough link anchor | alignleft aligncenter alignright alignjustify outdent indent | formatselect fontselect fontsizeselect | bullist numlist | blockquote subscript superscript removeformat | table image media charmap emoticons hr pagebreak insertdatetime print preview | fullscreen | bdmap indent2em lineheight formatpainter axupimgs',
],
'setup' => JavaScript::make(
<<<JS
function (editor) {
//console.log('编辑器初始化成功', editor)
}
JS
),
]);
// 设置编辑器图片默认上传到七牛云
//$editor->disk('img_oss');
});
/**
* Dcat-admin - admin builder based on Laravel.
* @author jqh <https://github.com/jqhph>
*
* Bootstraper for Admin.
*
* Here you can remove builtin form field:
*
* extend custom field:
* Dcat\Admin\Form::extend('php', PHPEditor::class);
* Dcat\Admin\Grid\Column::extend('php', PHPEditor::class);
* Dcat\Admin\Grid\Filter::extend('php', PHPEditor::class);
*
* Or require js and css assets:
* Admin::css('/packages/prettydocs/css/styles.css');
* Admin::js('/packages/prettydocs/js/main.js');
*
*/
<?php
use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Route;
use Dcat\Admin\Admin;
Admin::routes();
Route::group([
'prefix' => config('admin.route.prefix'),
'namespace' => config('admin.route.namespace'),
'middleware' => config('admin.route.middleware'),
], function (Router $router) {
$router->match(['put', 'post'], 'upload/store', 'UploadFileController@storeUpload');
$router->match(['put', 'post'], 'upload/store-invoice', 'UploadFileController@storeInvoiceUpload');
$router->get('/', 'HomeController@index');
$router->resource('category', 'StoreGoodsCategoryController'); //商品分类管理
$router->resource('tag', 'StoreGoodsTagController'); //商品标签管理
$router->resource('goods', 'MerchatGoodsStoreController'); //商品管理
$router->resource('order', 'OrderInfoController'); //订单管理
$router->resource('income', 'StoreIncomeController'); //提现管理
});
#!/usr/bin/env php
<?php
define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any of our classes manually. It's great to relax.
|
*/
require __DIR__.'/vendor/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
/*
|--------------------------------------------------------------------------
| Run The Artisan Application
|--------------------------------------------------------------------------
|
| When we run the console application, the current CLI command will be
| executed in this console and the response sent back to a terminal
| or another output device for the developers. Here goes nothing!
|
*/
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
$status = $kernel->handle(
$input = new Symfony\Component\Console\Input\ArgvInput,
new Symfony\Component\Console\Output\ConsoleOutput
);
/*
|--------------------------------------------------------------------------
| Shutdown The Application
|--------------------------------------------------------------------------
|
| Once Artisan has finished running, we will fire off the shutdown events
| so that any final work may be done by the application before we shut
| down the process. This is the last thing to happen to the request.
|
*/
$kernel->terminate($input, $status);
exit($status);
<?php
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| The first thing we will do is create a new Laravel application instance
| which serves as the "glue" for all the components of Laravel, and is
| the IoC container for the system binding all of the various parts.
|
*/
$app = new Illuminate\Foundation\Application(
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
);
/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/
$app->singleton(
Illuminate\Contracts\Http\Kernel::class,
App\Http\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Console\Kernel::class,
App\Console\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
App\Exceptions\Handler::class
);
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
return $app;
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^8.0.2",
"abbotton/dcat-sku-plus": "^1.0",
"alibabacloud/dysmsapi-20170525": "^2.0",
"aliyuncs/oss-sdk-php": "^2.7",
"dcat/laravel-admin": "2.*",
"endroid/qrcode": "4.0.3",
"guzzlehttp/guzzle": "^7.2",
"intervention/image": "^2.7",
"jacobcyl/ali-oss-storage": "^2.1",
"laravel/framework": "^9.19",
"laravel/sanctum": "^3.0",
"laravel/tinker": "^2.7",
"league/flysystem": "^3.15",
"lty5240/dcat-easy-sku": "^1.1",
"maatwebsite/excel": "~3.1.0",
"phpoffice/phpspreadsheet": "^1.29",
"predis/predis": "^2.1",
"qcloud/cos-sdk-v5": "^2.6",
"qcloudsms/qcloudsms_php": "^0.1.4",
"simplesoftwareio/simple-qrcode": "^4.2",
"slowlyo/dcat-diy-form": "^2.2",
"zhy/dcat-admin-sku": "dev-master"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/pint": "^1.0",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^6.1",
"phpunit/phpunit": "^9.5.10",
"spatie/laravel-ignition": "^1.0"
},
"autoload": {
"classmap": [
"vendor/aliyuncs/oss-sdk-php/src/OSS"
],
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
},
"files": [
"app/Helper/functions.php"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true,
"easywechat-composer/easywechat-composer": true
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
This source diff could not be displayed because it is too large. You can view the blob instead.
<?php
return [
/*
|--------------------------------------------------------------------------
| dcat-admin name
|--------------------------------------------------------------------------
|
| This value is the name of dcat-admin, This setting is displayed on the
| login page.
|
*/
'name' => '爱美约后台管理',
/*
|--------------------------------------------------------------------------
| dcat-admin logo
|--------------------------------------------------------------------------
|
| The logo of all admin pages. You can also set it as an image by using a
| `img` tag, eg '<img src="http://logo-url" alt="Admin logo">'.
|
*/
'logo' => '<img src="/vendor/dcat-admin/images/logo.png" width="35"> &nbsp;爱美约后台管理',
/*
|--------------------------------------------------------------------------
| dcat-admin mini logo
|--------------------------------------------------------------------------
|
| The logo of all admin pages when the sidebar menu is collapsed. You can
| also set it as an image by using a `img` tag, eg
| '<img src="http://logo-url" alt="Admin logo">'.
|
*/
'logo-mini' => '<img src="/vendor/dcat-admin/images/logo.png">',
/*
|--------------------------------------------------------------------------
| dcat-admin favicon
|--------------------------------------------------------------------------
|
*/
'favicon' => null,
/*
|--------------------------------------------------------------------------
| User default avatar
|--------------------------------------------------------------------------
|
| Set a default avatar for newly created users.
|
*/
'default_avatar' => '@admin/images/default-avatar.jpg',
/*
|--------------------------------------------------------------------------
| dcat-admin route settings
|--------------------------------------------------------------------------
|
| The routing configuration of the admin page, including the path prefix,
| the controller namespace, and the default middleware. If you want to
| access through the root path, just set the prefix to empty string.
|
*/
'route' => [
'domain' => env('ADMIN_ROUTE_DOMAIN'),
'prefix' => '',
'namespace' => 'App\\Admin\\Controllers',
'middleware' => ['web', 'admin'],
'enable_session_middleware' => false,
],
/*
|--------------------------------------------------------------------------
| dcat-admin install directory
|--------------------------------------------------------------------------
|
| The installation directory of the controller and routing configuration
| files of the administration page. The default is `app/Admin`, which must
| be set before running `artisan admin::install` to take effect.
|
*/
'directory' => app_path('Admin'),
/*
|--------------------------------------------------------------------------
| dcat-admin html title
|--------------------------------------------------------------------------
|
| Html title for all pages.
|
*/
'title' => '爱美约',
/*
|--------------------------------------------------------------------------
| Assets hostname
|--------------------------------------------------------------------------
|
*/
'assets_server' => env('ADMIN_ASSETS_SERVER'),
/*
|--------------------------------------------------------------------------
| Access via `https`
|--------------------------------------------------------------------------
|
| If your page is going to be accessed via https, set it to `true`.
|
*/
'https' => env('ADMIN_HTTPS', false),
/*
|--------------------------------------------------------------------------
| dcat-admin auth setting
|--------------------------------------------------------------------------
|
| Authentication settings for all admin pages. Include an authentication
| guard and a user provider setting of authentication driver.
|
| You can specify a controller for `login` `logout` and other auth routes.
|
*/
'auth' => [
'enable' => true,
'controller' => App\Admin\Controllers\AuthController::class,
'guard' => 'admin',
'guards' => [
'admin' => [
'driver' => 'session',
'provider' => 'admin',
],
],
'providers' => [
'admin' => [
'driver' => 'eloquent',
'model' => Dcat\Admin\Models\Administrator::class,
],
],
// Add "remember me" to login form
'remember' => true,
// All method to path like: auth/users/*/edit
// or specific method to path like: get:auth/users.
'except' => [
'auth/login',
'auth/logout',
],
'enable_session_middleware' => false,
],
/*
|--------------------------------------------------------------------------
| The global Grid setting
|--------------------------------------------------------------------------
*/
'grid' => [
// The global Grid action display class.
'grid_action_class' => Dcat\Admin\Grid\Displayers\DropdownActions::class,
// The global Grid batch action display class.
'batch_action_class' => Dcat\Admin\Grid\Tools\BatchActions::class,
// The global Grid pagination display class.
'paginator_class' => Dcat\Admin\Grid\Tools\Paginator::class,
'actions' => [
'view' => Dcat\Admin\Grid\Actions\Show::class,
'edit' => Dcat\Admin\Grid\Actions\Edit::class,
'quick_edit' => Dcat\Admin\Grid\Actions\QuickEdit::class,
'delete' => Dcat\Admin\Grid\Actions\Delete::class,
'batch_delete' => Dcat\Admin\Grid\Tools\BatchDelete::class,
],
// The global Grid column selector setting.
'column_selector' => [
'store' => Dcat\Admin\Grid\ColumnSelector\SessionStore::class,
'store_params' => [
'driver' => 'file',
],
],
],
/*
|--------------------------------------------------------------------------
| dcat-admin helpers setting.
|--------------------------------------------------------------------------
*/
'helpers' => [
'enable' => true,
],
/*
|--------------------------------------------------------------------------
| dcat-admin permission setting
|--------------------------------------------------------------------------
|
| Permission settings for all admin pages.
|
*/
'permission' => [
// Whether enable permission.
'enable' => true,
// All method to path like: auth/users/*/edit
// or specific method to path like: get:auth/users.
'except' => [
'/',
'auth/login',
'auth/logout',
'auth/setting',
],
],
/*
|--------------------------------------------------------------------------
| dcat-admin menu setting
|--------------------------------------------------------------------------
|
*/
'menu' => [
'cache' => [
// enable cache or not
'enable' => false,
'store' => 'file',
],
// Whether enable menu bind to a permission.
'bind_permission' => true,
// Whether enable role bind to menu.
'role_bind_menu' => true,
// Whether enable permission bind to menu.
'permission_bind_menu' => true,
'default_icon' => 'feather icon-circle',
],
/*
|--------------------------------------------------------------------------
| dcat-admin upload setting
|--------------------------------------------------------------------------
|
| File system configuration for form upload files and images, including
| disk and upload path.
|
*/
'upload' => [
// Disk in `config/filesystem.php`.
'disk' => 'admin',
// Image and file upload path under the disk above.
'directory' => [
'image' => 'images',
'file' => 'files',
],
],
/*
|--------------------------------------------------------------------------
| dcat-admin database settings
|--------------------------------------------------------------------------
|
| Here are database settings for dcat-admin builtin model & tables.
|
*/
'database' => [
// Database connection for following tables.
'connection' => '',
// User tables and model.
'users_table' => 'admin_users',
'users_model' => Dcat\Admin\Models\Administrator::class,
// Role table and model.
'roles_table' => 'admin_roles',
'roles_model' => Dcat\Admin\Models\Role::class,
// Permission table and model.
'permissions_table' => 'admin_permissions',
'permissions_model' => Dcat\Admin\Models\Permission::class,
// Menu table and model.
'menu_table' => 'admin_menu',
'menu_model' => Dcat\Admin\Models\Menu::class,
// Pivot table for table above.
'role_users_table' => 'admin_role_users',
'role_permissions_table' => 'admin_role_permissions',
'role_menu_table' => 'admin_role_menu',
'permission_menu_table' => 'admin_permission_menu',
'settings_table' => 'admin_settings',
'extensions_table' => 'admin_extensions',
'extension_histories_table' => 'admin_extension_histories',
],
/*
|--------------------------------------------------------------------------
| Application layout
|--------------------------------------------------------------------------
|
| This value is the layout of admin pages.
*/
'layout' => [
// default, blue, blue-light, green
'color' => 'default',
// sidebar-separate
'body_class' => [],
'horizontal_menu' => false,
'sidebar_collapsed' => false,
// light, primary, dark
'sidebar_style' => 'light',
'dark_mode_switch' => false,
// bg-primary, bg-info, bg-warning, bg-success, bg-danger, bg-dark
'navbar_color' => '',
],
/*
|--------------------------------------------------------------------------
| The exception handler class
|--------------------------------------------------------------------------
|
*/
'exception_handler' => Dcat\Admin\Exception\Handler::class,
/*
|--------------------------------------------------------------------------
| Enable default breadcrumb
|--------------------------------------------------------------------------
|
| Whether enable default breadcrumb for every page content.
*/
'enable_default_breadcrumb' => true,
/*
|--------------------------------------------------------------------------
| Extension
|--------------------------------------------------------------------------
*/
'extension' => [
// When you use command `php artisan admin:ext-make` to generate extensions,
// the extension files will be generated in this directory.
'dir' => base_path('dcat-admin-extensions'),
],
'multi_app' => [
// 与新应用的配置文件名称一致
// 设置为true启用,false则是停用
'store' => true,
],
];
<?php
use Illuminate\Support\Facades\Facade;
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
|
*/
'name' => env('APP_NAME', 'Laravel'),
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => (bool) env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => env('APP_URL', 'http://localhost'),
'asset_url' => env('ASSET_URL'),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => 'Asia/Shanghai',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
'locale' => 'zh_CN',
/*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
'fallback_locale' => 'zh_CN',
/*
|--------------------------------------------------------------------------
| Faker Locale
|--------------------------------------------------------------------------
|
| This locale will be used by the Faker PHP library when generating fake
| data for your database seeds. For example, this will be used to get
| localized telephone numbers, street address information and more.
|
*/
'faker_locale' => 'zh_CN',
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
'key' => env('APP_KEY'),
'cipher' => 'AES-256-CBC',
/*
|--------------------------------------------------------------------------
| Maintenance Mode Driver
|--------------------------------------------------------------------------
|
| These configuration options determine the driver used to determine and
| manage Laravel's "maintenance mode" status. The "cache" driver will
| allow maintenance mode to be controlled across multiple machines.
|
| Supported drivers: "file", "cache"
|
*/
'maintenance' => [
'driver' => 'file',
// 'store' => 'redis',
],
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
'providers' => [
/*
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Notifications\NotificationServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
/*
* Package Service Providers...
*/
Maatwebsite\Excel\ExcelServiceProvider::class,
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
Jacobcyl\AliOSS\AliOssServiceProvider::class,
],
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => Facade::defaultAliases()->merge([
// 'ExampleClass' => App\Example\ExampleClass::class,
'Excel' => Maatwebsite\Excel\Facades\Excel::class,
])->toArray(),
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option controls the default authentication "guard" and password
| reset options for your application. You may change these defaults
| as required, but they're a perfect start for most applications.
|
*/
'defaults' => [
'guard' => 'web',
'passwords' => 'users',
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| here which uses session storage and the Eloquent user provider.
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| Supported: "session"
|
*/
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| If you have multiple user tables or models you may configure multiple
| sources which represent each model / table. These sources may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\Models\User::class,
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| You may specify multiple password reset configurations if you have more
| than one user table or model in the application and you want to have
| separate password reset settings based on the specific user types.
|
| The expire time is the number of minutes that each reset token will be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => 'password_resets',
'expire' => 60,
'throttle' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the amount of seconds before a password confirmation
| times out and the user is prompted to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
*/
'password_timeout' => 10800,
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Broadcaster
|--------------------------------------------------------------------------
|
| This option controls the default broadcaster that will be used by the
| framework when an event needs to be broadcast. You may set this to
| any of the connections defined in the "connections" array below.
|
| Supported: "pusher", "ably", "redis", "log", "null"
|
*/
'default' => env('BROADCAST_DRIVER', 'null'),
/*
|--------------------------------------------------------------------------
| Broadcast Connections
|--------------------------------------------------------------------------
|
| Here you may define all of the broadcast connections that will be used
| to broadcast events to other systems or over websockets. Samples of
| each available type of connection are provided inside this array.
|
*/
'connections' => [
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com',
'port' => env('PUSHER_PORT', 443),
'scheme' => env('PUSHER_SCHEME', 'https'),
'encrypted' => true,
'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
],
'client_options' => [
// Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
],
],
'ably' => [
'driver' => 'ably',
'key' => env('ABLY_KEY'),
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
'log' => [
'driver' => 'log',
],
'null' => [
'driver' => 'null',
],
],
];
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache connection that gets used while
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
*/
'default' => env('CACHE_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
| Supported drivers: "apc", "array", "database", "file",
| "memcached", "redis", "dynamodb", "octane", "null"
|
*/
'stores' => [
'apc' => [
'driver' => 'apc',
],
'array' => [
'driver' => 'array',
'serialize' => false,
],
'database' => [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
'lock_connection' => null,
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
],
'memcached' => [
'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
'sasl' => [
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'cache',
'lock_connection' => 'default',
],
'dynamodb' => [
'driver' => 'dynamodb',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
'endpoint' => env('DYNAMODB_ENDPOINT'),
],
'octane' => [
'driver' => 'octane',
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing the APC, database, memcached, Redis, or DynamoDB cache
| stores there might be other applications using the same cache. For
| that reason, you may prefix every cache key to avoid collisions.
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'),
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Cross-Origin Resource Sharing (CORS) Configuration
|--------------------------------------------------------------------------
|
| Here you may configure your settings for cross-origin resource sharing
| or "CORS". This determines what cross-origin operations may execute
| in web browsers. You are free to adjust these settings as needed.
|
| To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
|
*/
'paths' => ['api/*', 'sanctum/csrf-cookie'],
'allowed_methods' => ['*'],
'allowed_origins' => ['*'],
'allowed_origins_patterns' => [],
'allowed_headers' => ['*'],
'exposed_headers' => [],
'max_age' => 0,
'supports_credentials' => false,
];
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
*/
'default' => env('DB_CONNECTION', 'mysql'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'url' => env('DATABASE_URL'),
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
],
'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
'search_path' => 'public',
'sslmode' => 'prefer',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
*/
'migrations' => 'migrations',
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer body of commands than a typical key-value system
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis'),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
],
'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
],
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
],
],
];
<?php
use Maatwebsite\Excel\Excel;
return [
'exports' => [
/*
|--------------------------------------------------------------------------
| Chunk size
|--------------------------------------------------------------------------
|
| When using FromQuery, the query is automatically chunked.
| Here you can specify how big the chunk should be.
|
*/
'chunk_size' => 1000,
/*
|--------------------------------------------------------------------------
| Pre-calculate formulas during export
|--------------------------------------------------------------------------
*/
'pre_calculate_formulas' => false,
/*
|--------------------------------------------------------------------------
| Enable strict null comparison
|--------------------------------------------------------------------------
|
| When enabling strict null comparison empty cells ('') will
| be added to the sheet.
*/
'strict_null_comparison' => false,
/*
|--------------------------------------------------------------------------
| CSV Settings
|--------------------------------------------------------------------------
|
| Configure e.g. delimiter, enclosure and line ending for CSV exports.
|
*/
'csv' => [
'delimiter' => ',',
'enclosure' => '"',
'line_ending' => PHP_EOL,
'use_bom' => false,
'include_separator_line' => false,
'excel_compatibility' => false,
'output_encoding' => '',
'test_auto_detect' => true,
],
/*
|--------------------------------------------------------------------------
| Worksheet properties
|--------------------------------------------------------------------------
|
| Configure e.g. default title, creator, subject,...
|
*/
'properties' => [
'creator' => '',
'lastModifiedBy' => '',
'title' => '',
'description' => '',
'subject' => '',
'keywords' => '',
'category' => '',
'manager' => '',
'company' => '',
],
],
'imports' => [
/*
|--------------------------------------------------------------------------
| Read Only
|--------------------------------------------------------------------------
|
| When dealing with imports, you might only be interested in the
| data that the sheet exists. By default we ignore all styles,
| however if you want to do some logic based on style data
| you can enable it by setting read_only to false.
|
*/
'read_only' => true,
/*
|--------------------------------------------------------------------------
| Ignore Empty
|--------------------------------------------------------------------------
|
| When dealing with imports, you might be interested in ignoring
| rows that have null values or empty strings. By default rows
| containing empty strings or empty values are not ignored but can be
| ignored by enabling the setting ignore_empty to true.
|
*/
'ignore_empty' => false,
/*
|--------------------------------------------------------------------------
| Heading Row Formatter
|--------------------------------------------------------------------------
|
| Configure the heading row formatter.
| Available options: none|slug|custom
|
*/
'heading_row' => [
'formatter' => 'slug',
],
/*
|--------------------------------------------------------------------------
| CSV Settings
|--------------------------------------------------------------------------
|
| Configure e.g. delimiter, enclosure and line ending for CSV imports.
|
*/
'csv' => [
'delimiter' => null,
'enclosure' => '"',
'escape_character' => '\\',
'contiguous' => false,
'input_encoding' => 'UTF-8',
],
/*
|--------------------------------------------------------------------------
| Worksheet properties
|--------------------------------------------------------------------------
|
| Configure e.g. default title, creator, subject,...
|
*/
'properties' => [
'creator' => '',
'lastModifiedBy' => '',
'title' => '',
'description' => '',
'subject' => '',
'keywords' => '',
'category' => '',
'manager' => '',
'company' => '',
],
],
/*
|--------------------------------------------------------------------------
| Extension detector
|--------------------------------------------------------------------------
|
| Configure here which writer/reader type should be used when the package
| needs to guess the correct type based on the extension alone.
|
*/
'extension_detector' => [
'xlsx' => Excel::XLSX,
'xlsm' => Excel::XLSX,
'xltx' => Excel::XLSX,
'xltm' => Excel::XLSX,
'xls' => Excel::XLS,
'xlt' => Excel::XLS,
'ods' => Excel::ODS,
'ots' => Excel::ODS,
'slk' => Excel::SLK,
'xml' => Excel::XML,
'gnumeric' => Excel::GNUMERIC,
'htm' => Excel::HTML,
'html' => Excel::HTML,
'csv' => Excel::CSV,
'tsv' => Excel::TSV,
/*
|--------------------------------------------------------------------------
| PDF Extension
|--------------------------------------------------------------------------
|
| Configure here which Pdf driver should be used by default.
| Available options: Excel::MPDF | Excel::TCPDF | Excel::DOMPDF
|
*/
'pdf' => Excel::DOMPDF,
],
/*
|--------------------------------------------------------------------------
| Value Binder
|--------------------------------------------------------------------------
|
| PhpSpreadsheet offers a way to hook into the process of a value being
| written to a cell. In there some assumptions are made on how the
| value should be formatted. If you want to change those defaults,
| you can implement your own default value binder.
|
| Possible value binders:
|
| [x] Maatwebsite\Excel\DefaultValueBinder::class
| [x] PhpOffice\PhpSpreadsheet\Cell\StringValueBinder::class
| [x] PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder::class
|
*/
'value_binder' => [
'default' => Maatwebsite\Excel\DefaultValueBinder::class,
],
'cache' => [
/*
|--------------------------------------------------------------------------
| Default cell caching driver
|--------------------------------------------------------------------------
|
| By default PhpSpreadsheet keeps all cell values in memory, however when
| dealing with large files, this might result into memory issues. If you
| want to mitigate that, you can configure a cell caching driver here.
| When using the illuminate driver, it will store each value in the
| cache store. This can slow down the process, because it needs to
| store each value. You can use the "batch" store if you want to
| only persist to the store when the memory limit is reached.
|
| Drivers: memory|illuminate|batch
|
*/
'driver' => 'memory',
/*
|--------------------------------------------------------------------------
| Batch memory caching
|--------------------------------------------------------------------------
|
| When dealing with the "batch" caching driver, it will only
| persist to the store when the memory limit is reached.
| Here you can tweak the memory limit to your liking.
|
*/
'batch' => [
'memory_limit' => 60000,
],
/*
|--------------------------------------------------------------------------
| Illuminate cache
|--------------------------------------------------------------------------
|
| When using the "illuminate" caching driver, it will automatically use
| your default cache store. However if you prefer to have the cell
| cache on a separate store, you can configure the store name here.
| You can use any store defined in your cache config. When leaving
| at "null" it will use the default store.
|
*/
'illuminate' => [
'store' => null,
],
],
/*
|--------------------------------------------------------------------------
| Transaction Handler
|--------------------------------------------------------------------------
|
| By default the import is wrapped in a transaction. This is useful
| for when an import may fail and you want to retry it. With the
| transactions, the previous import gets rolled-back.
|
| You can disable the transaction handler by setting this to null.
| Or you can choose a custom made transaction handler here.
|
| Supported handlers: null|db
|
*/
'transactions' => [
'handler' => 'db',
'db' => [
'connection' => null,
],
],
'temporary_files' => [
/*
|--------------------------------------------------------------------------
| Local Temporary Path
|--------------------------------------------------------------------------
|
| When exporting and importing files, we use a temporary file, before
| storing reading or downloading. Here you can customize that path.
|
*/
'local_path' => storage_path('framework/cache/laravel-excel'),
/*
|--------------------------------------------------------------------------
| Remote Temporary Disk
|--------------------------------------------------------------------------
|
| When dealing with a multi server setup with queues in which you
| cannot rely on having a shared local temporary path, you might
| want to store the temporary file on a shared disk. During the
| queue executing, we'll retrieve the temporary file from that
| location instead. When left to null, it will always use
| the local path. This setting only has effect when using
| in conjunction with queued imports and exports.
|
*/
'remote_disk' => null,
'remote_prefix' => null,
/*
|--------------------------------------------------------------------------
| Force Resync
|--------------------------------------------------------------------------
|
| When dealing with a multi server setup as above, it's possible
| for the clean up that occurs after entire queue has been run to only
| cleanup the server that the last AfterImportJob runs on. The rest of the server
| would still have the local temporary file stored on it. In this case your
| local storage limits can be exceeded and future imports won't be processed.
| To mitigate this you can set this config value to be true, so that after every
| queued chunk is processed the local temporary file is deleted on the server that
| processed it.
|
*/
'force_resync_remote' => null,
],
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
*/
'default' => env('FILESYSTEM_DISK', 'cos'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been set up for each driver as an example of the required values.
|
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
'throw' => false,
],
'public_oss' => [
'driver' => 'oss',
'access_id' => env('OSS_ACCESS_KEY_ID'), //Your Aliyun OSS AccessKeyId
'access_key' => env('OSS_ACCESS_KEY_SECRET'), //Your Aliyun OSS AccessKeySecret
'bucket' => env('OSS_PUBLIC_BUCKET'), //OSS bucket name
'endpoint' => env('OSS_ENDPOINT'),
'ssl' => false,
'debug' => true,
],
'admin' => [
'driver' => 'local',
'root' => public_path('uploads'),
'visibility' => 'public',
'url' => env('IMAGE_URL', ''),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL') . '/storage',
'visibility' => 'public',
'throw' => false,
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
'throw' => false,
],
'cos' => [
'driver' => 'cos',
'region' => env('COS_REGION'),
'secretId' => env('COS_SECRET_ID'),
'secretKey' => env('COS_SECRET_KEY'),
'bucket' => env('COS_BUCKET'),
'read_from_cdn' => false, // 是否从CDN读取数据
'cdn' => '', // 你的CDN域名,例如:'http://cdn.example.com/'
'scheme' => 'https',
'domain' => '', // 自定义域名,如果为空则使用COS提供的域名
'prefix' => '', // 文件前缀,可用于文件分类
'request' => [
'timeout' => 60,
],
],
],
/*
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
*/
'links' => [
public_path('storage') => storage_path('app/public'),
],
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Hash Driver
|--------------------------------------------------------------------------
|
| This option controls the default hash driver that will be used to hash
| passwords for your application. By default, the bcrypt algorithm is
| used; however, you remain free to modify this option if you wish.
|
| Supported: "bcrypt", "argon", "argon2id"
|
*/
'driver' => 'bcrypt',
/*
|--------------------------------------------------------------------------
| Bcrypt Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Bcrypt algorithm. This will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'bcrypt' => [
'rounds' => env('BCRYPT_ROUNDS', 10),
],
/*
|--------------------------------------------------------------------------
| Argon Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Argon algorithm. These will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'argon' => [
'memory' => 65536,
'threads' => 1,
'time' => 4,
],
];
<?php
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that gets used when writing
| messages to the logs. The name specified in this option should match
| one of the channels defined in the "channels" configuration array.
|
*/
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Deprecations Log Channel
|--------------------------------------------------------------------------
|
| This option controls the log channel that should be used to log warnings
| regarding deprecated PHP and library features. This allows you to get
| your application ready for upcoming major versions of dependencies.
|
*/
'deprecations' => [
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
'trace' => false,
],
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog",
| "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['single'],
'ignore_exceptions' => false,
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => 14,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel Log',
'emoji' => ':boom:',
'level' => env('LOG_LEVEL', 'critical'),
],
'papertrail' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
],
],
'stderr' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => StreamHandler::class,
'formatter' => env('LOG_STDERR_FORMATTER'),
'with' => [
'stream' => 'php://stderr',
],
],
'syslog' => [
'driver' => 'syslog',
'level' => env('LOG_LEVEL', 'debug'),
],
'errorlog' => [
'driver' => 'errorlog',
'level' => env('LOG_LEVEL', 'debug'),
],
'null' => [
'driver' => 'monolog',
'handler' => NullHandler::class,
],
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
],
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Mailer
|--------------------------------------------------------------------------
|
| This option controls the default mailer that is used to send any email
| messages sent by your application. Alternative mailers may be setup
| and used as needed; however, this mailer will be used by default.
|
*/
'default' => env('MAIL_MAILER', 'smtp'),
/*
|--------------------------------------------------------------------------
| Mailer Configurations
|--------------------------------------------------------------------------
|
| Here you may configure all of the mailers used by your application plus
| their respective settings. Several examples have been configured for
| you and you are free to add your own as your application requires.
|
| Laravel supports a variety of mail "transport" drivers to be used while
| sending an e-mail. You will specify which one you are using for your
| mailers below. You are free to add additional mailers as required.
|
| Supported: "smtp", "sendmail", "mailgun", "ses",
| "postmark", "log", "array", "failover"
|
*/
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'local_domain' => env('MAIL_EHLO_DOMAIN'),
],
'ses' => [
'transport' => 'ses',
],
'mailgun' => [
'transport' => 'mailgun',
],
'postmark' => [
'transport' => 'postmark',
],
'sendmail' => [
'transport' => 'sendmail',
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
],
'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],
'array' => [
'transport' => 'array',
],
'failover' => [
'transport' => 'failover',
'mailers' => [
'smtp',
'log',
],
],
],
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
/*
|--------------------------------------------------------------------------
| Markdown Mail Settings
|--------------------------------------------------------------------------
|
| If you are using Markdown based email rendering, you may configure your
| theme and component paths here, allowing you to customize the design
| of the emails. Or, you may simply stick with the Laravel defaults!
|
*/
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Queue Connection Name
|--------------------------------------------------------------------------
|
| Laravel's queue API supports an assortment of back-ends via a single
| API, giving you convenient access to each back-end using the same
| syntax for every one. Here you may define a default connection.
|
*/
'default' => env('QUEUE_CONNECTION', 'sync'),
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection information for each server that
| is used by your application. A default configuration has been added
| for each back-end shipped with Laravel. You are free to add more.
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
*/
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'table' => 'jobs',
'queue' => 'default',
'retry_after' => 90,
'after_commit' => false,
],
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => 'localhost',
'queue' => 'default',
'retry_after' => 90,
'block_for' => 0,
'after_commit' => false,
],
'sqs' => [
'driver' => 'sqs',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'default'),
'suffix' => env('SQS_SUFFIX'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'after_commit' => false,
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
'queue' => env('REDIS_QUEUE', 'default'),
'retry_after' => 90,
'block_for' => null,
'after_commit' => false,
],
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control which database and table are used to store the jobs that
| have failed. You may change them to any database / table you wish.
|
*/
'failed' => [
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
'database' => env('DB_CONNECTION', 'mysql'),
'table' => 'failed_jobs',
],
];
<?php
use Laravel\Sanctum\Sanctum;
return [
/*
|--------------------------------------------------------------------------
| Stateful Domains
|--------------------------------------------------------------------------
|
| Requests from the following domains / hosts will receive stateful API
| authentication cookies. Typically, these should include your local
| and production domains which access your API via a frontend SPA.
|
*/
'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(
'%s%s',
'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',
Sanctum::currentApplicationUrlWithPort()
))),
/*
|--------------------------------------------------------------------------
| Sanctum Guards
|--------------------------------------------------------------------------
|
| This array contains the authentication guards that will be checked when
| Sanctum is trying to authenticate a request. If none of these guards
| are able to authenticate the request, Sanctum will use the bearer
| token that's present on an incoming request for authentication.
|
*/
'guard' => ['web'],
/*
|--------------------------------------------------------------------------
| Expiration Minutes
|--------------------------------------------------------------------------
|
| This value controls the number of minutes until an issued token will be
| considered expired. If this value is null, personal access tokens do
| not expire. This won't tweak the lifetime of first-party sessions.
|
*/
'expiration' => null,
/*
|--------------------------------------------------------------------------
| Sanctum Middleware
|--------------------------------------------------------------------------
|
| When authenticating your first-party SPA with Sanctum you may need to
| customize some of the middleware Sanctum uses while processing the
| request. You may change the middleware listed below as required.
|
*/
'middleware' => [
'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class,
'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class,
],
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Mailgun, Postmark, AWS and more. This file provides the de facto
| location for this type of information, allowing packages to have
| a conventional file to locate the various service credentials.
|
*/
'mailgun' => [
'domain' => env('MAILGUN_DOMAIN'),
'secret' => env('MAILGUN_SECRET'),
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
'scheme' => 'https',
],
'postmark' => [
'token' => env('POSTMARK_TOKEN'),
],
'ses' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
];
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option controls the default session "driver" that will be used on
| requests. By default, we will use the lightweight native driver but
| you may specify any of the other wonderful drivers provided here.
|
| Supported: "file", "cookie", "database", "apc",
| "memcached", "redis", "dynamodb", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to immediately expire on the browser closing, set that option.
|
*/
'lifetime' => env('SESSION_LIFETIME', 120),
'expire_on_close' => false,
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it is stored. All encryption will be run
| automatically by Laravel and you can use the Session like normal.
|
*/
'encrypt' => false,
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When using the native session driver, we need a location where session
| files may be stored. A default has been set for you but a different
| location may be specified. This is only needed for file sessions.
|
*/
'files' => storage_path('framework/sessions'),
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
'connection' => env('SESSION_CONNECTION'),
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table we
| should use to manage the sessions. Of course, a sensible default is
| provided for you; however, you are free to change this as needed.
|
*/
'table' => 'sessions',
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| While using one of the framework's cache driven session backends you may
| list a cache store that should be used for these sessions. This value
| must match with one of the application's configured cache "stores".
|
| Affects: "apc", "dynamodb", "memcached", "redis"
|
*/
'store' => env('SESSION_STORE'),
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
'lottery' => [2, 100],
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the cookie used to identify a session
| instance by ID. The name specified here will get used every time a
| new session cookie is created by the framework for every driver.
|
*/
'cookie' => env(
'SESSION_COOKIE',
Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
),
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application but you are free to change this when necessary.
|
*/
'path' => '/',
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| Here you may change the domain of the cookie used to identify a session
| in your application. This will determine which domains the cookie is
| available to in your application. A sensible default has been set.
|
*/
'domain' => env('SESSION_DOMAIN'),
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you when it can't be done securely.
|
*/
'secure' => env('SESSION_SECURE_COOKIE'),
/*
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| Setting this value to true will prevent JavaScript from accessing the
| value of the cookie and the cookie will only be accessible through
| the HTTP protocol. You are free to modify this option if needed.
|
*/
'http_only' => true,
/*
|--------------------------------------------------------------------------
| Same-Site Cookies
|--------------------------------------------------------------------------
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| will set this value to "lax" since this is a secure default value.
|
| Supported: "lax", "strict", "none", null
|
*/
'same_site' => 'lax',
];
<?php
return [
/*
|--------------------------------------------------------------------------
| dcat-admin name
|--------------------------------------------------------------------------
|
| This value is the name of dcat-admin, This setting is displayed on the
| login page.
|
*/
'name' => '商家后台',
/*
|--------------------------------------------------------------------------
| dcat-admin logo
|--------------------------------------------------------------------------
|
| The logo of all admin pages. You can also set it as an image by using a
| `img` tag, eg '<img src="http://logo-url" alt="Admin logo">'.
|
*/
'logo' => '<img src="/vendor/dcat-admin/images/logo.png" width="35"> &nbsp;商家后台',
/*
|--------------------------------------------------------------------------
| dcat-admin mini logo
|--------------------------------------------------------------------------
|
| The logo of all admin pages when the sidebar menu is collapsed. You can
| also set it as an image by using a `img` tag, eg
| '<img src="http://logo-url" alt="Admin logo">'.
|
*/
'logo-mini' => '<img src="/vendor/dcat-admin/images/logo.png">',
/*
|--------------------------------------------------------------------------
| dcat-admin favicon
|--------------------------------------------------------------------------
|
*/
'favicon' => null,
/*
|--------------------------------------------------------------------------
| User default avatar
|--------------------------------------------------------------------------
|
| Set a default avatar for newly created users.
|
*/
'default_avatar' => '@admin/images/default-avatar.jpg',
/*
|--------------------------------------------------------------------------
| dcat-admin route settings
|--------------------------------------------------------------------------
|
| The routing configuration of the admin page, including the path prefix,
| the controller namespace, and the default middleware. If you want to
| access through the root path, just set the prefix to empty string.
|
*/
'route' => [
'domain' => env('ADMIN_STORE_ROUTE_DOMAIN'),
'prefix' => '',
'namespace' => 'App\\Store\\Controllers',
'middleware' => ['web', 'admin'],
],
/*
|--------------------------------------------------------------------------
| dcat-admin install directory
|--------------------------------------------------------------------------
|
| The installation directory of the controller and routing configuration
| files of the administration page. The default is `app/Admin`, which must
| be set before running `artisan admin::install` to take effect.
|
*/
'directory' => app_path('Store'),
/*
|--------------------------------------------------------------------------
| dcat-admin html title
|--------------------------------------------------------------------------
|
| Html title for all pages.
|
*/
'title' => 'Admin',
/*
|--------------------------------------------------------------------------
| Assets hostname
|--------------------------------------------------------------------------
|
*/
'assets_server' => env('ADMIN_ASSETS_SERVER'),
/*
|--------------------------------------------------------------------------
| Access via `https`
|--------------------------------------------------------------------------
|
| If your page is going to be accessed via https, set it to `true`.
|
*/
'https' => env('ADMIN_HTTPS', false),
/*
|--------------------------------------------------------------------------
| dcat-admin auth setting
|--------------------------------------------------------------------------
|
| Authentication settings for all admin pages. Include an authentication
| guard and a user provider setting of authentication driver.
|
| You can specify a controller for `login` `logout` and other auth routes.
|
*/
'auth' => [
'enable' => true,
'controller' => App\Store\Controllers\AuthController::class,
'guard' => 'store',
'guards' => [
'store' => [
'driver' => 'session',
'provider' => 'store',
],
],
'providers' => [
'store' => [
'driver' => 'eloquent',
'model' => App\Store\Models\Administrator::class,
],
],
// Add "remember me" to login form
'remember' => true,
// All method to path like: auth/users/*/edit
// or specific method to path like: get:auth/users.
'except' => [
'auth/login',
'auth/logout',
],
],
/*
|--------------------------------------------------------------------------
| The global Grid setting
|--------------------------------------------------------------------------
*/
'grid' => [
// The global Grid action display class.
'grid_action_class' => Dcat\Admin\Grid\Displayers\DropdownActions::class,
// The global Grid batch action display class.
'batch_action_class' => Dcat\Admin\Grid\Tools\BatchActions::class,
// The global Grid pagination display class.
'paginator_class' => Dcat\Admin\Grid\Tools\Paginator::class,
'actions' => [
'view' => Dcat\Admin\Grid\Actions\Show::class,
'edit' => Dcat\Admin\Grid\Actions\Edit::class,
'quick_edit' => Dcat\Admin\Grid\Actions\QuickEdit::class,
'delete' => Dcat\Admin\Grid\Actions\Delete::class,
'batch_delete' => Dcat\Admin\Grid\Tools\BatchDelete::class,
],
// The global Grid column selector setting.
'column_selector' => [
'store' => Dcat\Admin\Grid\ColumnSelector\SessionStore::class,
'store_params' => [
'driver' => 'file',
],
],
],
/*
|--------------------------------------------------------------------------
| dcat-admin helpers setting.
|--------------------------------------------------------------------------
*/
'helpers' => [
'enable' => false,
],
/*
|--------------------------------------------------------------------------
| dcat-admin permission setting
|--------------------------------------------------------------------------
|
| Permission settings for all admin pages.
|
*/
'permission' => [
// Whether enable permission.
'enable' => true,
// All method to path like: auth/users/*/edit
// or specific method to path like: get:auth/users.
'except' => [
'/',
'auth/login',
'auth/logout',
'auth/setting',
],
],
/*
|--------------------------------------------------------------------------
| dcat-admin menu setting
|--------------------------------------------------------------------------
|
*/
'menu' => [
'cache' => [
// enable cache or not
'enable' => false,
'store' => 'file',
],
// Whether enable menu bind to a permission.
'bind_permission' => true,
// Whether enable role bind to menu.
'role_bind_menu' => true,
// Whether enable permission bind to menu.
'permission_bind_menu' => true,
'default_icon' => 'feather icon-circle',
],
/*
|--------------------------------------------------------------------------
| dcat-admin upload setting
|--------------------------------------------------------------------------
|
| File system configuration for form upload files and images, including
| disk and upload path.
|
*/
'upload' => [
// Disk in `config/filesystem.php`.
'disk' => 'public',
// Image and file upload path under the disk above.
'directory' => [
'image' => 'images',
'file' => 'files',
],
],
/*
|--------------------------------------------------------------------------
| dcat-admin database settings
|--------------------------------------------------------------------------
|
| Here are database settings for dcat-admin builtin model & tables.
|
*/
'database' => [
// Database connection for following tables.
'connection' => '',
// User tables and model.
'users_table' => 'store_admin_users',
'users_model' => \App\Store\Models\Administrator::class,
// Role table and model.
'roles_table' => 'store_admin_roles',
'roles_model' => \App\Store\Models\Role::class,
// Permission table and model.
'permissions_table' => 'store_admin_permissions',
'permissions_model' => \App\Store\Models\Permission::class,
// Menu table and model.
'menu_table' => 'store_admin_menu',
'menu_model' => \App\Store\Models\Menu::class,
// Pivot table for table above.
'role_users_table' => 'store_admin_role_users',
'role_permissions_table' => 'store_admin_role_permissions',
'role_menu_table' => 'store_admin_role_menu',
'permission_menu_table' => 'store_admin_permission_menu',
'settings_table' => 'store_admin_settings',
'extensions_table' => 'store_admin_extensions',
'extension_histories_table' => 'store_admin_extension_histories',
],
/*
|--------------------------------------------------------------------------
| Application layout
|--------------------------------------------------------------------------
|
| This value is the layout of admin pages.
*/
'layout' => [
// default, blue, blue-light, green
'color' => 'default',
// sidebar-separate
'body_class' => [],
'horizontal_menu' => false,
'sidebar_collapsed' => false,
// light, primary, dark
'sidebar_style' => 'light',
'dark_mode_switch' => false,
// bg-primary, bg-info, bg-warning, bg-success, bg-danger, bg-dark
'navbar_color' => '',
],
/*
|--------------------------------------------------------------------------
| The exception handler class
|--------------------------------------------------------------------------
|
*/
'exception_handler' => Dcat\Admin\Exception\Handler::class,
/*
|--------------------------------------------------------------------------
| Enable default breadcrumb
|--------------------------------------------------------------------------
|
| Whether enable default breadcrumb for every page content.
*/
'enable_default_breadcrumb' => true,
];
<?php
return [
/*
|--------------------------------------------------------------------------
| View Storage Paths
|--------------------------------------------------------------------------
|
| Most templating systems load templates from disk. Here you may specify
| an array of paths that should be checked for your views. Of course
| the usual Laravel view path has already been registered for you.
|
*/
'paths' => [
resource_path('views'),
],
/*
|--------------------------------------------------------------------------
| Compiled View Path
|--------------------------------------------------------------------------
|
| This option determines where all the compiled Blade templates will be
| stored for your application. Typically, this is within the storage
| directory. However, as usual, you are free to change this value.
|
*/
'compiled' => env(
'VIEW_COMPILED_PATH',
realpath(storage_path('framework/views'))
),
];
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateAdminTables extends Migration
{
public function getConnection()
{
return $this->config('database.connection') ?: config('database.default');
}
public function config($key)
{
return config('admin.'.$key);
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create($this->config('database.users_table'), function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('username', 120)->unique();
$table->string('password', 80);
$table->string('name');
$table->string('avatar')->nullable();
$table->string('remember_token', 100)->nullable();
$table->timestamps();
});
Schema::create($this->config('database.roles_table'), function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name', 50);
$table->string('slug', 50)->unique();
$table->timestamps();
});
Schema::create($this->config('database.permissions_table'), function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name', 50);
$table->string('slug', 50)->unique();
$table->string('http_method')->nullable();
$table->text('http_path')->nullable();
$table->integer('order')->default(0);
$table->bigInteger('parent_id')->default(0);
$table->timestamps();
});
Schema::create($this->config('database.menu_table'), function (Blueprint $table) {
$table->bigIncrements('id');
$table->bigInteger('parent_id')->default(0);
$table->integer('order')->default(0);
$table->string('title', 50);
$table->string('icon', 50)->nullable();
$table->string('uri', 50)->nullable();
$table->timestamps();
});
Schema::create($this->config('database.role_users_table'), function (Blueprint $table) {
$table->bigInteger('role_id');
$table->bigInteger('user_id');
$table->unique(['role_id', 'user_id']);
$table->timestamps();
});
Schema::create($this->config('database.role_permissions_table'), function (Blueprint $table) {
$table->bigInteger('role_id');
$table->bigInteger('permission_id');
$table->unique(['role_id', 'permission_id']);
$table->timestamps();
});
Schema::create($this->config('database.role_menu_table'), function (Blueprint $table) {
$table->bigInteger('role_id');
$table->bigInteger('menu_id');
$table->unique(['role_id', 'menu_id']);
$table->timestamps();
});
Schema::create($this->config('database.permission_menu_table'), function (Blueprint $table) {
$table->bigInteger('permission_id');
$table->bigInteger('menu_id');
$table->unique(['permission_id', 'menu_id']);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists($this->config('database.users_table'));
Schema::dropIfExists($this->config('database.roles_table'));
Schema::dropIfExists($this->config('database.permissions_table'));
Schema::dropIfExists($this->config('database.menu_table'));
Schema::dropIfExists($this->config('database.role_users_table'));
Schema::dropIfExists($this->config('database.role_permissions_table'));
Schema::dropIfExists($this->config('database.role_menu_table'));
Schema::dropIfExists($this->config('database.permission_menu_table'));
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateAdminSettingsTable extends Migration
{
public function getConnection()
{
return $this->config('database.connection') ?: config('database.default');
}
public function config($key)
{
return config('admin.'.$key);
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create($this->config('database.settings_table') ?: 'admin_settings', function (Blueprint $table) {
$table->string('slug', 100)->primary();
$table->longText('value');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists($this->config('database.settings_table') ?: 'admin_settings');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateAdminExtensionsTable extends Migration
{
public function getConnection()
{
return $this->config('database.connection') ?: config('database.default');
}
public function config($key)
{
return config('admin.'.$key);
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create($this->config('database.extensions_table') ?: 'admin_extensions', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->string('name', 100)->unique();
$table->string('version', 20)->default('');
$table->tinyInteger('is_enabled')->default(0);
$table->text('options')->nullable();
$table->timestamps();
$table->engine = 'InnoDB';
});
Schema::create($this->config('database.extension_histories_table') ?: 'admin_extension_histories', function (Blueprint $table) {
$table->bigIncrements('id')->unsigned();
$table->string('name', 100);
$table->tinyInteger('type')->default(1);
$table->string('version', 20)->default(0);
$table->text('detail')->nullable();
$table->index('name');
$table->timestamps();
$table->engine = 'InnoDB';
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists($this->config('database.extensions_table') ?: 'admin_extensions');
Schema::dropIfExists($this->config('database.extension_histories_table') ?: 'admin_extension_histories');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UpdateAdminMenuTable extends Migration
{
public function getConnection()
{
return $this->config('database.connection') ?: config('database.default');
}
public function config($key)
{
return config('admin.'.$key);
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table($this->config('database.menu_table'), function (Blueprint $table) {
$table->tinyInteger('show')->default(1)->after('uri');
$table->string('extension', 50)->default('')->after('uri');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table($this->config('database.menu_table'), function (Blueprint $table) {
$table->dropColumn('show');
$table->dropColumn('extension');
});
}
}
<?php
/**
* A helper file for Dcat Admin, to provide autocomplete information to your IDE
*
* This file should not be included in your code, only analyzed by your IDE!
*
* @author jqh <841324345@qq.com>
*/
namespace Dcat\Admin {
use Illuminate\Support\Collection;
/**
* @property Grid\Column|Collection id
* @property Grid\Column|Collection created_at
* @property Grid\Column|Collection updated_at
* @property Grid\Column|Collection content
* @property Grid\Column|Collection attr_val
* @property Grid\Column|Collection attr_sn
* @property Grid\Column|Collection name
* @property Grid\Column|Collection type
* @property Grid\Column|Collection version
* @property Grid\Column|Collection detail
* @property Grid\Column|Collection is_enabled
* @property Grid\Column|Collection parent_id
* @property Grid\Column|Collection order
* @property Grid\Column|Collection icon
* @property Grid\Column|Collection uri
* @property Grid\Column|Collection extension
* @property Grid\Column|Collection permission_id
* @property Grid\Column|Collection menu_id
* @property Grid\Column|Collection slug
* @property Grid\Column|Collection http_method
* @property Grid\Column|Collection http_path
* @property Grid\Column|Collection role_id
* @property Grid\Column|Collection user_id
* @property Grid\Column|Collection value
* @property Grid\Column|Collection status
* @property Grid\Column|Collection starttime
* @property Grid\Column|Collection endtime
* @property Grid\Column|Collection username
* @property Grid\Column|Collection password
* @property Grid\Column|Collection avatar
* @property Grid\Column|Collection remember_token
* @property Grid\Column|Collection cate_1
* @property Grid\Column|Collection cate_2
* @property Grid\Column|Collection cate_3
* @property Grid\Column|Collection cate_4
* @property Grid\Column|Collection characteristic
* @property Grid\Column|Collection brand_level
* @property Grid\Column|Collection brand_id
* @property Grid\Column|Collection company
* @property Grid\Column|Collection goods
* @property Grid\Column|Collection contacts
* @property Grid\Column|Collection img_url
* @property Grid\Column|Collection deleted_at
* @property Grid\Column|Collection sku
* @property Grid\Column|Collection cat_id
* @property Grid\Column|Collection cover
* @property Grid\Column|Collection is_show
* @property Grid\Column|Collection imgUrl
* @property Grid\Column|Collection city_id
* @property Grid\Column|Collection level
* @property Grid\Column|Collection area_code
* @property Grid\Column|Collection merger_name
* @property Grid\Column|Collection lng
* @property Grid\Column|Collection lat
* @property Grid\Column|Collection pinyin_prefix
* @property Grid\Column|Collection pinyin
* @property Grid\Column|Collection nickname
* @property Grid\Column|Collection phone
* @property Grid\Column|Collection goods_id
* @property Grid\Column|Collection star
* @property Grid\Column|Collection addtime
* @property Grid\Column|Collection uuid
* @property Grid\Column|Collection connection
* @property Grid\Column|Collection queue
* @property Grid\Column|Collection payload
* @property Grid\Column|Collection exception
* @property Grid\Column|Collection failed_at
* @property Grid\Column|Collection partner_trade_no
* @property Grid\Column|Collection out_batch_no
* @property Grid\Column|Collection batch_id
* @property Grid\Column|Collection batch_status
* @property Grid\Column|Collection transfer_detail_status
* @property Grid\Column|Collection amount
* @property Grid\Column|Collection remark
* @property Grid\Column|Collection query_times
* @property Grid\Column|Collection brief
* @property Grid\Column|Collection code
* @property Grid\Column|Collection goods_sn
* @property Grid\Column|Collection goods_name
* @property Grid\Column|Collection sale
* @property Grid\Column|Collection goods_price
* @property Grid\Column|Collection keywords
* @property Grid\Column|Collection goods_brief
* @property Grid\Column|Collection goods_desc
* @property Grid\Column|Collection cover_img
* @property Grid\Column|Collection carousel
* @property Grid\Column|Collection sort_order
* @property Grid\Column|Collection high_opinion
* @property Grid\Column|Collection product_no
* @property Grid\Column|Collection material
* @property Grid\Column|Collection box_size
* @property Grid\Column|Collection first_commission
* @property Grid\Column|Collection second_commission
* @property Grid\Column|Collection merchant_commission
* @property Grid\Column|Collection supplier
* @property Grid\Column|Collection su_phone
* @property Grid\Column|Collection is_hot
* @property Grid\Column|Collection jd_url
* @property Grid\Column|Collection sort
* @property Grid\Column|Collection market_price
* @property Grid\Column|Collection stock
* @property Grid\Column|Collection cg_price
* @property Grid\Column|Collection contact
* @property Grid\Column|Collection is_type
* @property Grid\Column|Collection order_id
* @property Grid\Column|Collection goods_number
* @property Grid\Column|Collection goods_attr
* @property Grid\Column|Collection goods_img
* @property Grid\Column|Collection attr_id
* @property Grid\Column|Collection order_sn
* @property Grid\Column|Collection merchant_id
* @property Grid\Column|Collection order_amount
* @property Grid\Column|Collection order_status
* @property Grid\Column|Collection pay_status
* @property Grid\Column|Collection service_status
* @property Grid\Column|Collection consignee
* @property Grid\Column|Collection address
* @property Grid\Column|Collection mobile
* @property Grid\Column|Collection shipping_name
* @property Grid\Column|Collection shipping_code
* @property Grid\Column|Collection shipping_status
* @property Grid\Column|Collection verification_at
* @property Grid\Column|Collection verification_code
* @property Grid\Column|Collection address_id
* @property Grid\Column|Collection store_id
* @property Grid\Column|Collection pay_cs
* @property Grid\Column|Collection order_record
* @property Grid\Column|Collection goods_amount
* @property Grid\Column|Collection delivery_type
* @property Grid\Column|Collection event
* @property Grid\Column|Collection times
* @property Grid\Column|Collection ip
* @property Grid\Column|Collection createtime
* @property Grid\Column|Collection hot_kw
* @property Grid\Column|Collection bj_invite
* @property Grid\Column|Collection cp_brief
* @property Grid\Column|Collection uid
* @property Grid\Column|Collection account
* @property Grid\Column|Collection pwd
* @property Grid\Column|Collection province_id
* @property Grid\Column|Collection buycode
* @property Grid\Column|Collection mgs_id
* @property Grid\Column|Collection attr_name
* @property Grid\Column|Collection merchant
* @property Grid\Column|Collection change
* @property Grid\Column|Collection merchant_name
* @property Grid\Column|Collection order_price
* @property Grid\Column|Collection divide_price
* @property Grid\Column|Collection proportion
* @property Grid\Column|Collection shuid
* @property Grid\Column|Collection sh_type
* @property Grid\Column|Collection pay_type
* @property Grid\Column|Collection other_order
* @property Grid\Column|Collection money
* @property Grid\Column|Collection tokenable_type
* @property Grid\Column|Collection tokenable_id
* @property Grid\Column|Collection token
* @property Grid\Column|Collection abilities
* @property Grid\Column|Collection last_used_at
* @property Grid\Column|Collection expires_at
* @property Grid\Column|Collection lat_lng
* @property Grid\Column|Collection distance
* @property Grid\Column|Collection business_license
* @property Grid\Column|Collection area
* @property Grid\Column|Collection is_default
* @property Grid\Column|Collection before_code
* @property Grid\Column|Collection after_code
* @property Grid\Column|Collection openid
* @property Grid\Column|Collection role
* @property Grid\Column|Collection department
* @property Grid\Column|Collection permissions
* @property Grid\Column|Collection email
* @property Grid\Column|Collection email_verified_at
* @property Grid\Column|Collection score
* @property Grid\Column|Collection balance
* @property Grid\Column|Collection shopping_cart
* @property Grid\Column|Collection spuid
* @property Grid\Column|Collection second_spuid
* @property Grid\Column|Collection check_id
* @property Grid\Column|Collection store_admin_users_id
*
* @method Grid\Column|Collection id(string $label = null)
* @method Grid\Column|Collection created_at(string $label = null)
* @method Grid\Column|Collection updated_at(string $label = null)
* @method Grid\Column|Collection content(string $label = null)
* @method Grid\Column|Collection attr_val(string $label = null)
* @method Grid\Column|Collection attr_sn(string $label = null)
* @method Grid\Column|Collection name(string $label = null)
* @method Grid\Column|Collection type(string $label = null)
* @method Grid\Column|Collection version(string $label = null)
* @method Grid\Column|Collection detail(string $label = null)
* @method Grid\Column|Collection is_enabled(string $label = null)
* @method Grid\Column|Collection parent_id(string $label = null)
* @method Grid\Column|Collection order(string $label = null)
* @method Grid\Column|Collection icon(string $label = null)
* @method Grid\Column|Collection uri(string $label = null)
* @method Grid\Column|Collection extension(string $label = null)
* @method Grid\Column|Collection permission_id(string $label = null)
* @method Grid\Column|Collection menu_id(string $label = null)
* @method Grid\Column|Collection slug(string $label = null)
* @method Grid\Column|Collection http_method(string $label = null)
* @method Grid\Column|Collection http_path(string $label = null)
* @method Grid\Column|Collection role_id(string $label = null)
* @method Grid\Column|Collection user_id(string $label = null)
* @method Grid\Column|Collection value(string $label = null)
* @method Grid\Column|Collection status(string $label = null)
* @method Grid\Column|Collection starttime(string $label = null)
* @method Grid\Column|Collection endtime(string $label = null)
* @method Grid\Column|Collection username(string $label = null)
* @method Grid\Column|Collection password(string $label = null)
* @method Grid\Column|Collection avatar(string $label = null)
* @method Grid\Column|Collection remember_token(string $label = null)
* @method Grid\Column|Collection cate_1(string $label = null)
* @method Grid\Column|Collection cate_2(string $label = null)
* @method Grid\Column|Collection cate_3(string $label = null)
* @method Grid\Column|Collection cate_4(string $label = null)
* @method Grid\Column|Collection characteristic(string $label = null)
* @method Grid\Column|Collection brand_level(string $label = null)
* @method Grid\Column|Collection brand_id(string $label = null)
* @method Grid\Column|Collection company(string $label = null)
* @method Grid\Column|Collection goods(string $label = null)
* @method Grid\Column|Collection contacts(string $label = null)
* @method Grid\Column|Collection img_url(string $label = null)
* @method Grid\Column|Collection deleted_at(string $label = null)
* @method Grid\Column|Collection sku(string $label = null)
* @method Grid\Column|Collection cat_id(string $label = null)
* @method Grid\Column|Collection cover(string $label = null)
* @method Grid\Column|Collection is_show(string $label = null)
* @method Grid\Column|Collection imgUrl(string $label = null)
* @method Grid\Column|Collection city_id(string $label = null)
* @method Grid\Column|Collection level(string $label = null)
* @method Grid\Column|Collection area_code(string $label = null)
* @method Grid\Column|Collection merger_name(string $label = null)
* @method Grid\Column|Collection lng(string $label = null)
* @method Grid\Column|Collection lat(string $label = null)
* @method Grid\Column|Collection pinyin_prefix(string $label = null)
* @method Grid\Column|Collection pinyin(string $label = null)
* @method Grid\Column|Collection nickname(string $label = null)
* @method Grid\Column|Collection phone(string $label = null)
* @method Grid\Column|Collection goods_id(string $label = null)
* @method Grid\Column|Collection star(string $label = null)
* @method Grid\Column|Collection addtime(string $label = null)
* @method Grid\Column|Collection uuid(string $label = null)
* @method Grid\Column|Collection connection(string $label = null)
* @method Grid\Column|Collection queue(string $label = null)
* @method Grid\Column|Collection payload(string $label = null)
* @method Grid\Column|Collection exception(string $label = null)
* @method Grid\Column|Collection failed_at(string $label = null)
* @method Grid\Column|Collection partner_trade_no(string $label = null)
* @method Grid\Column|Collection out_batch_no(string $label = null)
* @method Grid\Column|Collection batch_id(string $label = null)
* @method Grid\Column|Collection batch_status(string $label = null)
* @method Grid\Column|Collection transfer_detail_status(string $label = null)
* @method Grid\Column|Collection amount(string $label = null)
* @method Grid\Column|Collection remark(string $label = null)
* @method Grid\Column|Collection query_times(string $label = null)
* @method Grid\Column|Collection brief(string $label = null)
* @method Grid\Column|Collection code(string $label = null)
* @method Grid\Column|Collection goods_sn(string $label = null)
* @method Grid\Column|Collection goods_name(string $label = null)
* @method Grid\Column|Collection sale(string $label = null)
* @method Grid\Column|Collection goods_price(string $label = null)
* @method Grid\Column|Collection keywords(string $label = null)
* @method Grid\Column|Collection goods_brief(string $label = null)
* @method Grid\Column|Collection goods_desc(string $label = null)
* @method Grid\Column|Collection cover_img(string $label = null)
* @method Grid\Column|Collection carousel(string $label = null)
* @method Grid\Column|Collection sort_order(string $label = null)
* @method Grid\Column|Collection high_opinion(string $label = null)
* @method Grid\Column|Collection product_no(string $label = null)
* @method Grid\Column|Collection material(string $label = null)
* @method Grid\Column|Collection box_size(string $label = null)
* @method Grid\Column|Collection first_commission(string $label = null)
* @method Grid\Column|Collection second_commission(string $label = null)
* @method Grid\Column|Collection merchant_commission(string $label = null)
* @method Grid\Column|Collection supplier(string $label = null)
* @method Grid\Column|Collection su_phone(string $label = null)
* @method Grid\Column|Collection is_hot(string $label = null)
* @method Grid\Column|Collection jd_url(string $label = null)
* @method Grid\Column|Collection sort(string $label = null)
* @method Grid\Column|Collection market_price(string $label = null)
* @method Grid\Column|Collection stock(string $label = null)
* @method Grid\Column|Collection cg_price(string $label = null)
* @method Grid\Column|Collection contact(string $label = null)
* @method Grid\Column|Collection is_type(string $label = null)
* @method Grid\Column|Collection order_id(string $label = null)
* @method Grid\Column|Collection goods_number(string $label = null)
* @method Grid\Column|Collection goods_attr(string $label = null)
* @method Grid\Column|Collection goods_img(string $label = null)
* @method Grid\Column|Collection attr_id(string $label = null)
* @method Grid\Column|Collection order_sn(string $label = null)
* @method Grid\Column|Collection merchant_id(string $label = null)
* @method Grid\Column|Collection order_amount(string $label = null)
* @method Grid\Column|Collection order_status(string $label = null)
* @method Grid\Column|Collection pay_status(string $label = null)
* @method Grid\Column|Collection service_status(string $label = null)
* @method Grid\Column|Collection consignee(string $label = null)
* @method Grid\Column|Collection address(string $label = null)
* @method Grid\Column|Collection mobile(string $label = null)
* @method Grid\Column|Collection shipping_name(string $label = null)
* @method Grid\Column|Collection shipping_code(string $label = null)
* @method Grid\Column|Collection shipping_status(string $label = null)
* @method Grid\Column|Collection verification_at(string $label = null)
* @method Grid\Column|Collection verification_code(string $label = null)
* @method Grid\Column|Collection address_id(string $label = null)
* @method Grid\Column|Collection store_id(string $label = null)
* @method Grid\Column|Collection pay_cs(string $label = null)
* @method Grid\Column|Collection order_record(string $label = null)
* @method Grid\Column|Collection goods_amount(string $label = null)
* @method Grid\Column|Collection delivery_type(string $label = null)
* @method Grid\Column|Collection event(string $label = null)
* @method Grid\Column|Collection times(string $label = null)
* @method Grid\Column|Collection ip(string $label = null)
* @method Grid\Column|Collection createtime(string $label = null)
* @method Grid\Column|Collection hot_kw(string $label = null)
* @method Grid\Column|Collection bj_invite(string $label = null)
* @method Grid\Column|Collection cp_brief(string $label = null)
* @method Grid\Column|Collection uid(string $label = null)
* @method Grid\Column|Collection account(string $label = null)
* @method Grid\Column|Collection pwd(string $label = null)
* @method Grid\Column|Collection province_id(string $label = null)
* @method Grid\Column|Collection buycode(string $label = null)
* @method Grid\Column|Collection mgs_id(string $label = null)
* @method Grid\Column|Collection attr_name(string $label = null)
* @method Grid\Column|Collection merchant(string $label = null)
* @method Grid\Column|Collection change(string $label = null)
* @method Grid\Column|Collection merchant_name(string $label = null)
* @method Grid\Column|Collection order_price(string $label = null)
* @method Grid\Column|Collection divide_price(string $label = null)
* @method Grid\Column|Collection proportion(string $label = null)
* @method Grid\Column|Collection shuid(string $label = null)
* @method Grid\Column|Collection sh_type(string $label = null)
* @method Grid\Column|Collection pay_type(string $label = null)
* @method Grid\Column|Collection other_order(string $label = null)
* @method Grid\Column|Collection money(string $label = null)
* @method Grid\Column|Collection tokenable_type(string $label = null)
* @method Grid\Column|Collection tokenable_id(string $label = null)
* @method Grid\Column|Collection token(string $label = null)
* @method Grid\Column|Collection abilities(string $label = null)
* @method Grid\Column|Collection last_used_at(string $label = null)
* @method Grid\Column|Collection expires_at(string $label = null)
* @method Grid\Column|Collection lat_lng(string $label = null)
* @method Grid\Column|Collection distance(string $label = null)
* @method Grid\Column|Collection business_license(string $label = null)
* @method Grid\Column|Collection area(string $label = null)
* @method Grid\Column|Collection is_default(string $label = null)
* @method Grid\Column|Collection before_code(string $label = null)
* @method Grid\Column|Collection after_code(string $label = null)
* @method Grid\Column|Collection openid(string $label = null)
* @method Grid\Column|Collection role(string $label = null)
* @method Grid\Column|Collection department(string $label = null)
* @method Grid\Column|Collection permissions(string $label = null)
* @method Grid\Column|Collection email(string $label = null)
* @method Grid\Column|Collection email_verified_at(string $label = null)
* @method Grid\Column|Collection score(string $label = null)
* @method Grid\Column|Collection balance(string $label = null)
* @method Grid\Column|Collection shopping_cart(string $label = null)
* @method Grid\Column|Collection spuid(string $label = null)
* @method Grid\Column|Collection second_spuid(string $label = null)
* @method Grid\Column|Collection check_id(string $label = null)
* @method Grid\Column|Collection store_admin_users_id(string $label = null)
*/
class Grid {}
class MiniGrid extends Grid {}
/**
* @property Show\Field|Collection id
* @property Show\Field|Collection created_at
* @property Show\Field|Collection updated_at
* @property Show\Field|Collection content
* @property Show\Field|Collection attr_val
* @property Show\Field|Collection attr_sn
* @property Show\Field|Collection name
* @property Show\Field|Collection type
* @property Show\Field|Collection version
* @property Show\Field|Collection detail
* @property Show\Field|Collection is_enabled
* @property Show\Field|Collection parent_id
* @property Show\Field|Collection order
* @property Show\Field|Collection icon
* @property Show\Field|Collection uri
* @property Show\Field|Collection extension
* @property Show\Field|Collection permission_id
* @property Show\Field|Collection menu_id
* @property Show\Field|Collection slug
* @property Show\Field|Collection http_method
* @property Show\Field|Collection http_path
* @property Show\Field|Collection role_id
* @property Show\Field|Collection user_id
* @property Show\Field|Collection value
* @property Show\Field|Collection status
* @property Show\Field|Collection starttime
* @property Show\Field|Collection endtime
* @property Show\Field|Collection username
* @property Show\Field|Collection password
* @property Show\Field|Collection avatar
* @property Show\Field|Collection remember_token
* @property Show\Field|Collection cate_1
* @property Show\Field|Collection cate_2
* @property Show\Field|Collection cate_3
* @property Show\Field|Collection cate_4
* @property Show\Field|Collection characteristic
* @property Show\Field|Collection brand_level
* @property Show\Field|Collection brand_id
* @property Show\Field|Collection company
* @property Show\Field|Collection goods
* @property Show\Field|Collection contacts
* @property Show\Field|Collection img_url
* @property Show\Field|Collection deleted_at
* @property Show\Field|Collection sku
* @property Show\Field|Collection cat_id
* @property Show\Field|Collection cover
* @property Show\Field|Collection is_show
* @property Show\Field|Collection imgUrl
* @property Show\Field|Collection city_id
* @property Show\Field|Collection level
* @property Show\Field|Collection area_code
* @property Show\Field|Collection merger_name
* @property Show\Field|Collection lng
* @property Show\Field|Collection lat
* @property Show\Field|Collection pinyin_prefix
* @property Show\Field|Collection pinyin
* @property Show\Field|Collection nickname
* @property Show\Field|Collection phone
* @property Show\Field|Collection goods_id
* @property Show\Field|Collection star
* @property Show\Field|Collection addtime
* @property Show\Field|Collection uuid
* @property Show\Field|Collection connection
* @property Show\Field|Collection queue
* @property Show\Field|Collection payload
* @property Show\Field|Collection exception
* @property Show\Field|Collection failed_at
* @property Show\Field|Collection partner_trade_no
* @property Show\Field|Collection out_batch_no
* @property Show\Field|Collection batch_id
* @property Show\Field|Collection batch_status
* @property Show\Field|Collection transfer_detail_status
* @property Show\Field|Collection amount
* @property Show\Field|Collection remark
* @property Show\Field|Collection query_times
* @property Show\Field|Collection brief
* @property Show\Field|Collection code
* @property Show\Field|Collection goods_sn
* @property Show\Field|Collection goods_name
* @property Show\Field|Collection sale
* @property Show\Field|Collection goods_price
* @property Show\Field|Collection keywords
* @property Show\Field|Collection goods_brief
* @property Show\Field|Collection goods_desc
* @property Show\Field|Collection cover_img
* @property Show\Field|Collection carousel
* @property Show\Field|Collection sort_order
* @property Show\Field|Collection high_opinion
* @property Show\Field|Collection product_no
* @property Show\Field|Collection material
* @property Show\Field|Collection box_size
* @property Show\Field|Collection first_commission
* @property Show\Field|Collection second_commission
* @property Show\Field|Collection merchant_commission
* @property Show\Field|Collection supplier
* @property Show\Field|Collection su_phone
* @property Show\Field|Collection is_hot
* @property Show\Field|Collection jd_url
* @property Show\Field|Collection sort
* @property Show\Field|Collection market_price
* @property Show\Field|Collection stock
* @property Show\Field|Collection cg_price
* @property Show\Field|Collection contact
* @property Show\Field|Collection is_type
* @property Show\Field|Collection order_id
* @property Show\Field|Collection goods_number
* @property Show\Field|Collection goods_attr
* @property Show\Field|Collection goods_img
* @property Show\Field|Collection attr_id
* @property Show\Field|Collection order_sn
* @property Show\Field|Collection merchant_id
* @property Show\Field|Collection order_amount
* @property Show\Field|Collection order_status
* @property Show\Field|Collection pay_status
* @property Show\Field|Collection service_status
* @property Show\Field|Collection consignee
* @property Show\Field|Collection address
* @property Show\Field|Collection mobile
* @property Show\Field|Collection shipping_name
* @property Show\Field|Collection shipping_code
* @property Show\Field|Collection shipping_status
* @property Show\Field|Collection verification_at
* @property Show\Field|Collection verification_code
* @property Show\Field|Collection address_id
* @property Show\Field|Collection store_id
* @property Show\Field|Collection pay_cs
* @property Show\Field|Collection order_record
* @property Show\Field|Collection goods_amount
* @property Show\Field|Collection delivery_type
* @property Show\Field|Collection event
* @property Show\Field|Collection times
* @property Show\Field|Collection ip
* @property Show\Field|Collection createtime
* @property Show\Field|Collection hot_kw
* @property Show\Field|Collection bj_invite
* @property Show\Field|Collection cp_brief
* @property Show\Field|Collection uid
* @property Show\Field|Collection account
* @property Show\Field|Collection pwd
* @property Show\Field|Collection province_id
* @property Show\Field|Collection buycode
* @property Show\Field|Collection mgs_id
* @property Show\Field|Collection attr_name
* @property Show\Field|Collection merchant
* @property Show\Field|Collection change
* @property Show\Field|Collection merchant_name
* @property Show\Field|Collection order_price
* @property Show\Field|Collection divide_price
* @property Show\Field|Collection proportion
* @property Show\Field|Collection shuid
* @property Show\Field|Collection sh_type
* @property Show\Field|Collection pay_type
* @property Show\Field|Collection other_order
* @property Show\Field|Collection money
* @property Show\Field|Collection tokenable_type
* @property Show\Field|Collection tokenable_id
* @property Show\Field|Collection token
* @property Show\Field|Collection abilities
* @property Show\Field|Collection last_used_at
* @property Show\Field|Collection expires_at
* @property Show\Field|Collection lat_lng
* @property Show\Field|Collection distance
* @property Show\Field|Collection business_license
* @property Show\Field|Collection area
* @property Show\Field|Collection is_default
* @property Show\Field|Collection before_code
* @property Show\Field|Collection after_code
* @property Show\Field|Collection openid
* @property Show\Field|Collection role
* @property Show\Field|Collection department
* @property Show\Field|Collection permissions
* @property Show\Field|Collection email
* @property Show\Field|Collection email_verified_at
* @property Show\Field|Collection score
* @property Show\Field|Collection balance
* @property Show\Field|Collection shopping_cart
* @property Show\Field|Collection spuid
* @property Show\Field|Collection second_spuid
* @property Show\Field|Collection check_id
* @property Show\Field|Collection store_admin_users_id
*
* @method Show\Field|Collection id(string $label = null)
* @method Show\Field|Collection created_at(string $label = null)
* @method Show\Field|Collection updated_at(string $label = null)
* @method Show\Field|Collection content(string $label = null)
* @method Show\Field|Collection attr_val(string $label = null)
* @method Show\Field|Collection attr_sn(string $label = null)
* @method Show\Field|Collection name(string $label = null)
* @method Show\Field|Collection type(string $label = null)
* @method Show\Field|Collection version(string $label = null)
* @method Show\Field|Collection detail(string $label = null)
* @method Show\Field|Collection is_enabled(string $label = null)
* @method Show\Field|Collection parent_id(string $label = null)
* @method Show\Field|Collection order(string $label = null)
* @method Show\Field|Collection icon(string $label = null)
* @method Show\Field|Collection uri(string $label = null)
* @method Show\Field|Collection extension(string $label = null)
* @method Show\Field|Collection permission_id(string $label = null)
* @method Show\Field|Collection menu_id(string $label = null)
* @method Show\Field|Collection slug(string $label = null)
* @method Show\Field|Collection http_method(string $label = null)
* @method Show\Field|Collection http_path(string $label = null)
* @method Show\Field|Collection role_id(string $label = null)
* @method Show\Field|Collection user_id(string $label = null)
* @method Show\Field|Collection value(string $label = null)
* @method Show\Field|Collection status(string $label = null)
* @method Show\Field|Collection starttime(string $label = null)
* @method Show\Field|Collection endtime(string $label = null)
* @method Show\Field|Collection username(string $label = null)
* @method Show\Field|Collection password(string $label = null)
* @method Show\Field|Collection avatar(string $label = null)
* @method Show\Field|Collection remember_token(string $label = null)
* @method Show\Field|Collection cate_1(string $label = null)
* @method Show\Field|Collection cate_2(string $label = null)
* @method Show\Field|Collection cate_3(string $label = null)
* @method Show\Field|Collection cate_4(string $label = null)
* @method Show\Field|Collection characteristic(string $label = null)
* @method Show\Field|Collection brand_level(string $label = null)
* @method Show\Field|Collection brand_id(string $label = null)
* @method Show\Field|Collection company(string $label = null)
* @method Show\Field|Collection goods(string $label = null)
* @method Show\Field|Collection contacts(string $label = null)
* @method Show\Field|Collection img_url(string $label = null)
* @method Show\Field|Collection deleted_at(string $label = null)
* @method Show\Field|Collection sku(string $label = null)
* @method Show\Field|Collection cat_id(string $label = null)
* @method Show\Field|Collection cover(string $label = null)
* @method Show\Field|Collection is_show(string $label = null)
* @method Show\Field|Collection imgUrl(string $label = null)
* @method Show\Field|Collection city_id(string $label = null)
* @method Show\Field|Collection level(string $label = null)
* @method Show\Field|Collection area_code(string $label = null)
* @method Show\Field|Collection merger_name(string $label = null)
* @method Show\Field|Collection lng(string $label = null)
* @method Show\Field|Collection lat(string $label = null)
* @method Show\Field|Collection pinyin_prefix(string $label = null)
* @method Show\Field|Collection pinyin(string $label = null)
* @method Show\Field|Collection nickname(string $label = null)
* @method Show\Field|Collection phone(string $label = null)
* @method Show\Field|Collection goods_id(string $label = null)
* @method Show\Field|Collection star(string $label = null)
* @method Show\Field|Collection addtime(string $label = null)
* @method Show\Field|Collection uuid(string $label = null)
* @method Show\Field|Collection connection(string $label = null)
* @method Show\Field|Collection queue(string $label = null)
* @method Show\Field|Collection payload(string $label = null)
* @method Show\Field|Collection exception(string $label = null)
* @method Show\Field|Collection failed_at(string $label = null)
* @method Show\Field|Collection partner_trade_no(string $label = null)
* @method Show\Field|Collection out_batch_no(string $label = null)
* @method Show\Field|Collection batch_id(string $label = null)
* @method Show\Field|Collection batch_status(string $label = null)
* @method Show\Field|Collection transfer_detail_status(string $label = null)
* @method Show\Field|Collection amount(string $label = null)
* @method Show\Field|Collection remark(string $label = null)
* @method Show\Field|Collection query_times(string $label = null)
* @method Show\Field|Collection brief(string $label = null)
* @method Show\Field|Collection code(string $label = null)
* @method Show\Field|Collection goods_sn(string $label = null)
* @method Show\Field|Collection goods_name(string $label = null)
* @method Show\Field|Collection sale(string $label = null)
* @method Show\Field|Collection goods_price(string $label = null)
* @method Show\Field|Collection keywords(string $label = null)
* @method Show\Field|Collection goods_brief(string $label = null)
* @method Show\Field|Collection goods_desc(string $label = null)
* @method Show\Field|Collection cover_img(string $label = null)
* @method Show\Field|Collection carousel(string $label = null)
* @method Show\Field|Collection sort_order(string $label = null)
* @method Show\Field|Collection high_opinion(string $label = null)
* @method Show\Field|Collection product_no(string $label = null)
* @method Show\Field|Collection material(string $label = null)
* @method Show\Field|Collection box_size(string $label = null)
* @method Show\Field|Collection first_commission(string $label = null)
* @method Show\Field|Collection second_commission(string $label = null)
* @method Show\Field|Collection merchant_commission(string $label = null)
* @method Show\Field|Collection supplier(string $label = null)
* @method Show\Field|Collection su_phone(string $label = null)
* @method Show\Field|Collection is_hot(string $label = null)
* @method Show\Field|Collection jd_url(string $label = null)
* @method Show\Field|Collection sort(string $label = null)
* @method Show\Field|Collection market_price(string $label = null)
* @method Show\Field|Collection stock(string $label = null)
* @method Show\Field|Collection cg_price(string $label = null)
* @method Show\Field|Collection contact(string $label = null)
* @method Show\Field|Collection is_type(string $label = null)
* @method Show\Field|Collection order_id(string $label = null)
* @method Show\Field|Collection goods_number(string $label = null)
* @method Show\Field|Collection goods_attr(string $label = null)
* @method Show\Field|Collection goods_img(string $label = null)
* @method Show\Field|Collection attr_id(string $label = null)
* @method Show\Field|Collection order_sn(string $label = null)
* @method Show\Field|Collection merchant_id(string $label = null)
* @method Show\Field|Collection order_amount(string $label = null)
* @method Show\Field|Collection order_status(string $label = null)
* @method Show\Field|Collection pay_status(string $label = null)
* @method Show\Field|Collection service_status(string $label = null)
* @method Show\Field|Collection consignee(string $label = null)
* @method Show\Field|Collection address(string $label = null)
* @method Show\Field|Collection mobile(string $label = null)
* @method Show\Field|Collection shipping_name(string $label = null)
* @method Show\Field|Collection shipping_code(string $label = null)
* @method Show\Field|Collection shipping_status(string $label = null)
* @method Show\Field|Collection verification_at(string $label = null)
* @method Show\Field|Collection verification_code(string $label = null)
* @method Show\Field|Collection address_id(string $label = null)
* @method Show\Field|Collection store_id(string $label = null)
* @method Show\Field|Collection pay_cs(string $label = null)
* @method Show\Field|Collection order_record(string $label = null)
* @method Show\Field|Collection goods_amount(string $label = null)
* @method Show\Field|Collection delivery_type(string $label = null)
* @method Show\Field|Collection event(string $label = null)
* @method Show\Field|Collection times(string $label = null)
* @method Show\Field|Collection ip(string $label = null)
* @method Show\Field|Collection createtime(string $label = null)
* @method Show\Field|Collection hot_kw(string $label = null)
* @method Show\Field|Collection bj_invite(string $label = null)
* @method Show\Field|Collection cp_brief(string $label = null)
* @method Show\Field|Collection uid(string $label = null)
* @method Show\Field|Collection account(string $label = null)
* @method Show\Field|Collection pwd(string $label = null)
* @method Show\Field|Collection province_id(string $label = null)
* @method Show\Field|Collection buycode(string $label = null)
* @method Show\Field|Collection mgs_id(string $label = null)
* @method Show\Field|Collection attr_name(string $label = null)
* @method Show\Field|Collection merchant(string $label = null)
* @method Show\Field|Collection change(string $label = null)
* @method Show\Field|Collection merchant_name(string $label = null)
* @method Show\Field|Collection order_price(string $label = null)
* @method Show\Field|Collection divide_price(string $label = null)
* @method Show\Field|Collection proportion(string $label = null)
* @method Show\Field|Collection shuid(string $label = null)
* @method Show\Field|Collection sh_type(string $label = null)
* @method Show\Field|Collection pay_type(string $label = null)
* @method Show\Field|Collection other_order(string $label = null)
* @method Show\Field|Collection money(string $label = null)
* @method Show\Field|Collection tokenable_type(string $label = null)
* @method Show\Field|Collection tokenable_id(string $label = null)
* @method Show\Field|Collection token(string $label = null)
* @method Show\Field|Collection abilities(string $label = null)
* @method Show\Field|Collection last_used_at(string $label = null)
* @method Show\Field|Collection expires_at(string $label = null)
* @method Show\Field|Collection lat_lng(string $label = null)
* @method Show\Field|Collection distance(string $label = null)
* @method Show\Field|Collection business_license(string $label = null)
* @method Show\Field|Collection area(string $label = null)
* @method Show\Field|Collection is_default(string $label = null)
* @method Show\Field|Collection before_code(string $label = null)
* @method Show\Field|Collection after_code(string $label = null)
* @method Show\Field|Collection openid(string $label = null)
* @method Show\Field|Collection role(string $label = null)
* @method Show\Field|Collection department(string $label = null)
* @method Show\Field|Collection permissions(string $label = null)
* @method Show\Field|Collection email(string $label = null)
* @method Show\Field|Collection email_verified_at(string $label = null)
* @method Show\Field|Collection score(string $label = null)
* @method Show\Field|Collection balance(string $label = null)
* @method Show\Field|Collection shopping_cart(string $label = null)
* @method Show\Field|Collection spuid(string $label = null)
* @method Show\Field|Collection second_spuid(string $label = null)
* @method Show\Field|Collection check_id(string $label = null)
* @method Show\Field|Collection store_admin_users_id(string $label = null)
*/
class Show {}
/**
* @method \Dcat\Admin\Extension\EasySku\SkuField sku(...$params)
*/
class Form {}
}
namespace Dcat\Admin\Grid {
/**
*/
class Column {}
/**
*/
class Filter {}
}
namespace Dcat\Admin\Show {
/**
*/
class Field {}
}
<?php
return [
'scaffold' => [
'header' => 'Scaffold',
'choose' => 'choose',
'table' => 'Table',
'model' => 'Model',
'controller' => 'Controller',
'repository' => 'Repository',
'add_field' => 'Add field',
'pk' => 'Primary key',
'soft_delete' => 'Soft delete',
'create_migration' => 'Create migration',
'create_model' => 'Create model',
'create_repository' => 'Create repository',
'create_controller' => 'Create controller',
'run_migrate' => 'Run migrate',
'create_lang' => 'Create lang',
'field' => 'field',
'translation' => 'translation',
'comment' => 'comment',
'default' => 'default',
'field_name' => 'field name',
'type' => 'type',
'nullable' => 'nullable',
'key' => 'key',
'translate_title' => 'Translate Title',
'sync_translation_with_comment' => 'Sync translation and comment',
],
'client' => [
'delete_confirm' => 'Are you sure to delete this item ?',
'confirm' => 'Confirm',
'cancel' => 'Cancel',
'refresh_succeeded' => 'Refresh succeeded !',
'close' => 'Close',
'selected_options' => ':num options selected',
'exceed_max_item' => 'Maximum items exceeded.',
'no_preview' => 'No preview available.',
'500' => 'Internal server error !',
'403' => 'Permission deny !',
'401' => 'Unauthorized !',
'419' => 'Page expired !',
],
'online' => 'Online',
'login' => 'Login',
'logout' => 'Logout',
'setting' => 'Setting',
'name' => 'Name',
'username' => 'Username',
'user' => 'User',
'alias' => 'Alias',
'routes' => 'Routes',
'route_action' => 'Route Action',
'middleware' => 'Middleware',
'method' => 'Method',
'old_password' => 'Old password',
'password' => 'Password',
'password_confirmation' => 'Password confirmation',
'old_password_error' => 'Incorrect password',
'remember_me' => 'Remember me',
'user_setting' => 'User setting',
'avatar' => 'Avatar',
'list' => 'List',
'new' => 'New',
'create' => 'Create',
'delete' => 'Delete',
'remove' => 'Remove',
'edit' => 'Edit',
'quick_edit' => 'Quick Edit',
'view' => 'View',
'continue_editing' => 'Continue editing',
'continue_creating' => 'Continue creating',
'detail' => 'Detail',
'browse' => 'Browse',
'reset' => 'Reset',
'export' => 'Export',
'batch_delete' => 'Batch delete',
'save' => 'Save',
'refresh' => 'Refresh',
'order' => 'Order',
'expand' => 'Expand',
'collapse' => 'Collapse',
'filter' => 'Filter',
'search' => 'Search',
'close' => 'Close',
'show' => 'Show',
'entries' => 'entries',
'captcha' => 'Captcha',
'action' => 'Action',
'title' => 'Title',
'description' => 'Description',
'back' => 'Back',
'back_to_list' => 'Back to List',
'submit' => 'Submit',
'menu' => 'Menu',
'input' => 'Input',
'succeeded' => 'Succeeded',
'failed' => 'Failed',
'delete_confirm' => 'Are you sure to delete this item ?',
'delete_succeeded' => 'Delete succeeded !',
'delete_failed' => 'Delete failed !',
'update_succeeded' => 'Update succeeded !',
'update_failed' => 'Update failed !',
'save_succeeded' => 'Save succeeded !',
'save_failed' => 'Save failed !',
'refresh_succeeded' => 'Refresh succeeded !',
'login_successful' => 'Login successful',
'choose' => 'Choose',
'choose_file' => 'Select file',
'choose_image' => 'Select image',
'more' => 'More',
'deny' => 'Permission denied',
'administrator' => 'Administrator',
'no_data' => 'No data.',
'roles' => 'Roles',
'permissions' => 'Permissions',
'slug' => 'Slug',
'created_at' => 'Created At',
'updated_at' => 'Updated At',
'alert' => 'Alert',
'parent_id' => 'Parent',
'icon' => 'Icon',
'uri' => 'URI',
'operation_log' => 'Operation log',
'parent_select_error' => 'Parent select error',
'tree' => 'Tree',
'table' => 'Table',
'default' => 'Default',
'import' => 'Import',
'is_not_import' => 'No',
'selected_options' => ':num options selected',
'pagination' => [
'range' => 'Showing :first to :last of :total entries',
],
'role' => 'Role',
'permission' => 'Permission',
'route' => 'Route',
'confirm' => 'Confirm',
'cancel' => 'Cancel',
'selectall' => 'Select all',
'http' => [
'method' => 'HTTP method',
'path' => 'HTTP path',
],
'all_methods_if_empty' => 'All methods if empty',
'all' => 'All',
'current_page' => 'Current page',
'selected_rows' => 'Selected rows',
'upload' => 'Upload',
'new_folder' => 'New folder',
'time' => 'Time',
'size' => 'Size',
'between_start' => 'Start',
'between_end' => 'End',
'next_page' => 'Next',
'prev_page' => 'Previous',
'next_step' => 'Next',
'prev_step' => 'Previous',
'done' => 'Done',
'listbox' => [
'text_total' => 'Showing all {0}',
'text_empty' => 'Empty list',
'filtered' => '{0} / {1}',
'filter_clear' => 'Show all',
'filter_placeholder' => 'Filter',
],
'responsive' => [
'display_all' => 'Display all',
'display' => 'Display',
'focus' => 'Focus',
],
'uploader' => [
'add_new_media' => 'Browse',
'drag_file' => 'Or drag file here',
'max_file_limit' => 'The :attribute may not be greater than :max.',
'exceed_size' => 'Exceeds the maximum file-size',
'interrupt' => 'Interrupt',
'upload_failed' => 'Upload failed! Please try again.',
'selected_files' => ':num files selected,size: :size。',
'selected_has_failed' => 'Uploaded: :success, failed: :fail, <a class="retry" href="javascript:"";">retry </a>or<a class="ignore" href="javascript:"";"> ignore</a>',
'selected_success' => ':num(:size) files selected, Uploaded: :success.',
'dot' => ', ',
'failed_num' => 'failed::fail.',
'pause_upload' => 'Pause',
'go_on_upload' => 'Go On',
'start_upload' => 'Upload',
'upload_success_message' => ':success files uploaded successfully',
'go_on_add' => 'New File',
'Q_TYPE_DENIED' => 'Sorry, the type of this file is not allowed!',
'Q_EXCEED_NUM_LIMIT' => 'Sorry, maximum number of allowable file uploads has been exceeded!',
'F_EXCEED_SIZE' => 'Sorry,the maximum file-size has been exceeded!',
'Q_EXCEED_SIZE_LIMIT' => 'Sorry, the maximum file-size has been exceeded!',
'F_DUPLICATE' => 'Duplicate file.',
'confirm_delete_file' => 'Are you sure delete this file from server?',
'dimensions' => 'The image dimensions is invalid.',
],
'import_extension_confirm' => 'Are you sure import the extension?',
'quick_create' => 'Quick create',
'grid_items_selected' => '{n} items selected',
'nothing_updated' => 'Nothing has been updated.',
'welcome_back' => 'Welcome back, please login to your account.',
'documentation' => 'Documentation',
'demo' => 'Demo',
'extensions' => 'Extensions',
'version' => 'Version',
'current_version' => 'Current version',
'latest_version' => 'Latest version',
'upgrade_to_version' => 'Upgrade to version :version',
'enable' => 'Enable',
'disable' => 'Disable',
'uninstall' => 'Uninstall',
'confirm_uninstall' => 'Please confirm that you wish to uninstall this extension. This may result in potential data loss.',
'marketplace' => 'Marketplace',
'theme' => 'Theme',
'application' => 'Application',
'install_from_local' => 'Install From Local',
'install_succeeded' => 'Install succeeded !',
'invalid_extension_package' => 'Invalid extension package !',
'copied' => 'Copied',
'auth_failed' => 'These credentials do not match our records.',
'validation' => [
'match' => 'The :attribute and :other must match.',
'minlength' => 'The :attribute must be at least :min characters.',
'maxlength' => 'The :attribute may not be greater than :max characters.',
],
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used during authentication for various
| messages that we need to display to the user. You are free to modify
| these language lines according to your application's requirements.
|
*/
'failed' => 'These credentials do not match our records.',
'password' => 'The provided password is incorrect.',
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Pagination Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used by the paginator library to build
| the simple pagination links. You are free to change them to anything
| you want to customize your views to better match your application.
|
*/
'previous' => '&laquo; Previous',
'next' => 'Next &raquo;',
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Password Reset Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are the default lines which match reasons
| that are given by the password broker for a password update attempt
| has failed, such as for an invalid token or invalid new password.
|
*/
'reset' => 'Your password has been reset!',
'sent' => 'We have emailed your password reset link!',
'throttled' => 'Please wait before retrying.',
'token' => 'This password reset token is invalid.',
'user' => "We can't find a user with that email address.",
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used by
| the validator class. Some of these rules have multiple versions such
| as the size rules. Feel free to tweak each of these messages here.
|
*/
'accepted' => 'The :attribute must be accepted.',
'accepted_if' => 'The :attribute must be accepted when :other is :value.',
'active_url' => 'The :attribute is not a valid URL.',
'after' => 'The :attribute must be a date after :date.',
'after_or_equal' => 'The :attribute must be a date after or equal to :date.',
'alpha' => 'The :attribute must only contain letters.',
'alpha_dash' => 'The :attribute must only contain letters, numbers, dashes and underscores.',
'alpha_num' => 'The :attribute must only contain letters and numbers.',
'array' => 'The :attribute must be an array.',
'ascii' => 'The :attribute must only contain single-byte alphanumeric characters and symbols.',
'before' => 'The :attribute must be a date before :date.',
'before_or_equal' => 'The :attribute must be a date before or equal to :date.',
'between' => [
'array' => 'The :attribute must have between :min and :max items.',
'file' => 'The :attribute must be between :min and :max kilobytes.',
'numeric' => 'The :attribute must be between :min and :max.',
'string' => 'The :attribute must be between :min and :max characters.',
],
'boolean' => 'The :attribute field must be true or false.',
'confirmed' => 'The :attribute confirmation does not match.',
'current_password' => 'The password is incorrect.',
'date' => 'The :attribute is not a valid date.',
'date_equals' => 'The :attribute must be a date equal to :date.',
'date_format' => 'The :attribute does not match the format :format.',
'decimal' => 'The :attribute must have :decimal decimal places.',
'declined' => 'The :attribute must be declined.',
'declined_if' => 'The :attribute must be declined when :other is :value.',
'different' => 'The :attribute and :other must be different.',
'digits' => 'The :attribute must be :digits digits.',
'digits_between' => 'The :attribute must be between :min and :max digits.',
'dimensions' => 'The :attribute has invalid image dimensions.',
'distinct' => 'The :attribute field has a duplicate value.',
'doesnt_end_with' => 'The :attribute may not end with one of the following: :values.',
'doesnt_start_with' => 'The :attribute may not start with one of the following: :values.',
'email' => 'The :attribute must be a valid email address.',
'ends_with' => 'The :attribute must end with one of the following: :values.',
'enum' => 'The selected :attribute is invalid.',
'exists' => 'The selected :attribute is invalid.',
'file' => 'The :attribute must be a file.',
'filled' => 'The :attribute field must have a value.',
'gt' => [
'array' => 'The :attribute must have more than :value items.',
'file' => 'The :attribute must be greater than :value kilobytes.',
'numeric' => 'The :attribute must be greater than :value.',
'string' => 'The :attribute must be greater than :value characters.',
],
'gte' => [
'array' => 'The :attribute must have :value items or more.',
'file' => 'The :attribute must be greater than or equal to :value kilobytes.',
'numeric' => 'The :attribute must be greater than or equal to :value.',
'string' => 'The :attribute must be greater than or equal to :value characters.',
],
'image' => 'The :attribute must be an image.',
'in' => 'The selected :attribute is invalid.',
'in_array' => 'The :attribute field does not exist in :other.',
'integer' => 'The :attribute must be an integer.',
'ip' => 'The :attribute must be a valid IP address.',
'ipv4' => 'The :attribute must be a valid IPv4 address.',
'ipv6' => 'The :attribute must be a valid IPv6 address.',
'json' => 'The :attribute must be a valid JSON string.',
'lowercase' => 'The :attribute must be lowercase.',
'lt' => [
'array' => 'The :attribute must have less than :value items.',
'file' => 'The :attribute must be less than :value kilobytes.',
'numeric' => 'The :attribute must be less than :value.',
'string' => 'The :attribute must be less than :value characters.',
],
'lte' => [
'array' => 'The :attribute must not have more than :value items.',
'file' => 'The :attribute must be less than or equal to :value kilobytes.',
'numeric' => 'The :attribute must be less than or equal to :value.',
'string' => 'The :attribute must be less than or equal to :value characters.',
],
'mac_address' => 'The :attribute must be a valid MAC address.',
'max' => [
'array' => 'The :attribute must not have more than :max items.',
'file' => 'The :attribute must not be greater than :max kilobytes.',
'numeric' => 'The :attribute must not be greater than :max.',
'string' => 'The :attribute must not be greater than :max characters.',
],
'max_digits' => 'The :attribute must not have more than :max digits.',
'mimes' => 'The :attribute must be a file of type: :values.',
'mimetypes' => 'The :attribute must be a file of type: :values.',
'min' => [
'array' => 'The :attribute must have at least :min items.',
'file' => 'The :attribute must be at least :min kilobytes.',
'numeric' => 'The :attribute must be at least :min.',
'string' => 'The :attribute must be at least :min characters.',
],
'min_digits' => 'The :attribute must have at least :min digits.',
'missing' => 'The :attribute field must be missing.',
'missing_if' => 'The :attribute field must be missing when :other is :value.',
'missing_unless' => 'The :attribute field must be missing unless :other is :value.',
'missing_with' => 'The :attribute field must be missing when :values is present.',
'missing_with_all' => 'The :attribute field must be missing when :values are present.',
'multiple_of' => 'The :attribute must be a multiple of :value.',
'not_in' => 'The selected :attribute is invalid.',
'not_regex' => 'The :attribute format is invalid.',
'numeric' => 'The :attribute must be a number.',
'password' => [
'letters' => 'The :attribute must contain at least one letter.',
'mixed' => 'The :attribute must contain at least one uppercase and one lowercase letter.',
'numbers' => 'The :attribute must contain at least one number.',
'symbols' => 'The :attribute must contain at least one symbol.',
'uncompromised' => 'The given :attribute has appeared in a data leak. Please choose a different :attribute.',
],
'present' => 'The :attribute field must be present.',
'prohibited' => 'The :attribute field is prohibited.',
'prohibited_if' => 'The :attribute field is prohibited when :other is :value.',
'prohibited_unless' => 'The :attribute field is prohibited unless :other is in :values.',
'prohibits' => 'The :attribute field prohibits :other from being present.',
'regex' => 'The :attribute format is invalid.',
'required' => 'The :attribute field is required.',
'required_array_keys' => 'The :attribute field must contain entries for: :values.',
'required_if' => 'The :attribute field is required when :other is :value.',
'required_if_accepted' => 'The :attribute field is required when :other is accepted.',
'required_unless' => 'The :attribute field is required unless :other is in :values.',
'required_with' => 'The :attribute field is required when :values is present.',
'required_with_all' => 'The :attribute field is required when :values are present.',
'required_without' => 'The :attribute field is required when :values is not present.',
'required_without_all' => 'The :attribute field is required when none of :values are present.',
'same' => 'The :attribute and :other must match.',
'size' => [
'array' => 'The :attribute must contain :size items.',
'file' => 'The :attribute must be :size kilobytes.',
'numeric' => 'The :attribute must be :size.',
'string' => 'The :attribute must be :size characters.',
],
'starts_with' => 'The :attribute must start with one of the following: :values.',
'string' => 'The :attribute must be a string.',
'timezone' => 'The :attribute must be a valid timezone.',
'unique' => 'The :attribute has already been taken.',
'uploaded' => 'The :attribute failed to upload.',
'uppercase' => 'The :attribute must be uppercase.',
'url' => 'The :attribute must be a valid URL.',
'ulid' => 'The :attribute must be a valid ULID.',
'uuid' => 'The :attribute must be a valid UUID.',
/*
|--------------------------------------------------------------------------
| Custom Validation Language Lines
|--------------------------------------------------------------------------
|
| Here you may specify custom validation messages for attributes using the
| convention "attribute.rule" to name the lines. This makes it quick to
| specify a specific custom language line for a given attribute rule.
|
*/
'custom' => [
'attribute-name' => [
'rule-name' => 'custom-message',
],
],
/*
|--------------------------------------------------------------------------
| Custom Validation Attributes
|--------------------------------------------------------------------------
|
| The following language lines are used to swap our attribute placeholder
| with something more reader friendly such as "E-Mail Address" instead
| of "email". This simply helps us make our message more expressive.
|
*/
'attributes' => [],
];
<?php
return [
'scaffold' => [
'header' => '代码生成器',
'choose' => '选择已有数据表',
'table' => '表名',
'model' => '模型',
'controller' => '控制器',
'repository' => '数据仓库',
'add_field' => '添加字段',
'pk' => '主键',
'soft_delete' => '软删除',
'create_migration' => '创建表迁移文件',
'create_model' => '创建模型',
'create_repository' => '创建数据仓库',
'create_controller' => '创建控制器',
'run_migrate' => '创建数据表',
'create_lang' => '创建翻译文件',
'field' => '字段',
'translation' => '翻译',
'comment' => '注释',
'default' => '默认值',
'field_name' => '字段名',
'type' => '类型',
'nullable' => '允许空值',
'key' => '索引',
'translate_title' => '翻译标题',
'sync_translation_with_comment' => '同步翻译与注释',
],
'client' => [
'delete_confirm' => '确认删除?',
'confirm' => '确认',
'cancel' => '取消',
'refresh_succeeded' => '刷新成功 !',
'submit' => '提交',
'close' => '关闭',
'selected_options' => '已选中:num个选项',
'exceed_max_item' => '已超出最大可选数量',
'no_preview' => '预览失败',
'500' => '系统繁忙,请稍后再试!',
'403' => '对不起,您没有权限访问,请与管理员联系。',
'401' => '请登录!',
'419' => '对不起,当前页面已失效,请刷新浏览器。',
],
'home' => '主页',
'online' => '在线',
'login' => '登录',
'logout' => '登出',
'setting' => '设置',
'name' => '名称',
'username' => '用户名',
'old_password' => '旧密码',
'password' => '密码',
'password_confirmation' => '确认密码',
'old_password_error' => '请输入正确的旧密码',
'remember_me' => '记住我',
'user_setting' => '用户设置',
'avatar' => '头像',
'list' => '列表',
'new' => '新增',
'create' => '创建',
'delete' => '删除',
'remove' => '移除',
'edit' => '编辑',
'quick_edit' => '快捷编辑',
'continue_editing' => '继续编辑',
'continue_creating' => '继续创建',
'view' => '查看',
'detail' => '详细',
'browse' => '浏览',
'reset' => '重置',
'export' => '导出',
'batch_delete' => '批量删除',
'save' => '保存',
'refresh' => '刷新',
'order' => '排序',
'expand' => '展开',
'collapse' => '收起',
'filter' => '筛选',
'search' => '搜索',
'close' => '关闭',
'show' => '显示',
'entries' => '条',
'captcha' => '验证码',
'action' => '操作',
'title' => '标题',
'description' => '简介',
'back' => '返回',
'back_to_list' => '返回列表',
'submit' => '提交',
'menu' => '菜单',
'input' => '输入',
'succeeded' => '成功',
'failed' => '失败',
'delete_confirm' => '确认删除?',
'delete_succeeded' => '删除成功 !',
'delete_failed' => '删除失败 !',
'update_succeeded' => '更新成功 !',
'update_failed' => '更新失败 !',
'save_succeeded' => '保存成功 !',
'save_failed' => '保存失败 !',
'refresh_succeeded' => '刷新成功 !',
'login_successful' => '登录成功 !',
'choose' => '选择',
'choose_file' => '选择文件',
'choose_image' => '选择图片',
'more' => '更多',
'deny' => '无权访问',
'administrator' => '管理员',
'roles' => '角色',
'permissions' => '权限',
'slug' => '标识',
'created_at' => '创建时间',
'updated_at' => '更新时间',
'alert' => '注意',
'parent_id' => '父级',
'icon' => '图标',
'uri' => '路径',
'operation_log' => '操作日志',
'parent_select_error' => '父级选择错误',
'default' => '默认',
'table' => '表格',
'no_data' => '暂无数据',
'routes' => '路由',
'alias' => '别名',
'route_action' => '处理器',
'middleware' => '中间件',
'import' => '导入',
'is_not_import' => '未导入',
'selected_options' => '已选中:num个选项',
'method' => '方法',
'user' => '用户',
'pagination' => [
'range' => '从 :first 到 :last ,总共 :total 条',
],
'role' => '角色',
'permission' => '权限',
'route' => '路由',
'confirm' => '确认',
'cancel' => '取消',
'selectall' => '全选',
'http' => [
'method' => 'HTTP方法',
'path' => 'HTTP路径',
],
'all_methods_if_empty' => '为空默认为所有方法',
'all' => '全部',
'current_page' => '当前页',
'selected_rows' => '选择的行',
'upload' => '上传',
'new_folder' => '新建文件夹',
'time' => '时间',
'size' => '大小',
'between_start' => '起始',
'between_end' => '结束',
'next_page' => '下一页',
'prev_page' => '上一页',
'next_step' => '下一步',
'prev_step' => '上一步',
'done' => '完成',
'listbox' => [
'text_total' => '总共 {0} 项',
'text_empty' => '空列表',
'filtered' => '{0} / {1}',
'filter_clear' => '显示全部',
'filter_placeholder' => '过滤',
],
'responsive' => [
'display_all' => '显示全部',
'display' => '字段',
'focus' => '聚焦',
],
'uploader' => [
'add_new_media' => '添加文件',
'drag_file' => '或将文件拖到这里',
'max_file_limit' => 'The :attribute may not be greater than :max.',
'exceed_size' => '文件大小超出',
'interrupt' => '上传暂停',
'upload_failed' => '上传失败,请重试',
'selected_files' => '选中:num个文件,共:size。',
'selected_has_failed' => '已成功上传:success个文件,:fail个文件上传失败,<a class="retry" href="javascript:"";">重新上传</a>失败文件或<a class="ignore" href="javascript:"";">忽略</a>',
'selected_success' => '共:num个(:size),已上传:success个。',
'dot' => ',',
'failed_num' => '失败:fail个。',
'pause_upload' => '暂停上传',
'go_on_upload' => '继续上传',
'start_upload' => '开始上传',
'upload_success_message' => '已成功上传:success个文件',
'go_on_add' => '继续添加',
'Q_TYPE_DENIED' => '对不起,不允许上传此类型文件',
'Q_EXCEED_NUM_LIMIT' => '对不起,已超出文件上传数量限制,最多只能上传:num个文件',
'F_EXCEED_SIZE' => '对不起,当前选择的文件过大',
'Q_EXCEED_SIZE_LIMIT' => '对不起,已超出文件大小限制',
'F_DUPLICATE' => '文件重复',
'confirm_delete_file' => '您确定要删除这个文件吗?',
'dimensions' => '图片规格不正确',
],
'import_extension_confirm' => '确认导入拓展?',
'quick_create' => '快速创建',
'grid_items_selected' => '已选择 {n} 项',
'nothing_updated' => '没有任何数据被更改',
'welcome_back' => '欢迎回来,请登录您的账号。',
'documentation' => '文档',
'demo' => '示例',
'extensions' => '扩展',
'version' => '版本',
'current_version' => '当前版本',
'latest_version' => '最新版本',
'upgrade_to_version' => '更新至版本 :version',
'enable' => '启用',
'disable' => '禁用',
'uninstall' => '卸载',
'confirm_uninstall' => '您确定要卸载当前扩展吗?此操作将会移除扩展数据!',
'marketplace' => '应用市场',
'theme' => '主题',
'application' => '应用',
'install_from_local' => '本地安装',
'install_succeeded' => '安装成功',
'invalid_extension_package' => '安装包异常',
'copied' => '已复制',
'auth_failed' => '账号或密码错误',
'validation' => [
'match' => '与 :attribute 不匹配。',
'minlength' => ':attribute 字符长度不能少于 :min。',
'maxlength' => ':attribute 字符长度不能超出 :max。',
],
];
<?php
return [
'labels' => [
'Advantage' => '优势材料库',
'advantage' => '优势材料库',
],
'fields' => [
'cate_1' => '一级品类',
'cate_2' => '二级品类',
'cate_3' => '三级品类',
'cate_4' => '四级品类',
'characteristic' => '优势特征',
'brand_level' => '品牌类别',
'brand_id' => '品牌',
'company' => '公司名称',
'goods' => '优势产品',
'contacts' => '联系人',
],
'options' => [
],
];
<?php
return [
'labels' => [
'Article' => '文章',
'article' => '文章',
],
'fields' => [
'title' => '标题',
'cat_id' => '分类',
'content' => '内容',
],
'options' => [],
];
<?php
return [
'labels' => [
'BrandLevel' => '品牌类别',
'brand-level' => '品牌类别',
],
'fields' => [
'title' => '名称',
],
'options' => [
],
];
<?php
return [
'labels' => [
'Brand' => '品牌',
'brand' => '品牌',
],
'fields' => [
'title' => '品牌名称',
],
'options' => [
],
];
<?php
return [
'labels' => [
'Carousel' => '轮播图',
'carousel' => '轮播图',
],
'fields' => [
'title' => '名称',
'imgUrl' => '图片',
'linkUrl' => '链接',
'status' => '是否启用',
],
'options' => [],
];
<?php
return [
'labels' => [
'Category' => 'Category',
'category' => 'Category',
],
'fields' => [
'parent_id' => '父级',
'order' => '排序',
'title' => '名称',
],
'options' => [
],
];
<?php
return [
'labels' => [
'CheckNumber' => '审核编号',
'check-number' => '审核编号',
],
'fields' => [
'number' => '编号',
'status' => '使用状态',
],
'options' => [],
];
<?php
return [
'labels' => [
'City' => 'City',
'city' => 'City',
],
'fields' => [
'province_id' => '省份',
'city_id' => '城市',
],
'options' => [],
];
<?php
return [
'labels' => [
'CommentTpl' => '评价模板',
'comment-tpl' => '评价模板',
],
'fields' => [
'title' => '标题',
'content' => '内容',
],
'options' => [],
];
<?php
return [
'labels' => [
'Comment' => '评论',
'Comment' => '评论',
],
'fields' => [
'title' => '商品名称',
'nickname' => '昵称',
'avatar' => '头像',
'phone' => '手机号',
'content' => '内容',
],
'options' => [],
];
<?php
return [
'labels' => [
'Custom' => '客户',
'custom' => '客户',
],
'fields' => [
'name' => '姓名',
'avater' => '头像',
'openid' => '第三方唯一标识id',
'phone' => '手机号码',
'status' => '状态',
'user_type' => '用户类型',
'email' => '邮箱',
'email_verified_at' => 'email_verified_at',
'password' => 'password',
'remember_token' => 'remember_token',
],
'options' => [
],
];
<?php
return [
'labels' => [
'Extensions' => '扩展',
],
'fields' => [
'alias' => '别名',
'description' => '描述',
'authors' => '开发者',
'homepage' => '主页',
'require' => '依赖',
'require_dev' => '开发环境依赖',
'name' => '包名',
'version' => '版本',
'enable' => '启用',
'config' => '配置',
'imported' => '导入',
],
'options' => [
],
];
<?php
return [
'fields' => [
'id' => 'ID',
'name' => '名称',
'username' => '用户名',
'email' => '邮箱',
'http_path' => 'HTTP路径',
'password' => '密码',
'password_confirmation' => '确认密码',
'created_at' => '创建时间',
'updated_at' => '更新时间',
'permissions' => '权限',
'slug' => '标识',
'user' => '用户',
'order' => '排序',
'ip' => 'IP',
'method' => '方法',
'uri' => 'URI',
'roles' => '角色',
'path' => '路径',
'input' => '输入',
'type' => '类型',
],
'labels' => [
'list' => '列表',
'edit' => '编辑',
'detail' => '详细',
'create' => '创建',
'root' => '顶级',
'scaffold' => '代码生成器',
],
'options' => [
//
],
];
<?php
return [
'labels' => [
'Good' => '商品列表',
'good' => '商品列表',
],
'fields' => [
'goods_name' => '名称',
'goods_desc' => '详情',
'product_no' => '型号',
'material' => '材质',
'box_size' => '箱规',
'is_jd' => '是否京东自营',
'supplier' => '供货商联系人',
'su_phone' => '联系方式',
'cover_img' => '封面图',
],
'options' => [],
];
<?php
return [
'labels' => [
'Income' => '提现审核',
'income' => '提现审核',
],
'fields' => [
'user_id' => '用户ID',
'amount' => '提现金额',
'status' => '提现状态',
],
'options' => [],
];
<?php
return [
'labels' => [
'Kefu' => '客服列表',
'kefu' => '客服列表',
],
'fields' => [],
'options' => [],
];
<?php
return [
'labels' => [
'Manufacturer' => '厂家资源库',
'manufacturer' => '厂家资源库',
],
'fields' => [
'cate_1' => '一级品类',
'cate_2' => '二级品类',
'cate_3' => '三级品类',
'cate_4' => '四级品类',
'brand_level' => '品牌类别',
'brand_id' => '品牌',
'company' => '公司',
'company_cate' => '公司类别',
'position' => '地理位置',
'jwd' => '经纬度',
'contacts' => '联系人',
'main_products' => '主营产品',
'scale' => '规模',
'device' => '生产线设备',
'capacity' => '产能',
'supply_cycle' => '生产周期(天)',
'transport' => '运输周期',
'participate_in_zj' => '参与建设项目(中建系统)',
'participate_in' => '参与建设项目(非中建系统)',
'brand_link' => '网址二维码',
],
'options' => [
],
];
<?php
return [
'labels' => [
'MarketPrice' => '市场价格库',
'market-price' => '市场价格库',
],
'fields' => [
'cate_1' => '一级品类',
'cate_2' => '二级品类',
'cate_3' => '三级品类',
'cate_4' => '四级品类',
'brand_level' => '品牌类别',
'brand_id' => '品牌',
'company' => '公司名称',
'position' => '地理位置',
'jwd' => '经纬度',
'contacts' => '联系人',
'specifications' => '规格型号',
'metering' => '计量规则',
'unit' => '单位',
'unit_price' => '不含税单价',
'pay_way' => '付款方式',
'source' => '价格来源',
'quotation_time' => '报价时间',
],
'options' => [
],
];
<?php
return [
'titles' => [
'index' => '主页',
'admin' => '系统',
'users' => '管理员',
'roles' => '角色',
'permission' => '权限',
'menu' => '菜单',
'operation_log' => '操作日志',
'helpers' => '开发工具',
'extensions' => '扩展',
'scaffold' => '代码生成器',
'icons' => '图标',
],
];
<?php
return [
'labels' => [
'MerchantGoodsStore' => '商家库存',
'merchantGoodsStore' => '商家库存',
],
'fields' => [
'name' => '商家名称',
'contacter' => '联系人',
'phone' => '手机号',
'account' => '登录账号',
'pwd' => '登录密码',
'buycode' => '直购码',
],
'options' => [],
];
<?php
return [
'labels' => [
'MerchantStoreSkuLog' => '库存记录',
'merchant-store-sku-log' => '库存记录',
],
'fields' => [
'goods_sn' => '商品编号',
'attr_name' => '商品规格',
'change' => '增加库存',
],
'options' => [],
];
<?php
return [
'labels' => [
'Merchant' => '商家列表',
'merchant' => 'Merchant',
],
'fields' => [
'name' => '商家名称',
'contacter' => '联系人',
'phone' => '手机号',
'account' => '登录账号',
'pwd' => '登录密码',
'buycode' => '直购码',
],
'options' => [],
];
<?php
return [
'labels' => [
'MerchatGoodsStore' => '商品',
'MerchatGoodsStore' => '商品',
],
'fields' => [
'name' => '商家名称',
'contacter' => '联系人',
'phone' => '手机号',
'account' => '登录账号',
'pwd' => '登录密码',
'buycode' => '直购码',
],
'options' => [],
];
<?php
return [
'labels' => [
'OrderInfo' => '订单管理',
'orderInfo' => '订单管理',
],
'fields' => [],
'options' => [],
];
<?php
return [
'labels' => [
'Performance' => '性能参数库',
'performance' => '性能参数库',
],
'fields' => [
'cate_1' => '一级品类',
'cate_2' => '二级品类',
'cate_3' => '三级品类',
'cate_4' => '四级品类',
'brand_level' => '品牌类别',
'brand_id' => '品牌',
'parameter' => '参数',
'scene' => '应用场景',
'installation_method' => '安装方式',
'standard' => '相关标准',
'img_url' => '图片',
],
'options' => [
],
];
<?php
return [
'labels' => [
'Sample' => '材料样品库',
'sample' => '材料样品库',
],
'fields' => [
'cate_1' => '一级品类',
'cate_2' => '二级品类',
'cate_3' => '三级品类',
'cate_4' => '四级品类',
'category' => '类别',
'project_name' => '项目名称',
'brand_level' => '品牌类别',
'brand_id' => '品牌',
'company' => '公司名称',
'contacts' => '联系人',
'specifications' => '规格型号',
'used_part' => '使用部位',
'sealed_sample' => '封样日期',
'img_url' => '样品图片',
],
'options' => [
],
];
<?php
return [
'labels' => [
'Share' => '查看下级',
'share' => '查看下级',
],
'fields' => [
'name' => '用户昵称',
'company' => '公司名称',
'avater' => '头像',
'openid' => '第三方唯一标识id',
'phone' => '手机号码',
'status' => '状态',
'user_type' => '用户类型',
'email' => '邮箱',
'email_verified_at' => 'email_verified_at',
'password' => 'password',
'remember_token' => 'remember_token',
],
'options' => [],
];
<?php
return [
'labels' => [
'StoreAdminUsers' => '核销员列表',
'StoreAdminUsers' => '核销员列表',
],
'fields' => [
'merchant_id' => '商户ID',
'store_id' => '门店ID',
],
'options' => [],
];
<?php
return [
'labels' => [
'StoreIncome' => '提现管理',
'storeIncome' => '提现管理',
],
'fields' => [
'user_id' => '用户ID',
'amount' => '提现金额',
'status' => '提现状态',
],
'options' => [],
];
<?php
return [
'labels' => [
'SystemSetting' => '数值设置',
'system-setting' => '数值设置',
],
'fields' => [
'mobile' => '客服联系方式',
],
'options' => [],
];
<?php
return [
'labels' => [
'UserBuycodeCheck' => '直购码审核',
'user-buycode-check' => '直购码审核',
],
'fields' => [
'before_code' => '修改前直购码',
'after_code' => '修改后直购码',
'status' => '审核状态',
],
'options' => [],
];
<?php
return [
'labels' => [
'UserCheck' => '审核列表',
'UserCheck' => '审核列表',
],
'fields' => [
'name' => '用户昵称',
'company' => '公司名称',
'avater' => '头像',
'openid' => '第三方唯一标识id',
'phone' => '手机号码',
'status' => '状态',
'user_type' => '用户类型',
'email' => '邮箱',
'email_verified_at' => 'email_verified_at',
'password' => 'password',
'remember_token' => 'remember_token',
],
'options' => [],
];
<?php
return [
'labels' => [
'UserCollect' => 'UserCollect',
'user-collect' => 'UserCollect',
],
'fields' => [
],
'options' => [
],
];
<?php
return [
'labels' => [
'User' => '用户列表',
'user' => '用户列表',
'share' => '查看下级',
],
'fields' => [
'name' => '用户昵称',
'company' => '公司名称',
'avater' => '头像',
'openid' => '第三方唯一标识id',
'phone' => '手机号码',
'status' => '状态',
'user_type' => '用户类型',
'email' => '邮箱',
'email_verified_at' => 'email_verified_at',
'password' => 'password',
'remember_token' => 'remember_token',
],
'options' => [],
];
<?php
return [
'custom' => [
'cover_img' => [
'required' => '请上传封面图片',
],
'carousel' => [
'required' => '请上传轮播图片',
],
'sku' => [
'required' => 'sku',
],
],
];
<?php
return [
'scaffold' => [
'header' => '代碼生成器',
'choose' => '選擇已有數據表',
'table' => '表名',
'model' => '模型',
'controller' => '控制器',
'repository' => '數據倉庫',
'add_field' => '添加欄位',
'pk' => '主鍵',
'soft_delete' => '軟刪除',
'create_migration' => '創建表遷移文件',
'create_model' => '創建模型',
'create_repository' => '創建數據倉庫',
'create_controller' => '創建控制器',
'run_migrate' => '創建數據表',
'create_lang' => '創建翻譯文件',
'field' => '欄位',
'translation' => '翻譯',
'comment' => '註解',
'default' => '預設值',
'field_name' => '欄位名',
'type' => '類型',
'nullable' => '允許null',
'key' => '索引',
'translate_title' => '翻譯標題',
'sync_translation_with_comment' => '同步翻譯與註釋',
],
'client' => [
'delete_confirm' => '確認刪除?',
'confirm' => '確認',
'cancel' => '取消',
'refresh_succeeded' => '刷新成功!',
'close' => '關閉',
'submit' => '提交',
'selected_options' => '已選中:num個選項',
'exceed_max_item' => '已超出最大可選數量',
'no_preview' => '預覽失敗',
'500' => '系統繁忙,請稍後再試!',
'403' => '對不起,您無訪問權限,請聯繫管理員。',
'401' => '請先登入!',
'419' => '對不起,當前頁面已失效,請刷新瀏覽器。',
],
'home' => '首頁',
'online' => '在線',
'login' => '登入',
'logout' => '登出',
'setting' => '設置',
'name' => '名稱',
'username' => '用戶名',
'old_password' => '舊密碼',
'password' => '密碼',
'password_confirmation' => '確認密碼',
'old_password_error' => '舊密碼輸入錯誤',
'remember_me' => '記住我',
'user_setting' => '用戶設置',
'avatar' => '頭像',
'list' => '列表',
'new' => '新增',
'create' => '創建',
'delete' => '刪除',
'remove' => '移除',
'edit' => '編輯',
'quick_edit' => '快速編輯',
'continue_editing' => '繼續編輯',
'continue_creating' => '繼續新增',
'view' => '查看',
'detail' => '詳細',
'browse' => '瀏覽',
'reset' => '重置',
'export' => '匯出',
'batch_delete' => '批次刪除',
'save' => '儲存',
'refresh' => '重新整理',
'order' => '排序',
'expand' => '展開',
'collapse' => '收起',
'filter' => '篩選',
'search' => '搜索',
'close' => '關閉',
'show' => '詳情',
'entries' => '條',
'captcha' => '驗證碼',
'action' => '操作',
'title' => '標題',
'description' => '簡介',
'back' => '返回',
'back_to_list' => '返回列表',
'submit' => '送出',
'menu' => '目錄',
'input' => '輸入',
'succeeded' => '成功',
'failed' => '失敗',
'delete_confirm' => '確認刪除?',
'delete_succeeded' => '刪除成功!',
'delete_failed' => '刪除失敗!',
'update_succeeded' => '更新成功!',
'update_failed' => '更新失敗 !',
'save_succeeded' => '儲存成功!',
'save_failed' => '儲存失敗 !',
'refresh_succeeded' => '刷新成功!',
'login_successful' => '登入成功!',
'choose' => '選擇',
'choose_file' => '選擇檔案',
'choose_image' => '選擇圖片',
'more' => '更多',
'deny' => '權限不足',
'administrator' => '管理員',
'roles' => '角色',
'permissions' => '權限',
'slug' => '標誌',
'created_at' => '建立時間',
'updated_at' => '更新時間',
'alert' => '警告',
'parent_id' => '父級',
'icon' => '圖示',
'uri' => '路徑',
'operation_log' => '操作記錄',
'parent_select_error' => '父級選擇錯誤',
'default' => '預設',
'table' => '表格',
'no_data' => '暫無數據',
'routes' => '路由',
'alias' => '別名',
'route_action' => '處理器',
'middleware' => '中間件',
'import' => '導入',
'is_not_import' => '未導入',
'selected_options' => '已選中:num個選項',
'method' => '方法',
'user' => '用戶',
'pagination' => [
'range' => '從 :first 到 :last ,總共 :total 條',
],
'role' => '角色',
'permission' => '權限',
'route' => '路由',
'confirm' => '確認',
'cancel' => '取消',
'selectall' => '全選',
'http' => [
'method' => 'HTTP方法',
'path' => 'HTTP路徑',
],
'all_methods_if_empty' => '所有方法預設為空',
'all' => '全部',
'current_page' => '現在頁面',
'selected_rows' => '選擇的行',
'upload' => '上傳',
'new_folder' => '新建資料夾',
'time' => '時間',
'size' => '大小',
'between_start' => '起始',
'between_end' => '結束',
'next_page' => '下一頁',
'prev_page' => '上一頁',
'next_step' => '下一步',
'prev_step' => '上一步',
'done' => '完成',
'listbox' => [
'text_total' => '總共 {0} 項',
'text_empty' => '空列表',
'filtered' => '{0} / {1}',
'filter_clear' => '顯示全部',
'filter_placeholder' => '過濾',
],
'responsive' => [
'display_all' => '顯示全部',
'display' => '欄位',
'focus' => '聚焦',
],
'uploader' => [
'add_new_media' => '添加檔案',
'drag_file' => '或將檔案拖移到這裡',
'max_file_limit' => ':attribute不能超過:max.',
'exceed_size' => '檔案大小過大',
'interrupt' => '暫停上傳',
'upload_failed' => '上傳失敗,請再試一次',
'selected_files' => '選中:num個檔案,共:size。',
'selected_has_failed' => '已成功上傳:success個檔案,:fail個檔案上傳失敗,<a class="retry" href="javascript:"";">重新上傳</a>失敗檔案或<a class="ignore" href="javascript:"";">忽略</a>',
'selected_success' => '共:num个(:size),已上傳:success個。',
'dot' => ',',
'failed_num' => '失敗:fail個。',
'pause_upload' => '暫停上傳',
'go_on_upload' => '繼續上傳',
'start_upload' => '開始上傳',
'upload_success_message' => '已成功上傳:success個檔案',
'go_on_add' => '繼續添加',
'Q_TYPE_DENIED' => '對不起,無法上傳該類型檔案',
'Q_EXCEED_NUM_LIMIT' => '对不起,超出上傳數量限制,最多只能上傳:num個檔案',
'F_EXCEED_SIZE' => '对不起,當前選擇的檔案過大',
'Q_EXCEED_SIZE_LIMIT' => '对不起,檔案大小超出限制',
'F_DUPLICATE' => '檔案重複',
'confirm_delete_file' => '您確定要刪除該檔案嗎?',
'dimensions' => '圖片規格不正確',
],
'import_extension_confirm' => '確認導入擴展?',
'quick_create' => '快速新增',
'grid_items_selected' => '已選擇 {n} 項',
'nothing_updated' => '沒有任何資料被更改',
'welcome_back' => '歡迎回來,請登入帳號',
'documentation' => '文檔',
'demo' => '範例',
'extensions' => '擴展',
'version' => '版本',
'current_version' => '当前版本',
'latest_version' => '當前版本',
'upgrade_to_version' => '更新至版本 :version',
'enable' => '啟用',
'disable' => '禁用',
'uninstall' => '卸載',
'confirm_uninstall' => '您確定要卸載當前擴展嗎?此操作將會移除擴展數據!',
'marketplace' => '應用市場',
'theme' => '主題',
'application' => '應用',
'install_from_local' => '本地安装',
'install_succeeded' => '本地安裝',
'invalid_extension_package' => '安裝包異常',
'copied' => '已複製',
'auth_failed' => '帳號或密碼錯誤',
'validation' => [
'match' => '與 :attribute 不匹配。',
'minlength' => ':attribute 長度不能少於 :min。',
'maxlength' => ':attribute 長度不能超過 :max。',
],
];
<?php
return [
'labels' => [
'Extensions' => '擴展',
],
'fields' => [
'alias' => '別名',
'description' => '說明',
'authors' => '作者',
'homepage' => '首頁',
'require' => '依賴',
'require_dev' => '開發環境依賴',
'name' => '名稱',
'version' => '版本',
'enable' => '啟用',
'config' => '設定',
'imported' => '導入',
],
'options' => [
],
];
<?php
return [
'fields' => [
'id' => 'ID',
'name' => '名稱',
'username' => '用戶名',
'email' => '信箱',
'http_path' => 'HTTP路徑',
'password' => '密碼',
'password_confirmation' => '確認密碼',
'created_at' => '建立時間',
'updated_at' => '更新時間',
'permissions' => '權限',
'slug' => '標示',
'user' => '用戶',
'order' => '排序',
'ip' => 'IP',
'method' => '方法',
'uri' => 'URI',
'roles' => '角色',
'path' => '路徑',
'input' => '輸入',
'type' => '类型',
],
'labels' => [
'list' => '列表',
'edit' => '編輯',
'detail' => '詳細',
'create' => '創建',
'root' => 'root',
'scaffold' => '代碼生成器',
],
'options' => [
'permissions' => [
],
],
];
<?php
return [
'titles' => [
'index' => '首頁',
'admin' => '系統',
'users' => '管理員',
'roles' => '角色',
'permission' => '權限',
'menu' => '菜單',
'operation_log' => '操作日誌',
'helpers' => '開發工具',
'extensions' => '擴展',
'scaffold' => '代碼生成器',
'icons' => '圖示',
],
];
{
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build"
},
"devDependencies": {
"axios": "^1.1.2",
"laravel-vite-plugin": "^0.7.2",
"lodash": "^4.17.19",
"postcss": "^8.1.14",
"vite": "^4.0.0"
}
}
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
</testsuites>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./app</directory>
</include>
</coverage>
<php>
<env name="APP_ENV" value="testing"/>
<env name="BCRYPT_ROUNDS" value="4"/>
<env name="CACHE_DRIVER" value="array"/>
<!-- <env name="DB_CONNECTION" value="sqlite"/> -->
<!-- <env name="DB_DATABASE" value=":memory:"/> -->
<env name="MAIL_MAILER" value="array"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="TELESCOPE_ENABLED" value="false"/>
</php>
</phpunit>
import './bootstrap';
import _ from 'lodash';
window._ = _;
/**
* We'll load the axios HTTP library which allows us to easily issue requests
* to our Laravel back-end. This library automatically handles sending the
* CSRF token as a header based on the value of the "XSRF" token cookie.
*/
import axios from 'axios';
window.axios = axios;
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
/**
* Echo exposes an expressive API for subscribing to channels and listening
* for events that are broadcast by Laravel. Echo and event broadcasting
* allows your team to easily build robust real-time web applications.
*/
// import Echo from 'laravel-echo';
// import Pusher from 'pusher-js';
// window.Pusher = Pusher;
// window.Echo = new Echo({
// broadcaster: 'pusher',
// key: import.meta.env.VITE_PUSHER_APP_KEY,
// cluster: import.meta.env.VITE_PUSHER_APP_CLUSTER ?? 'mt1',
// wsHost: import.meta.env.VITE_PUSHER_HOST ? import.meta.env.VITE_PUSHER_HOST : `ws-${import.meta.env.VITE_PUSHER_APP_CLUSTER}.pusher.com`,
// wsPort: import.meta.env.VITE_PUSHER_PORT ?? 80,
// wssPort: import.meta.env.VITE_PUSHER_PORT ?? 443,
// forceTLS: (import.meta.env.VITE_PUSHER_SCHEME ?? 'https') === 'https',
// enabledTransports: ['ws', 'wss'],
// });
<style>
.mailbox-attachment-icon {
max-height: none;
}
.mailbox-attachment-info {
background: #fff;
}
.mailbox-attachments .img-thumbnail {
border: 1px solid #fff;
border-radius: 0;
background-color: #fff;
}
.mailbox-attachment-icon.has-img>img {
max-width: 100%!important;
/*height: 180px!important;*/
}
.mailbox-attachment-info .item {
margin-bottom: 6px;
}
.mailbox-attachments li {
box-shadow: 0 2px 4px 0 rgba(0,0,0,.08);
border: 0;
background: #fff;
}
body.dark-mode .table {
background-color: #2c2c43;
}
body.dark-mode .mailbox-attachments .img-thumbnail {
border-color: #223;
background-color: #223;
}
body.dark-mode .mailbox-attachment-info {
background: #223;
}
body.dark-mode .mailbox-attachments li {
border-color: #223;
background-color: #223;
}
body.dark-mode .mailbox-attachment-name {
color: #a8a9bb
}
</style>
<div class="dcat-box custom-data-table dt-bootstrap4">
@include('admin::grid.table-toolbar')
{!! $grid->renderFilter() !!}
{!! $grid->renderHeader() !!}
<div class="table-responsive table-wrapper mt-1">
<ul class="mailbox-attachments clearfix {{ $grid->formatTableClass() }} p-0" id="{{ $tableId }}">
@foreach($grid->rows() as $row)
<li>
<span class="mailbox-attachment-icon has-img">
{!! $row->column('url') !!}
</span>
<div class="mailbox-attachment-info">
{{-- <div class="d-flex justify-content-between item">--}}
{{-- <span class="mailbox-attachment-name">{!! $grid->columns()->get('id')->getLabel() !!}</span> {!! $row->column('id') !!}--}}
{{-- </div>--}}
<div class=" justify-content-between item" style="text-align: center; font-size: 24px;font-weight: 500">
{!! $row->column('title') !!}
</div>
<span class="d-flex justify-content-between" style="margin-top: 5px">
{!! $row->column(Dcat\Admin\Grid\Column::SELECT_COLUMN_NAME) !!}
<div>{!! $row->column(Dcat\Admin\Grid\Column::ACTION_COLUMN_NAME) !!}</div>
</span>
</div>
</li>
@endforeach
</ul>
</div>
{!! $grid->renderFooter() !!}
@include('admin::grid.table-pagination')
</div>
<style>
.row {
margin: 0;
}
.col-md-12,
.col-md-3 {
padding: 0;
}
@media screen and (min-width: 1000px) and (max-width: 1150px) {
.col-lg-3,
.col-lg-9 {
flex: 0 0 50%;
max-width: 50%;
}
}
@media screen and (min-width: 1151px) and (max-width: 1300px) {
.col-lg-3 {
flex: 0 0 40%;
max-width: 40%;
}
.col-lg-9 {
flex: 0 0 60%;
max-width: 60%;
}
}
@media screen and (min-width: 1301px) and (max-width: 1700px) {
.col-lg-3 {
flex: 0 0 35%;
max-width: 35%;
}
.col-lg-9 {
flex: 0 0 65%;
max-width: 65%;
}
}
.login-page {
height: auto;
}
.login-main {
position: relative;
display: flex;
min-height: 100vh;
flex-direction: row;
align-items: stretch;
margin: 0;
}
.login-main .login-page {
background-color: #fff;
}
.login-main .card {
box-shadow: none;
}
.login-main .auth-brand {
margin: 4rem 0 4rem;
font-size: 26px;
width: 325px;
}
@media (max-width: 576px) {
.login-main .auth-brand {
width: 90%;
margin-left: 24px
}
}
.login-main .login-logo {
font-size: 2.1rem;
font-weight: 300;
margin-bottom: 0.9rem;
text-align: left;
margin-left: 20px;
}
.login-main .login-box-msg {
margin: 0;
padding: 0 0 20px;
font-size: 0.9rem;
font-weight: 400;
text-align: left;
}
.login-main .btn {
width: 100%;
}
.login-page-right {
padding: 6rem 3rem;
flex: 1;
position: relative;
color: #fff;
background-color: rgba(0, 0, 0, 0.3);
text-align: center !important;
background: url(/vendor/dcat-admin/images/bg.jpg) center;
background-size: cover;
}
.login-description {
position: absolute;
margin: 0 auto;
padding: 0 1.75rem;
bottom: 3rem;
left: 0;
right: 0;
}
.content-front {
position: absolute;
left: 0;
right: 0;
height: 100vh;
background: rgba(0,0,0,.1);
margin-top: -6rem;
}
body.dark-mode .content-front {
background: rgba(0,0,0,.3);
}
body.dark-mode .auth-brand {
color: #cacbd6
}
</style>
<div class="row login-main">
<div class="col-lg-3 col-12 bg-white">
<div class="login-page">
<div class="auth-brand text-lg-left">
{!! config('admin.logo') !!}
</div>
<div class="login-box">
<div class="login-logo mb-2">
<h4 class="mt-0"></h4>
<p class="login-box-msg mt-1 mb-1">{{ __('admin.welcome_back') }}</p>
</div>
<div class="card">
<div class="card-body login-card-body">
<form id="login-form" method="POST" action="{{ admin_url('auth/login') }}">
<input type="hidden" name="_token" value="{{ csrf_token() }}"/>
<fieldset class="form-label-group form-group position-relative has-icon-left">
<input
type="text"
class="form-control {{ $errors->has('username') ? 'is-invalid' : '' }}"
name="username"
placeholder="{{ trans('admin.username') }}"
value=""
required
autofocus
>
<div class="form-control-position">
<i class="feather icon-user"></i>
</div>
<label for="email">{{ trans('admin.username') }}</label>
<div class="help-block with-errors"></div>
@if($errors->has('username'))
<span class="invalid-feedback text-danger" role="alert">
@foreach($errors->get('username') as $message)
<span class="control-label" for="inputError"><i class="feather icon-x-circle"></i> {{$message}}</span><br>
@endforeach
</span>
@endif
</fieldset>
<fieldset class="form-label-group form-group position-relative has-icon-left">
<input
minlength="5"
maxlength="20"
id="password"
type="password"
class="form-control {{ $errors->has('password') ? 'is-invalid' : '' }}"
name="password"
placeholder="{{ trans('admin.password') }}"
required
value=""
autocomplete="current-password"
>
<div class="form-control-position">
<i class="feather icon-lock"></i>
</div>
<label for="password">{{ trans('admin.password') }}</label>
<div class="help-block with-errors"></div>
@if($errors->has('password'))
<span class="invalid-feedback text-danger" role="alert">
@foreach($errors->get('password') as $message)
<span class="control-label" for="inputError"><i class="feather icon-x-circle"></i> {{$message}}</span><br>
@endforeach
</span>
@endif
</fieldset>
<div class="form-group d-flex justify-content-between align-items-center">
<div class="text-left">
<fieldset class="checkbox">
<div class="vs-checkbox-con vs-checkbox-primary">
<input id="remember" name="remember" value="1" type="checkbox" {{ old('remember') ? 'checked' : '' }}>
<span class="vs-checkbox">
<span class="vs-checkbox--check">
<i class="vs-icon feather icon-check"></i>
</span>
</span>
<span> {{ trans('admin.remember_me') }}</span>
</div>
</fieldset>
</div>
</div>
<button type="submit" class="btn btn-primary float-right login-btn">
{{ __('admin.login') }}
&nbsp;
<i class="feather icon-arrow-right"></i>
</button>
</form>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-9 col-12 login-page-right">
<div class="content-front"></div>
<div class="login-description">
<p class="lead">
</p>
<p>
</p>
</div>
</div>
</div>
<script>
Dcat.ready(function () {
// ajax表单提交
$('#login-form').form({
validate: true,
});
});
</script>
<style>
.row {
margin: 0;
}
.col-md-12,
.col-md-3 {
padding: 0;
}
@media screen and (min-width: 1000px) and (max-width: 1150px) {
.col-lg-3,
.col-lg-9 {
flex: 0 0 50%;
max-width: 50%;
}
}
@media screen and (min-width: 1151px) and (max-width: 1300px) {
.col-lg-3 {
flex: 0 0 40%;
max-width: 40%;
}
.col-lg-9 {
flex: 0 0 60%;
max-width: 60%;
}
}
@media screen and (min-width: 1301px) and (max-width: 1700px) {
.col-lg-3 {
flex: 0 0 35%;
max-width: 35%;
}
.col-lg-9 {
flex: 0 0 65%;
max-width: 65%;
}
}
.login-page {
height: auto;
}
.login-main {
position: relative;
display: flex;
min-height: 100vh;
flex-direction: row;
align-items: stretch;
margin: 0;
}
.login-main .login-page {
background-color: #fff;
}
.login-main .card {
box-shadow: none;
}
.login-main .auth-brand {
margin: 4rem 0 4rem;
font-size: 26px;
width: 325px;
}
@media (max-width: 576px) {
.login-main .auth-brand {
width: 90%;
margin-left: 24px
}
}
.login-main .login-logo {
font-size: 2.1rem;
font-weight: 300;
margin-bottom: 0.9rem;
text-align: left;
margin-left: 20px;
}
.login-main .login-box-msg {
margin: 0;
padding: 0 0 20px;
font-size: 0.9rem;
font-weight: 400;
text-align: left;
}
.login-main .btn {
width: 100%;
}
.login-page-right {
padding: 6rem 3rem;
flex: 1;
position: relative;
color: #fff;
background-color: rgba(0, 0, 0, 0.3);
text-align: center !important;
background: url(/vendor/dcat-admin/images/bg.jpg) center;
background-size: cover;
}
.login-description {
position: absolute;
margin: 0 auto;
padding: 0 1.75rem;
bottom: 3rem;
left: 0;
right: 0;
}
.content-front {
position: absolute;
left: 0;
right: 0;
height: 100vh;
background: rgba(0, 0, 0, .1);
margin-top: -6rem;
}
body.dark-mode .content-front {
background: rgba(0, 0, 0, .3);
}
body.dark-mode .auth-brand {
color: #cacbd6
}
</style>
<form id="form-table" action="" method="get" class="form-horizontal" accept-charset="UTF-8" pjax-container="1">
<div class="row">
<div class="col-md-12">
<table class="table">
<thead>
<tr>
<th width="20%" style="text-align:center;">商品名称</th>
<th width="20%" style="text-align:center;">商品规格</th>
<th width="20%" style="text-align:center;">增加库存</th>
<th width="20%" style="text-align:center;">剩余库存</th>
</tr>
</thead>
<tbody>
<!-- 表格数据 -->
<tr>
<td style="text-align:center;vertical-align: middle;">数据1</td>
<td style="text-align:center;vertical-align: middle;">蓝色、大号</td>
<td><input type="text" name="remark" value="" class="form-control field_remark _normal_" placeholder=""></td>
<td style="text-align:center;vertical-align: middle;">123</td>
</tr>
<!-- 更多行数据 -->
</tbody>
</table>
</div>
<div class="col-md-8"><button type="button" id="submit-form" class="btn btn-primary pull-right"><i class="feather icon-save"></i> 提交</button></div>
</div>
</form>
<!--<form id="login-form" method="POST" action="{{ admin_url('auth/login') }}">
<input type="hidden" name="_token" value="{{ csrf_token() }}" />
<fieldset class="form-label-group form-group position-relative has-icon-left">
<input
type="text"
class="form-control {{ $errors->has('username') ? 'is-invalid' : '' }}"
name="username"
placeholder="{{ trans('admin.username') }}"
value=""
required
autofocus>
<div class="form-control-position">
<i class="feather icon-user"></i>
</div>
<label for="email">{{ trans('admin.username') }}</label>
<div class="help-block with-errors"></div>
@if($errors->has('username'))
<span class="invalid-feedback text-danger" role="alert">
@foreach($errors->get('username') as $message)
<span class="control-label" for="inputError"><i class="feather icon-x-circle"></i> {{$message}}</span><br>
@endforeach
</span>
@endif
</fieldset>
<fieldset class="form-label-group form-group position-relative has-icon-left">
<input
minlength="5"
maxlength="20"
id="password"
type="password"
class="form-control {{ $errors->has('password') ? 'is-invalid' : '' }}"
name="password"
placeholder="{{ trans('admin.password') }}"
required
value=""
autocomplete="current-password">
<div class="form-control-position">
<i class="feather icon-lock"></i>
</div>
<label for="password">{{ trans('admin.password') }}</label>
<div class="help-block with-errors"></div>
@if($errors->has('password'))
<span class="invalid-feedback text-danger" role="alert">
@foreach($errors->get('password') as $message)
<span class="control-label" for="inputError"><i class="feather icon-x-circle"></i> {{$message}}</span><br>
@endforeach
</span>
@endif
</fieldset>
<div class="form-group d-flex justify-content-between align-items-center">
<div class="text-left">
<fieldset class="checkbox">
<div class="vs-checkbox-con vs-checkbox-primary">
<input id="remember" name="remember" value="1" type="checkbox" {{ old('remember') ? 'checked' : '' }}>
<span class="vs-checkbox">
<span class="vs-checkbox--check">
<i class="vs-icon feather icon-check"></i>
</span>
</span>
<span> {{ trans('admin.remember_me') }}</span>
</div>
</fieldset>
</div>
</div>
<button type="submit" class="btn btn-primary float-right login-btn">
{{ __('admin.login') }}
&nbsp;
<i class="feather icon-arrow-right"></i>
</button>
</form>-->
<script>
Dcat.ready(function() {
// ajax表单提交
$('#login-form').form({
validate: true,
});
// 前端 JS 代码处理异步提交
});
</script>
<script data-exec-on-popstate="">
(function() {
try {
Dcat.wait()
} catch (e) {
console.error(e)
}
})();
Dcat.ready(function() {
try {
Dcat.token = "GQ11udjNxjua45vZwdgc5AlhnAGg0NQ7RKkEE1bx";;
$("#form-41c1e3EN").form({
validate: true,
confirm: [],
validationErrorToastr: true,
success: function(data) {
},
error: function(response) {
}
});
} catch (e) {
console.error(e)
}
})
</script>
\ No newline at end of file
<style>
.row {
margin: 0;
}
.col-md-12,
.col-md-3 {
padding: 0;
}
@media screen and (min-width: 1000px) and (max-width: 1150px) {
.col-lg-3,
.col-lg-9 {
flex: 0 0 50%;
max-width: 50%;
}
}
@media screen and (min-width: 1151px) and (max-width: 1300px) {
.col-lg-3 {
flex: 0 0 40%;
max-width: 40%;
}
.col-lg-9 {
flex: 0 0 60%;
max-width: 60%;
}
}
@media screen and (min-width: 1301px) and (max-width: 1700px) {
.col-lg-3 {
flex: 0 0 35%;
max-width: 35%;
}
.col-lg-9 {
flex: 0 0 65%;
max-width: 65%;
}
}
.login-page {
height: auto;
}
.login-main {
position: relative;
display: flex;
min-height: 100vh;
flex-direction: row;
align-items: stretch;
margin: 0;
}
.login-main .login-page {
background-color: #fff;
}
.login-main .card {
box-shadow: none;
}
.login-main .auth-brand {
margin: 4rem 0 4rem;
font-size: 26px;
width: 325px;
}
@media (max-width: 576px) {
.login-main .auth-brand {
width: 90%;
margin-left: 24px
}
}
.login-main .login-logo {
font-size: 2.1rem;
font-weight: 300;
margin-bottom: 0.9rem;
text-align: left;
margin-left: 20px;
}
.login-main .login-box-msg {
margin: 0;
padding: 0 0 20px;
font-size: 0.9rem;
font-weight: 400;
text-align: left;
}
.login-main .btn {
width: 100%;
}
.login-page-right {
padding: 6rem 3rem;
flex: 1;
position: relative;
color: #fff;
background-color: rgba(0, 0, 0, 0.3);
text-align: center !important;
background: url(/vendor/dcat-admin/images/bg.jpg) center;
background-size: cover;
}
.login-description {
position: absolute;
margin: 0 auto;
padding: 0 1.75rem;
bottom: 3rem;
left: 0;
right: 0;
}
.content-front {
position: absolute;
left: 0;
right: 0;
height: 100vh;
background: rgba(0, 0, 0, .1);
margin-top: -6rem;
}
body.dark-mode .content-front {
background: rgba(0, 0, 0, .3);
}
body.dark-mode .auth-brand {
color: #cacbd6
}
</style>
<form method="POST" class="form-horizontal" accept-charset="UTF-8" pjax-container="1" action="http://aimeiyue.demo.cn/dcat-api/form" id="form-dmQQKJfR" novalidate="true">
<div class="box-body fields-group pl-0 pr-0 pt-1" style="padding: 0 0 .5rem">
<div class="form-group row form-field">
<div class="col-md-2 text-capitalize asterisk control-label">
<span>商家名称</span>
</div>
<div class="col-md-8 ">
<div class="help-block with-errors"></div>
<div class="input-group">
<span class="input-group-prepend"><span class="input-group-text bg-white"><i class="feather icon-edit-2"></i></span></span>
<input required="1" type="text" name="name" value="John Doe11111111111" class="form-control field_name _normal_" placeholder="输入 商家名称">
</div>
</div>
</div>
<div class="form-group row form-field">
<div class="col-md-2 text-capitalize control-label">
<span>邮箱</span>
</div>
<div class="col-md-8 ">
<div class="help-block with-errors"></div>
<div class="input-group">
<span class="input-group-prepend"><span class="input-group-text bg-white"><i class="feather icon-mail"></i></span></span>
<input type="email" name="email" value="John.Doe@gmail.com" class="form-control field_email _normal_" placeholder="输入 邮箱">
</div>
</div>
</div>
<input type="hidden" name="_form_" value="App\Admin\Forms\MerchantStoreForms" class="field__form_ _normal_">
<input type="hidden" name="_current_" value="http://aimeiyue.demo.cn/merchant-store?" class="field__current_ _normal_">
<input type="hidden" name="_payload_" value="{&quot;_current_&quot;:&quot;http:\/\/aimeiyue.demo.cn\/merchant-store?&quot;,&quot;s&quot;:&quot;\/\/dcat-api\/render&quot;,&quot;renderable&quot;:&quot;App_Admin_Forms_MerchantStoreForms&quot;,&quot;_trans_&quot;:&quot;merchant-store&quot;}" class="field__payload_ _normal_">
</div>
<div class="box-footer row d-flex">
<div class="col-md-2"> &nbsp;</div>
<div class="col-md-8"><button type="reset" class="btn btn-white pull-left"><i class="feather icon-rotate-ccw"></i> 重置</button><button type="submit" class="btn btn-primary pull-right"><i class="feather icon-save"></i> 提交</button></div>
</div>
</form>
<!--<form id="login-form" method="POST" action="{{ admin_url('auth/login') }}">
<input type="hidden" name="_token" value="{{ csrf_token() }}" />
<fieldset class="form-label-group form-group position-relative has-icon-left">
<input
type="text"
class="form-control {{ $errors->has('username') ? 'is-invalid' : '' }}"
name="username"
placeholder="{{ trans('admin.username') }}"
value=""
required
autofocus>
<div class="form-control-position">
<i class="feather icon-user"></i>
</div>
<label for="email">{{ trans('admin.username') }}</label>
<div class="help-block with-errors"></div>
@if($errors->has('username'))
<span class="invalid-feedback text-danger" role="alert">
@foreach($errors->get('username') as $message)
<span class="control-label" for="inputError"><i class="feather icon-x-circle"></i> {{$message}}</span><br>
@endforeach
</span>
@endif
</fieldset>
<fieldset class="form-label-group form-group position-relative has-icon-left">
<input
minlength="5"
maxlength="20"
id="password"
type="password"
class="form-control {{ $errors->has('password') ? 'is-invalid' : '' }}"
name="password"
placeholder="{{ trans('admin.password') }}"
required
value=""
autocomplete="current-password">
<div class="form-control-position">
<i class="feather icon-lock"></i>
</div>
<label for="password">{{ trans('admin.password') }}</label>
<div class="help-block with-errors"></div>
@if($errors->has('password'))
<span class="invalid-feedback text-danger" role="alert">
@foreach($errors->get('password') as $message)
<span class="control-label" for="inputError"><i class="feather icon-x-circle"></i> {{$message}}</span><br>
@endforeach
</span>
@endif
</fieldset>
<div class="form-group d-flex justify-content-between align-items-center">
<div class="text-left">
<fieldset class="checkbox">
<div class="vs-checkbox-con vs-checkbox-primary">
<input id="remember" name="remember" value="1" type="checkbox" {{ old('remember') ? 'checked' : '' }}>
<span class="vs-checkbox">
<span class="vs-checkbox--check">
<i class="vs-icon feather icon-check"></i>
</span>
</span>
<span> {{ trans('admin.remember_me') }}</span>
</div>
</fieldset>
</div>
</div>
<button type="submit" class="btn btn-primary float-right login-btn">
{{ __('admin.login') }}
&nbsp;
<i class="feather icon-arrow-right"></i>
</button>
</form>-->
<script data-exec-on-popstate="">
(function() {
try {
Dcat.wait()
} catch (e) {
console.error(e)
}
})();
Dcat.ready(function() {
try {
Dcat.token = "GQ11udjNxjua45vZwdgc5AlhnAGg0NQ7RKkEE1bx";;
$("#form-41c1e3EN").form({
validate: true,
confirm: [],
validationErrorToastr: true,
success: function(data) {
},
error: function(response) {
}
});
} catch (e) {
console.error(e)
}
document.getElementById('form-dmQQKJfR').addEventListener('submit', function(event) {
event.preventDefault(); // 阻止表单默认提交行为
var formData = new FormData(this); // 创建 FormData 对象
fetch('http://aimeiyue.demo.cn/dcat-api/form', { // 替换为你的提交地址
method: 'POST',
body: formData
})
.then(response => response.json()) // 如果服务器返回 JSON 数据
.then(data => {
// 处理服务器返回的数据
console.log(data);
})
.catch(error => {
// 处理错误
console.error('Error:', error);
});
});
})
</script>
\ No newline at end of file
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<!-- Fonts -->
<link href="https://fonts.bunny.net/css2?family=Nunito:wght@400;600;700&display=swap" rel="stylesheet">
<!-- Styles -->
<style>
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}a{background-color:transparent}[hidden]{display:none}html{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}*,:after,:before{box-sizing:border-box;border:0 solid #e2e8f0}a{color:inherit;text-decoration:inherit}svg,video{display:block;vertical-align:middle}video{max-width:100%;height:auto}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity))}.border-t{border-top-width:1px}.flex{display:flex}.grid{display:grid}.hidden{display:none}.items-center{align-items:center}.justify-center{justify-content:center}.font-semibold{font-weight:600}.h-5{height:1.25rem}.h-8{height:2rem}.h-16{height:4rem}.text-sm{font-size:.875rem}.text-lg{font-size:1.125rem}.leading-7{line-height:1.75rem}.mx-auto{margin-left:auto;margin-right:auto}.ml-1{margin-left:.25rem}.mt-2{margin-top:.5rem}.mr-2{margin-right:.5rem}.ml-2{margin-left:.5rem}.mt-4{margin-top:1rem}.ml-4{margin-left:1rem}.mt-8{margin-top:2rem}.ml-12{margin-left:3rem}.-mt-px{margin-top:-1px}.max-w-6xl{max-width:72rem}.min-h-screen{min-height:100vh}.overflow-hidden{overflow:hidden}.p-6{padding:1.5rem}.py-4{padding-top:1rem;padding-bottom:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.pt-8{padding-top:2rem}.fixed{position:fixed}.relative{position:relative}.top-0{top:0}.right-0{right:0}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.text-center{text-align:center}.text-gray-200{--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity))}.underline{text-decoration:underline}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.w-5{width:1.25rem}.w-8{width:2rem}.w-auto{width:auto}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}@media (min-width:640px){.sm\:rounded-lg{border-radius:.5rem}.sm\:block{display:block}.sm\:items-center{align-items:center}.sm\:justify-start{justify-content:flex-start}.sm\:justify-between{justify-content:space-between}.sm\:h-20{height:5rem}.sm\:ml-0{margin-left:0}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:pt-0{padding-top:0}.sm\:text-left{text-align:left}.sm\:text-right{text-align:right}}@media (min-width:768px){.md\:border-t-0{border-top-width:0}.md\:border-l{border-left-width:1px}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (min-width:1024px){.lg\:px-8{padding-left:2rem;padding-right:2rem}}@media (prefers-color-scheme:dark){.dark\:bg-gray-800{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity))}.dark\:bg-gray-900{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity))}.dark\:border-gray-700{--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity))}.dark\:text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.dark\:text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity))}.dark\:text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity))}}
</style>
<style>
body {
font-family: 'Nunito', sans-serif;
}
</style>
</head>
<body class="antialiased">
<div class="relative flex items-top justify-center min-h-screen bg-gray-100 dark:bg-gray-900 sm:items-center py-4 sm:pt-0">
@if (Route::has('login'))
<div class="hidden fixed top-0 right-0 px-6 py-4 sm:block">
@auth
<a href="{{ url('/home') }}" class="text-sm text-gray-700 dark:text-gray-500 underline">Home</a>
@else
<a href="{{ route('login') }}" class="text-sm text-gray-700 dark:text-gray-500 underline">Log in</a>
@if (Route::has('register'))
<a href="{{ route('register') }}" class="ml-4 text-sm text-gray-700 dark:text-gray-500 underline">Register</a>
@endif
@endauth
</div>
@endif
<div class="max-w-6xl mx-auto sm:px-6 lg:px-8">
<div class="flex justify-center pt-8 sm:justify-start sm:pt-0">
<svg viewBox="0 0 651 192" fill="none" xmlns="http://www.w3.org/2000/svg" class="h-16 w-auto text-gray-700 sm:h-20">
<g clip-path="url(#clip0)" fill="#EF3B2D">
<path d="M248.032 44.676h-16.466v100.23h47.394v-14.748h-30.928V44.676zM337.091 87.202c-2.101-3.341-5.083-5.965-8.949-7.875-3.865-1.909-7.756-2.864-11.669-2.864-5.062 0-9.69.931-13.89 2.792-4.201 1.861-7.804 4.417-10.811 7.661-3.007 3.246-5.347 6.993-7.016 11.239-1.672 4.249-2.506 8.713-2.506 13.389 0 4.774.834 9.26 2.506 13.459 1.669 4.202 4.009 7.925 7.016 11.169 3.007 3.246 6.609 5.799 10.811 7.66 4.199 1.861 8.828 2.792 13.89 2.792 3.913 0 7.804-.955 11.669-2.863 3.866-1.908 6.849-4.533 8.949-7.875v9.021h15.607V78.182h-15.607v9.02zm-1.431 32.503c-.955 2.578-2.291 4.821-4.009 6.73-1.719 1.91-3.795 3.437-6.229 4.582-2.435 1.146-5.133 1.718-8.091 1.718-2.96 0-5.633-.572-8.019-1.718-2.387-1.146-4.438-2.672-6.156-4.582-1.719-1.909-3.032-4.152-3.938-6.73-.909-2.577-1.36-5.298-1.36-8.161 0-2.864.451-5.585 1.36-8.162.905-2.577 2.219-4.819 3.938-6.729 1.718-1.908 3.77-3.437 6.156-4.582 2.386-1.146 5.059-1.718 8.019-1.718 2.958 0 5.656.572 8.091 1.718 2.434 1.146 4.51 2.674 6.229 4.582 1.718 1.91 3.054 4.152 4.009 6.729.953 2.577 1.432 5.298 1.432 8.162-.001 2.863-.479 5.584-1.432 8.161zM463.954 87.202c-2.101-3.341-5.083-5.965-8.949-7.875-3.865-1.909-7.756-2.864-11.669-2.864-5.062 0-9.69.931-13.89 2.792-4.201 1.861-7.804 4.417-10.811 7.661-3.007 3.246-5.347 6.993-7.016 11.239-1.672 4.249-2.506 8.713-2.506 13.389 0 4.774.834 9.26 2.506 13.459 1.669 4.202 4.009 7.925 7.016 11.169 3.007 3.246 6.609 5.799 10.811 7.66 4.199 1.861 8.828 2.792 13.89 2.792 3.913 0 7.804-.955 11.669-2.863 3.866-1.908 6.849-4.533 8.949-7.875v9.021h15.607V78.182h-15.607v9.02zm-1.432 32.503c-.955 2.578-2.291 4.821-4.009 6.73-1.719 1.91-3.795 3.437-6.229 4.582-2.435 1.146-5.133 1.718-8.091 1.718-2.96 0-5.633-.572-8.019-1.718-2.387-1.146-4.438-2.672-6.156-4.582-1.719-1.909-3.032-4.152-3.938-6.73-.909-2.577-1.36-5.298-1.36-8.161 0-2.864.451-5.585 1.36-8.162.905-2.577 2.219-4.819 3.938-6.729 1.718-1.908 3.77-3.437 6.156-4.582 2.386-1.146 5.059-1.718 8.019-1.718 2.958 0 5.656.572 8.091 1.718 2.434 1.146 4.51 2.674 6.229 4.582 1.718 1.91 3.054 4.152 4.009 6.729.953 2.577 1.432 5.298 1.432 8.162 0 2.863-.479 5.584-1.432 8.161zM650.772 44.676h-15.606v100.23h15.606V44.676zM365.013 144.906h15.607V93.538h26.776V78.182h-42.383v66.724zM542.133 78.182l-19.616 51.096-19.616-51.096h-15.808l25.617 66.724h19.614l25.617-66.724h-15.808zM591.98 76.466c-19.112 0-34.239 15.706-34.239 35.079 0 21.416 14.641 35.079 36.239 35.079 12.088 0 19.806-4.622 29.234-14.688l-10.544-8.158c-.006.008-7.958 10.449-19.832 10.449-13.802 0-19.612-11.127-19.612-16.884h51.777c2.72-22.043-11.772-40.877-33.023-40.877zm-18.713 29.28c.12-1.284 1.917-16.884 18.589-16.884 16.671 0 18.697 15.598 18.813 16.884h-37.402zM184.068 43.892c-.024-.088-.073-.165-.104-.25-.058-.157-.108-.316-.191-.46-.056-.097-.137-.176-.203-.265-.087-.117-.161-.242-.265-.345-.085-.086-.194-.148-.29-.223-.109-.085-.206-.182-.327-.252l-.002-.001-.002-.002-35.648-20.524a2.971 2.971 0 00-2.964 0l-35.647 20.522-.002.002-.002.001c-.121.07-.219.167-.327.252-.096.075-.205.138-.29.223-.103.103-.178.228-.265.345-.066.089-.147.169-.203.265-.083.144-.133.304-.191.46-.031.085-.08.162-.104.25-.067.249-.103.51-.103.776v38.979l-29.706 17.103V24.493a3 3 0 00-.103-.776c-.024-.088-.073-.165-.104-.25-.058-.157-.108-.316-.191-.46-.056-.097-.137-.176-.203-.265-.087-.117-.161-.242-.265-.345-.085-.086-.194-.148-.29-.223-.109-.085-.206-.182-.327-.252l-.002-.001-.002-.002L40.098 1.396a2.971 2.971 0 00-2.964 0L1.487 21.919l-.002.002-.002.001c-.121.07-.219.167-.327.252-.096.075-.205.138-.29.223-.103.103-.178.228-.265.345-.066.089-.147.169-.203.265-.083.144-.133.304-.191.46-.031.085-.08.162-.104.25-.067.249-.103.51-.103.776v122.09c0 1.063.568 2.044 1.489 2.575l71.293 41.045c.156.089.324.143.49.202.078.028.15.074.23.095a2.98 2.98 0 001.524 0c.069-.018.132-.059.2-.083.176-.061.354-.119.519-.214l71.293-41.045a2.971 2.971 0 001.489-2.575v-38.979l34.158-19.666a2.971 2.971 0 001.489-2.575V44.666a3.075 3.075 0 00-.106-.774zM74.255 143.167l-29.648-16.779 31.136-17.926.001-.001 34.164-19.669 29.674 17.084-21.772 12.428-43.555 24.863zm68.329-76.259v33.841l-12.475-7.182-17.231-9.92V49.806l12.475 7.182 17.231 9.92zm2.97-39.335l29.693 17.095-29.693 17.095-29.693-17.095 29.693-17.095zM54.06 114.089l-12.475 7.182V46.733l17.231-9.92 12.475-7.182v74.537l-17.231 9.921zM38.614 7.398l29.693 17.095-29.693 17.095L8.921 24.493 38.614 7.398zM5.938 29.632l12.475 7.182 17.231 9.92v79.676l.001.005-.001.006c0 .114.032.221.045.333.017.146.021.294.059.434l.002.007c.032.117.094.222.14.334.051.124.088.255.156.371a.036.036 0 00.004.009c.061.105.149.191.222.288.081.105.149.22.244.314l.008.01c.084.083.19.142.284.215.106.083.202.178.32.247l.013.005.011.008 34.139 19.321v34.175L5.939 144.867V29.632h-.001zm136.646 115.235l-65.352 37.625V148.31l48.399-27.628 16.953-9.677v33.862zm35.646-61.22l-29.706 17.102V66.908l17.231-9.92 12.475-7.182v33.841z"/>
</g>
</svg>
</div>
<div class="mt-8 bg-white dark:bg-gray-800 overflow-hidden shadow sm:rounded-lg">
<div class="grid grid-cols-1 md:grid-cols-2">
<div class="p-6">
<div class="flex items-center">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-8 h-8 text-gray-500"><path stroke-linecap="round" stroke-linejoin="round" d="M12 6.042A8.967 8.967 0 006 3.75c-1.052 0-2.062.18-3 .512v14.25A8.987 8.987 0 016 18c2.305 0 4.408.867 6 2.292m0-14.25a8.966 8.966 0 016-2.292c1.052 0 2.062.18 3 .512v14.25A8.987 8.987 0 0018 18a8.967 8.967 0 00-6 2.292m0-14.25v14.25" /></svg>
<div class="ml-4 text-lg leading-7 font-semibold"><a href="https://laravel.com/docs" class="underline text-gray-900 dark:text-white">Documentation</a></div>
</div>
<div class="ml-12">
<div class="mt-2 text-gray-600 dark:text-gray-400 text-sm">
Laravel has wonderful, thorough documentation covering every aspect of the framework. Whether you are new to the framework or have previous experience with Laravel, we recommend reading all of the documentation from beginning to end.
</div>
</div>
</div>
<div class="p-6 border-t border-gray-200 dark:border-gray-700 md:border-t-0 md:border-l">
<div class="flex items-center">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-8 h-8 text-gray-500"><path stroke-linecap="round" d="M15.75 10.5l4.72-4.72a.75.75 0 011.28.53v11.38a.75.75 0 01-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25h-9A2.25 2.25 0 002.25 7.5v9a2.25 2.25 0 002.25 2.25z" /></svg>
<div class="ml-4 text-lg leading-7 font-semibold"><a href="https://laracasts.com" class="underline text-gray-900 dark:text-white">Laracasts</a></div>
</div>
<div class="ml-12">
<div class="mt-2 text-gray-600 dark:text-gray-400 text-sm">
Laracasts offers thousands of video tutorials on Laravel, PHP, and JavaScript development. Check them out, see for yourself, and massively level up your development skills in the process.
</div>
</div>
</div>
<div class="p-6 border-t border-gray-200 dark:border-gray-700">
<div class="flex items-center">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-8 h-8 text-gray-500"><path stroke-linecap="round" stroke-linejoin="round" d="M7.5 8.25h9m-9 3H12m-9.75 1.51c0 1.6 1.123 2.994 2.707 3.227 1.129.166 2.27.293 3.423.379.35.026.67.21.865.501L12 21l2.755-4.133a1.14 1.14 0 01.865-.501 48.172 48.172 0 003.423-.379c1.584-.233 2.707-1.626 2.707-3.228V6.741c0-1.602-1.123-2.995-2.707-3.228A48.394 48.394 0 0012 3c-2.392 0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018z" /></svg>
<div class="ml-4 text-lg leading-7 font-semibold"><a href="https://laravel-news.com/" class="underline text-gray-900 dark:text-white">Laravel News</a></div>
</div>
<div class="ml-12">
<div class="mt-2 text-gray-600 dark:text-gray-400 text-sm">
Laravel News is a community driven portal and newsletter aggregating all of the latest and most important news in the Laravel ecosystem, including new package releases and tutorials.
</div>
</div>
</div>
<div class="p-6 border-t border-gray-200 dark:border-gray-700 md:border-l">
<div class="flex items-center">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-8 h-8 text-gray-500"><path stroke-linecap="round" stroke-linejoin="round" d="M6.115 5.19l.319 1.913A6 6 0 008.11 10.36L9.75 12l-.387.775c-.217.433-.132.956.21 1.298l1.348 1.348c.21.21.329.497.329.795v1.089c0 .426.24.815.622 1.006l.153.076c.433.217.956.132 1.298-.21l.723-.723a8.7 8.7 0 002.288-4.042 1.087 1.087 0 00-.358-1.099l-1.33-1.108c-.251-.21-.582-.299-.905-.245l-1.17.195a1.125 1.125 0 01-.98-.314l-.295-.295a1.125 1.125 0 010-1.591l.13-.132a1.125 1.125 0 011.3-.21l.603.302a.809.809 0 001.086-1.086L14.25 7.5l1.256-.837a4.5 4.5 0 001.528-1.732l.146-.292M6.115 5.19A9 9 0 1017.18 4.64M6.115 5.19A8.965 8.965 0 0112 3c1.929 0 3.716.607 5.18 1.64" /></svg>
<div class="ml-4 text-lg leading-7 font-semibold text-gray-900 dark:text-white">Vibrant Ecosystem</div>
</div>
<div class="ml-12">
<div class="mt-2 text-gray-600 dark:text-gray-400 text-sm">
Laravel's robust library of first-party tools and libraries, such as <a href="https://forge.laravel.com" class="underline">Forge</a>, <a href="https://vapor.laravel.com" class="underline">Vapor</a>, <a href="https://nova.laravel.com" class="underline">Nova</a>, and <a href="https://envoyer.io" class="underline">Envoyer</a> help you take your projects to the next level. Pair them with powerful open source libraries like <a href="https://laravel.com/docs/billing" class="underline">Cashier</a>, <a href="https://laravel.com/docs/dusk" class="underline">Dusk</a>, <a href="https://laravel.com/docs/broadcasting" class="underline">Echo</a>, <a href="https://laravel.com/docs/horizon" class="underline">Horizon</a>, <a href="https://laravel.com/docs/sanctum" class="underline">Sanctum</a>, <a href="https://laravel.com/docs/telescope" class="underline">Telescope</a>, and more.
</div>
</div>
</div>
</div>
</div>
<div class="flex justify-center mt-4 sm:items-center sm:justify-between">
<div class="text-center text-sm text-gray-500 sm:text-left">
<div class="flex items-center">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="-mt-px w-5 h-5 text-gray-400">
<path stroke-linecap="round" stroke-linejoin="round" d="M2.25 3h1.386c.51 0 .955.343 1.087.835l.383 1.437M7.5 14.25a3 3 0 00-3 3h15.75m-12.75-3h11.218c1.121-2.3 2.1-4.684 2.924-7.138a60.114 60.114 0 00-16.536-1.84M7.5 14.25L5.106 5.272M6 20.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm12.75 0a.75.75 0 11-1.5 0 .75.75 0 011.5 0z" />
</svg>
<a href="https://laravel.bigcartel.com" class="ml-1 underline">
Shop
</a>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="ml-4 -mt-px w-5 h-5 text-gray-400">
<path stroke-linecap="round" stroke-linejoin="round" d="M21 8.25c0-2.485-2.099-4.5-4.688-4.5-1.935 0-3.597 1.126-4.312 2.733-.715-1.607-2.377-2.733-4.313-2.733C5.1 3.75 3 5.765 3 8.25c0 7.22 9 12 9 12s9-4.78 9-12z" />
</svg>
<a href="https://github.com/sponsors/taylorotwell" class="ml-1 underline">
Sponsor
</a>
</div>
</div>
<div class="ml-4 text-center text-sm text-gray-500 sm:text-right sm:ml-0">
Laravel v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }})
</div>
</div>
</div>
</div>
</body>
</html>
<?php
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
//Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
// return $request->user();
//});
Route::namespace('App\Http\Controllers\Api')->middleware('acceptJson')->group(function () {
Route::post('get-openid', 'LoginController@getOpenid'); //获取openid
Route::post('login', 'LoginController@login')->name('login'); //密码登录
Route::get('test-login', 'LoginController@testLogin'); //测试登录
Route::post('mobile-login', 'LoginController@mobilelogin'); //验证码登录
Route::post('register', 'LoginController@register')->name('register'); //注册
Route::post('reset', 'LoginController@reset'); //重新提交
Route::post('send-sms-code', 'LoginController@sendCode'); //发送短信
Route::post('update-pwd', 'UserController@updatePwd'); //修改密码
Route::get('carousel', 'CarouselController@getList'); //轮播列表
Route::get('get-cate-list', 'CategoryController@getList'); //一级分类列表
Route::get('get-seccate-list', 'CategoryController@getSecList'); //二级分类列表
Route::get('get-third-list', 'CategoryController@getThirdList'); //三级分类列表
Route::get('recommend-good', 'GoodController@getIndexGoods'); //首页商品列表
Route::get('goods-list', 'GoodController@getList'); //分类商品列表
Route::post('get-ajax-attr', 'GoodController@getAttrKey'); //商品规格查询
Route::get('get-kefu-list', 'KefuController@getList'); //客服列表
Route::get('hot-search', 'SystemSettingController@hotKeywords'); //配置基本信息
Route::post('upload-file', 'UserController@uploadFile'); //统一上传接口
Route::get('get-invite-bj', 'SystemSettingController@getBj'); //邀请背景
Route::get('get-good-detail', 'GoodController@getDetail'); //商品详情
Route::get('send/config/update', 'SystemController@update');
Route::middleware('auth:sanctum')->group(function () {
Route::get('user-info', 'UserController@info'); //获取用户资料
Route::get('logout', 'LoginController@logout'); //登出
Route::get('home', 'UserController@home'); //首页数据
Route::post('upload', 'UserController@uploadFile'); //统一上传接口
Route::get('qrCode', 'SystemSettingController@qrCode'); //生成二维码
Route::post('verification-qrCode', 'SystemSettingController@verificationGrCode'); //核销码二维码
Route::post('edit-user', 'UserController@editUser'); //修改用户资料
Route::get('user-share', 'UserController@share'); //用户二维码分享
Route::get('my-share', 'UserController@getMyShare'); //我的邀请
Route::post('bind-buycode', 'UserController@bindBuycode'); //绑定直购码
Route::post('add-shopping-cart', 'UserController@addShoppingCart'); //添加购物车
Route::get('show-shopping-cart', 'UserController@showShoppingCart'); //购物车详情
Route::post('reduce-shopping-cart', 'UserController@reduceShoppingCart'); //删减购物车
Route::post('express-collection', 'StoreController@getDeliveryList'); //快递代收点
Route::post('check-distance', 'StoreController@checkDistance'); //送货上门-距离判断
Route::post('create-buy-order', 'OrderController@CreateBuyOrder'); //创建订单--立即购买
Route::post('checkout-buy-order', 'OrderController@CheckoutBuyOrder'); //立即购买-确认订单
Route::post('checkout-cart-order', 'OrderController@CheckoutCartOrder'); //购物车-确认订单
Route::post('create-order', 'OrderController@CreateOrder'); //创建订单
Route::get('order-info', 'OrderController@OrderInfo'); //订单详情
Route::get('del-order', 'OrderController@delOrder'); //删除订单
Route::get('order-list', 'OrderController@orderList'); //订单列表
Route::post('cance-order', 'OrderController@canceOrder'); //取消订单
Route::get('address-list', 'UserController@getUserAddress'); //获取收货地址列表
Route::post('set-address', 'UserController@setUserAddress'); //设置收货地址
Route::post('del-address', 'UserController@delUserAddress'); //删除收货地址
Route::get('goods-collect', 'UserCollectController@collectOpt'); //商品收藏/取消收藏
Route::get('get-collect-list', 'UserCollectController@collectList'); //收藏列表
Route::get('is-collect', 'GoodController@isCollect'); //查询商品是否收藏
Route::post('upload-img', 'UserController@uploadImg'); //图片统一上传接口
Route::post('edit-user', 'UserController@editUser'); //更新用户
});
});
<?php
use Illuminate\Support\Facades\Broadcast;
/*
|--------------------------------------------------------------------------
| Broadcast Channels
|--------------------------------------------------------------------------
|
| Here you may register all of the event broadcasting channels that your
| application supports. The given channel authorization callbacks are
| used to check if an authenticated user can listen to the channel.
|
*/
Broadcast::channel('App.Models.User.{id}', function ($user, $id) {
return (int) $user->id === (int) $id;
});
<?php
use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan;
/*
|--------------------------------------------------------------------------
| Console Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of your Closure based console
| commands. Each Closure is bound to a command instance allowing a
| simple approach to interacting with each command's IO methods.
|
*/
Artisan::command('inspire', function () {
$this->comment(Inspiring::quote());
})->purpose('Display an inspiring quote');
<?php
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
return $request->user();
});
Route::get('/', function () {
return view('welcome');
});
*
!public/
!.gitignore
compiled.php
config.php
down
events.scanned.php
maintenance.php
routes.php
routes.scanned.php
schedule-*
services.json
<?php
namespace Tests;
use Illuminate\Contracts\Console\Kernel;
trait CreatesApplication
{
/**
* Creates the application.
*
* @return \Illuminate\Foundation\Application
*/
public function createApplication()
{
$app = require __DIR__.'/../bootstrap/app.php';
$app->make(Kernel::class)->bootstrap();
return $app;
}
}
<?php
namespace Tests\Feature;
// use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class ExampleTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function test_the_application_returns_a_successful_response()
{
$response = $this->get('/');
$response->assertStatus(200);
}
}
<?php
namespace Tests;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
use CreatesApplication;
}
<?php
namespace Tests\Unit;
use PHPUnit\Framework\TestCase;
class ExampleTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function test_that_true_is_true()
{
$this->assertTrue(true);
}
}
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
export default defineConfig({
plugins: [
laravel({
input: ['resources/css/app.css', 'resources/js/app.js'],
refresh: true,
}),
],
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment