Browse Source

Merge branch 'develop' of ssh://8.134.10.79:222/Leadfyy.co/hainan into develop

# Conflicts:
#	app/AdminAgent/routes.php
#	app/Models/Supplier.php
#	dcat_admin_ide_helper.php
develop
lemon 4 years ago
parent
commit
c8d064a13b
  1. 62
      MySQL_change.sql
  2. 12
      app/Admin/Controllers/AgentController.php
  3. 12
      app/Admin/Controllers/GuideController.php
  4. 4
      app/Admin/Controllers/OrderController.php
  5. 9
      app/Admin/Controllers/ProductController.php
  6. 22
      app/Admin/Controllers/SupplierController.php
  7. 4
      app/Admin/Controllers/UserController.php
  8. 15
      app/Admin/Extensions/Grid/AuditAgent.php
  9. 8
      app/Admin/Extensions/Grid/AuditGuide.php
  10. 8
      app/Admin/Extensions/Grid/AuditSupplier.php
  11. 65
      app/AdminAgent/Controllers/AdvertisingController.php
  12. 18
      app/AdminAgent/Controllers/AgentInfoController.php
  13. 171
      app/AdminAgent/Controllers/AgentProductController.php
  14. 110
      app/AdminAgent/Controllers/ArticleController.php
  15. 2
      app/AdminAgent/Controllers/CategoryController.php
  16. 127
      app/AdminAgent/Controllers/MessageController.php
  17. 101
      app/AdminAgent/Controllers/NoticeController.php
  18. 4
      app/AdminAgent/Controllers/OrderController.php
  19. 36
      app/AdminAgent/Controllers/SpecialController.php
  20. 92
      app/AdminAgent/Controllers/SupplierController.php
  21. 29
      app/AdminAgent/Controllers/UserController.php
  22. 130
      app/AdminAgent/Controllers/WaterfallAdController.php
  23. 75
      app/AdminAgent/Forms/AgentInfo.php
  24. 16
      app/AdminAgent/Renderable/SelectAgentProduct.php
  25. 2
      app/AdminAgent/Renderable/SelectProduct.php
  26. 8
      app/AdminAgent/Renderable/SelectUser.php
  27. 4
      app/AdminAgent/Repositories/Advertising.php
  28. 16
      app/AdminAgent/Repositories/Article.php
  29. 16
      app/AdminAgent/Repositories/Message.php
  30. 4
      app/AdminAgent/Repositories/Notice.php
  31. 16
      app/AdminAgent/Repositories/Supplier.php
  32. 13
      app/AdminAgent/routes.php
  33. 4
      app/AdminSettled/Controllers/AgentController.php
  34. 4
      app/AdminSettled/Controllers/GuideController.php
  35. 4
      app/AdminSettled/Controllers/SupplierController.php
  36. 8
      app/AdminSupplier/Controllers/AgentController.php
  37. 20
      app/AdminSupplier/Controllers/OrderController.php
  38. 12
      app/AdminSupplier/Controllers/ProductController.php
  39. 18
      app/AdminSupplier/Controllers/SupplierInfoController.php
  40. 67
      app/AdminSupplier/Forms/SupplierInfo.php
  41. 1
      app/AdminSupplier/routes.php
  42. 56
      app/Http/Controllers/Api/AgentProductController.php
  43. 26
      app/Http/Controllers/Api/ArticleController.php
  44. 10
      app/Http/Controllers/Api/ChannelController.php
  45. 35
      app/Http/Controllers/Api/IndexController.php
  46. 3
      app/Http/Controllers/Api/LoginController.php
  47. 19
      app/Http/Controllers/Api/MessageController.php
  48. 34
      app/Http/Controllers/Api/OrderController.php
  49. 11
      app/Http/Controllers/Api/SpecialController.php
  50. 17
      app/Http/Controllers/Api/UserFavController.php
  51. 2
      app/Http/Controllers/Api/VerificationController.php
  52. 3
      app/Http/Controllers/Api/WxpayController.php
  53. 4
      app/Models/Advertising.php
  54. 29
      app/Models/AgentProduct.php
  55. 3
      app/Models/Article.php
  56. 14
      app/Models/MessageRead.php
  57. 5
      app/Models/Order.php
  58. 9
      app/Models/Product.php
  59. 6
      app/Models/Supplier.php
  60. 18
      app/Models/WaterfallAd.php
  61. 2
      config/admin-agent.php
  62. 2
      config/admin-guide.php
  63. 2
      config/admin-supplier.php
  64. 380
      dcat_admin_ide_helper.php
  65. 64
      ready.md
  66. 28
      resources/lang/zh_CN/advertising.php
  67. 15
      resources/lang/zh_CN/agent-info.php
  68. 6
      resources/lang/zh_CN/agent-product.php
  69. 1
      resources/lang/zh_CN/agent.php
  70. 22
      resources/lang/zh_CN/article.php
  71. 16
      resources/lang/zh_CN/message.php
  72. 15
      resources/lang/zh_CN/notice.php
  73. 2
      resources/lang/zh_CN/product.php
  74. 18
      resources/lang/zh_CN/slide.php
  75. 2
      resources/lang/zh_CN/user.php
  76. 17
      routes/api.php

62
MySQL_change.sql

@ -98,7 +98,6 @@ ALTER TABLE `slides`
ADD COLUMN `type` TINYINT NOT NULL DEFAULT '0' COMMENT '链接类型,0:链接到内部页面;1:链接到webview url' AFTER `sort`,
ADD COLUMN `url` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '链接地址' AFTER `type`;
#################################################################
# 23:43 ‎2021/‎08/‎22
CREATE TABLE `waterfall_ads` (
`id` INT(10) NOT NULL AUTO_INCREMENT,
@ -117,3 +116,64 @@ CREATE TABLE `waterfall_ads` (
COMMENT='瀑布流内嵌广告'
COLLATE='utf8_general_ci'
ENGINE=InnoDB;
#################################################################
# 12:39 2021/8/24
ALTER TABLE `notices`
ADD COLUMN `sort` SMALLINT NOT NULL DEFAULT '255' COMMENT '排序,越小越靠前' AFTER `content`;
ALTER TABLE `users`
CHANGE COLUMN `verifier` `is_verify` TINYINT(3) NOT NULL DEFAULT '0' COMMENT '是否是核销人员,1:是;0:否' AFTER `status`;
# 15:51 2021/8/24
ALTER TABLE `articles`
ADD COLUMN `type` TINYINT NOT NULL DEFAULT 0 COMMENT '0:普通列表显示;1:大图显示;' AFTER `content`,
ADD COLUMN `sort` SMALLINT NOT NULL DEFAULT 255 COMMENT '排序,越小越靠前' AFTER `type`;
# 18:16 2021/8/24
ALTER TABLE `slides`
COMMENT='广告图、轮播图等';
RENAME TABLE `slides` TO `advertisings`;
# 23:05 ‎2021/‎08/‎24
ALTER TABLE `advertisings`
CHANGE COLUMN `agent_id` `agent_id` INT(11) NOT NULL COMMENT '发布者ID' AFTER `id`,
ADD COLUMN `display` TINYINT NOT NULL DEFAULT 0 COMMENT '显示位置,0:轮播图;1:首页横屏广告;2:瀑布流内嵌广告;' AFTER `url`;
# 23:56 ‎2021/‎08/‎24
ALTER TABLE `agent_products`
ADD INDEX `sale` (`sale`),
ADD INDEX `category_id` (`category_id`);
# 0:24 ‎2021/‎08/‎25
ALTER TABLE `specials`
DROP COLUMN `picture_ad`;
# 14:15 2021/8/25
ALTER TABLE `messages`
DROP COLUMN `is_read`;
CREATE TABLE `message_reads` (
`id` INT(10) NOT NULL COMMENT '消息ID,message_id',
`user_id` INT(10) NOT NULL COMMENT '用户ID,user_id',
PRIMARY KEY (`id`, `user_id`) USING BTREE
)
COMMENT='消息已读状态记录,如果含有记录,说明已读,否则未读'
COLLATE='utf8_general_ci'
ENGINE=InnoDB
;
# 14:34 2021/8/25
ALTER TABLE `agent_products`
ADD COLUMN `is_rec` TINYINT NOT NULL DEFAULT 0 COMMENT '是否推荐,推荐后在我的下文显示,0:未推荐;1:推荐;' AFTER `verifier`;
# 16:35 2021/8/25
ALTER TABLE `agent_products`
ADD COLUMN `type` TINYINT(3) NOT NULL DEFAULT '0' COMMENT '0:单品销售;1:组合销售;' AFTER `is_rec`,
ADD COLUMN `title` VARCHAR(255) NOT NULL COMMENT '标题' COLLATE 'utf8_general_ci' AFTER `type`,
ADD COLUMN `pictures` TEXT NOT NULL COMMENT '产品图片,可能有多张,JSON格式' COLLATE 'utf8_general_ci' AFTER `title`,
ADD COLUMN `know` TEXT NULL DEFAULT NULL COMMENT '旅客须知' COLLATE 'utf8_general_ci' AFTER `pictures`,
ADD COLUMN `content` MEDIUMTEXT NULL DEFAULT NULL COMMENT '产品详情' COLLATE 'utf8_general_ci' AFTER `know`;
# 11:07 2021/8/26
DROP TABLE `waterfall_ads`;

12
app/Admin/Controllers/AgentController.php

@ -34,9 +34,9 @@ class AgentController extends AdminController
$grid->column('name');
$grid->column('type')->using(AgentType::array());
$grid->column('company_name');
$grid->column('logo')->image(60, 60);
$grid->column('logo')->image('', 60, 60);
$grid->column('address');
$grid->column('license_pic')->image(60, 60);
$grid->column('license_pic')->image('', 60, 60);
$grid->column('director');
$grid->column('contact_phone');
$grid->column('created_at');
@ -90,9 +90,9 @@ class AgentController extends AdminController
$show->field('status')->using(UserStatus::array());
$show->field('type')->using(AgentType::array());
$show->field('company_name');
$show->field('logo')->image(120, 120);
$show->field('logo')->image('', 80, 80);
$show->field('address');
$show->field('license_pic')->image(120, 120);
$show->field('license_pic')->image('', 80, 80);
$show->field('director');
$show->field('contact_phone');
$show->field('agentInfo.about', '关于我们')
@ -149,9 +149,9 @@ class AgentController extends AdminController
->default(AgentType::OPERATOR)
->required();
$form->text('company_name');
$form->image('logo');
$form->image('logo')->removable(false)->uniqueName();
$form->text('address');
$form->image('license_pic');
$form->image('license_pic')->removable(false)->uniqueName();
$form->text('director');
$form->text('contact_phone');
$form->editor('agentInfo.about', '关于我们');// 隐藏菜单用:->options(['menubar' => false]);

12
app/Admin/Controllers/GuideController.php

@ -30,8 +30,8 @@ class GuideController extends AdminController
$grid->column('id')->sortable();
$grid->column('username');
$grid->column('name');
$grid->column('photo')->image(60, 60);
$grid->column('license_pic')->image(60, 60);
$grid->column('photo')->image('', 60, 60);
$grid->column('license_pic')->image('', 60, 60);
$grid->column('contact_phone');
$grid->column('created_at');
$grid->column('updated_at');
@ -78,8 +78,8 @@ class GuideController extends AdminController
$show->field('username');
$show->field('name');
$show->field('status')->using(UserStatus::array());
$show->field('photo')->image();
$show->field('license_pic')->image();
$show->field('photo')->image('', 80, 80);
$show->field('license_pic')->image('', 80, 80);
$show->field('contact_phone');
$show->field('created_at');
$show->field('updated_at');
@ -109,8 +109,8 @@ class GuideController extends AdminController
}
$form->select('status')->options(UserStatus::array())->default(UserStatus::NORMAL);
$form->text('name');
$form->image('photo');
$form->image('license_pic');
$form->image('photo')->removable(false)->uniqueName();
$form->image('license_pic')->removable(false)->uniqueName();
$form->text('contact_phone');
})->saving(function (Form $form) {
//判断账号是否唯一

4
app/Admin/Controllers/OrderController.php

@ -99,7 +99,7 @@ class OrderController extends AdminController
$show->field('paid_money');
$show->field('pay_type')->using(PayType::array());
$show->field('title');
$show->field('picture')->image(80, 80);
$show->field('picture')->image('', 80, 80);
$show->field('price');
$show->field('product_id');
$show->field('status')->using(OrderStatus::array());
@ -126,7 +126,7 @@ class OrderController extends AdminController
})->saving(function (Form $form) {
return $form->response()->error('操作禁止');
})->deleting(function (Form $form) {
return $form->response()->error('禁止删除');
return $form->response()->error('操作禁止');
});
}
}

9
app/Admin/Controllers/ProductController.php

@ -24,6 +24,7 @@ class ProductController extends AdminController
protected function grid()
{
return Grid::make(new Product(['supplier:id,name', 'category:id,name']), function (Grid $grid) {
$grid->disableCreateButton();
//如果是审核页面,多加where条件判断
if (strpos(Route::current()->uri, 'audit')) {
$grid->model()->where('status', ProductStatus::UNAUDITED);
@ -31,7 +32,7 @@ class ProductController extends AdminController
$grid->column('id')->sortable();
$grid->column('category.name', '分类');
$grid->column('picture')->image(60, 60);
$grid->column('picture')->image('', 60, 60);
$grid->column('title');
$grid->column('original_price');
$grid->column('price');
@ -79,7 +80,7 @@ class ProductController extends AdminController
$show->field('id');
$show->field('category.name', '所属分类');
$show->field('title');
$show->field('pictures')->image(80, 80);
$show->field('pictures')->image('', 80, 80);
$show->field('original_price');
$show->field('price');
$show->field('sale');
@ -105,10 +106,10 @@ class ProductController extends AdminController
$options = Category::selectOptions(fn($query) => $query->where('agent_id', 0));
$form->select('category_id', '所属分类')
->options(array_slice($options, 1))
->options(array_slice($options, 1, null, true))
->required();
$form->text('title')->required();
$form->multipleImage('pictures')->required();
$form->multipleImage('pictures')->required()->removable(false)->uniqueName();
$form->text('original_price')->required();
$form->text('price')->required();
$form->text('sale')->default(0);

22
app/Admin/Controllers/SupplierController.php

@ -4,7 +4,9 @@ namespace App\Admin\Controllers;
use App\Admin\Extensions\Grid\AuditSupplier;
use App\Admin\Repositories\Supplier;
use App\Common\ProductStatus;
use App\Common\UserStatus;
use App\Models\Product;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
@ -32,9 +34,9 @@ class SupplierController extends AdminController
$grid->column('username');
$grid->column('name');
$grid->column('company_name');
$grid->column('logo')->image(60, 60);
$grid->column('logo')->image('', 60, 60);
$grid->column('address');
$grid->column('license_pic')->image(60,60);
$grid->column('license_pic')->image('', 60,60);
$grid->column('director');
$grid->column('contact_phone');
$grid->column('created_at');
@ -82,9 +84,9 @@ class SupplierController extends AdminController
$show->field('username');
$show->field('name');
$show->field('company_name');
$show->field('logo')->image(60, 60);
$show->field('logo')->image('', 60, 60);
$show->field('address');
$show->field('license_pic')->image(60, 60);
$show->field('license_pic')->image('', 60, 60);
$show->field('director');
$show->field('contact_phone');
$show->field('created_at');
@ -116,13 +118,16 @@ class SupplierController extends AdminController
$form->select('status', '状态')
->options(UserStatus::array())
->default(UserStatus::NORMAL)
->help('如果禁用供应商将同时<span style="color:#f00;">下架供应商的所有产品</span>,需要供应商手动上架后才能销售,请谨慎!')
->required();
$form->text('company_name');
$form->image('logo');
$form->image('logo')->removable(false)->uniqueName();
$form->text('address');
$form->image('license_pic');
$form->image('license_pic')->removable(false)->uniqueName();
$form->text('director');
$form->mobile('contact_phone');
})->editing(function (Form $form) {
$form->responseValidationMessages('111111111111111111111', 'title格式错误');
})->saving(function (Form $form) {
//判断账号是否唯一
if ($form->isCreating()) {
@ -142,6 +147,11 @@ class SupplierController extends AdminController
$form->$k = '';
}
}
})->saved(function (Form $form) {
//禁用供应商将下架所有供应商的产品
if ($form->status == UserStatus::DISABLED) {
Product::where('supplier_id', $form->getKey())->update(['status' => ProductStatus::SOLD_OUT]);
}
});
}
}

4
app/Admin/Controllers/UserController.php

@ -25,7 +25,7 @@ class UserController extends AdminController
$grid->column('id')->sortable();
$grid->column('agent.name', '所属代理商');
$grid->column('avatar')->image(60, 60);
$grid->column('avatar')->image('', 60, 60);
$grid->column('mobile');
$grid->column('nickname');
$grid->column('status')->bool();
@ -55,7 +55,7 @@ class UserController extends AdminController
$show->field('id');
$show->field('agent.name', '代理商');
$show->field('avatar')->image(80, 80);
$show->field('avatar')->image('', 80, 80);
$show->field('mobile');
$show->field('nickname');
$show->field('status')->bool();

15
app/Admin/Extensions/Grid/AuditAgent.php

@ -5,7 +5,8 @@ use App\Common\UserStatus;
use App\Models\Agent;
use App\Models\Category;
use App\Models\Channel;
use App\Models\Slide;
use App\Models\Advertising;
use Dcat\Admin\Admin;
use Dcat\Admin\Grid\RowAction;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
@ -94,8 +95,8 @@ class AuditAgent extends RowAction
}
//首页轮播图
if (!Slide::where('agent_id', $id)->first()) {
$default_slide = Slide::where('agent_id', 0)->orderBy('id')->get()->toArray();
if (!Advertising::where('agent_id', $id)->first()) {
$default_slide = Advertising::where('agent_id', 0)->orderBy('id')->get()->toArray();
$default_slide = array_map(function ($v) use ($id, $host) {
unset($v['id']);
@ -104,7 +105,13 @@ class AuditAgent extends RowAction
$v['url'] = str_replace($host, '', $v['url']);
return $v;
}, $default_slide);
Slide::insert($default_slide);
Advertising::insert($default_slide);
}
//插入权限表
if ($user->status == UserStatus::NORMAL) {
DB::table(config('admin-agent.database.role_users_table'))
->insertOrIgnore(['role_id' => 1, 'user_id' => Admin::user()->id]);
}
//TODO 还需要插入 演示产品、公告、专题等

8
app/Admin/Extensions/Grid/AuditGuide.php

@ -3,8 +3,10 @@
namespace App\Admin\Extensions\Grid;
use App\Models\Guide;
use App\Common\UserStatus;
use Dcat\Admin\Admin;
use Dcat\Admin\Grid\RowAction;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
/**
* 供应商审核
@ -38,6 +40,12 @@ class AuditGuide extends RowAction
$user->status = $request->action == 1 ? UserStatus::NORMAL : UserStatus::REFUSE;
$user->save();
//插入权限表
if ($user->status == UserStatus::NORMAL) {
DB::table(config('admin-guide.database.role_users_table'))
->insertOrIgnore(['role_id' => 1, 'user_id' => Admin::user()->id]);
}
return $this->response()->success("审核成功")->refresh();
} catch (\Exception $e) {
return $this->response()->error($e->getMessage());

8
app/Admin/Extensions/Grid/AuditSupplier.php

@ -3,8 +3,10 @@
namespace App\Admin\Extensions\Grid;
use App\Common\UserStatus;
use App\Models\Supplier;
use Dcat\Admin\Admin;
use Dcat\Admin\Grid\RowAction;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
/**
* 供应商审核
@ -38,6 +40,12 @@ class AuditSupplier extends RowAction
$user->status = $request->action == 1 ? UserStatus::NORMAL : UserStatus::REFUSE;
$user->save();
//插入权限表
if ($user->status == UserStatus::NORMAL) {
DB::table(config('admin-supplier.database.role_users_table'))
->insertOrIgnore(['role_id' => 1, 'user_id' => Admin::user()->id]);
}
return $this->response()->success("审核成功")->refresh();
} catch (\Exception $e) {
return $this->response()->error($e->getMessage());

65
app/AdminAgent/Controllers/SlideController.php → app/AdminAgent/Controllers/AdvertisingController.php

@ -2,14 +2,14 @@
namespace App\AdminAgent\Controllers;
use App\AdminAgent\Repositories\Slide;
use App\AdminAgent\Repositories\Advertising;
use Dcat\Admin\Admin;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class SlideController extends AdminController
class AdvertisingController extends AdminController
{
/**
* Make a grid builder.
@ -18,13 +18,15 @@ class SlideController extends AdminController
*/
protected function grid()
{
return Grid::make(new Slide(), function (Grid $grid) {
$grid->model()->where('agent_id', Admin::user()->id)->orderBy('sort')->orderBy('id', 'DESC');
return Grid::make(new Advertising(), function (Grid $grid) {
$grid->model()->where('agent_id', Admin::user()->id)
->orderBy('display', 'desc')->orderBy('sort')->orderBy('id', 'DESC');
$grid->column('id')->sortable();
$grid->column('display')->using(admin_trans('advertising.options.display'));
$grid->column('title');
$grid->column('picture')->image('', 60, 60);
$grid->column('type')->using(['链接内部页面', '链接网址']);
$grid->column('type')->using(admin_trans('advertising.options.type'));
$grid->column('url');
$grid->column('status')->switch();
$grid->column('sort')->editable()->sortable()->width(120);
@ -32,8 +34,9 @@ class SlideController extends AdminController
$grid->filter(function (Grid\Filter $filter) {
$filter->panel();
$filter->equal('id');
$filter->like('title');
$filter->equal('id')->width(2);
$filter->equal('display')->select(admin_trans('advertising.options.display'))->width(2);
$filter->like('title')->width(3);
});
});
}
@ -47,16 +50,17 @@ class SlideController extends AdminController
*/
protected function detail($id)
{
return Show::make($id, new Slide(), function (Show $show) {
return Show::make($id, new Advertising(), function (Show $show) {
//不允许查看非自己的数据
if ($show->model()->agent_id != Admin::user()->id) {
Admin::exit('数据不存在');
}
$show->field('id');
$show->field('display')->using(admin_trans('advertising.options.display'));
$show->field('title');
$show->field('picture')->image('', 80, 80);
$show->field('type')->using(['链接内部页面', '链接网址']);
$show->field('type')->using(admin_trans('advertising.options.type'));
$show->field('url');
$show->field('status')->using(['禁用', '启用']);
$show->field('sort');
@ -72,35 +76,44 @@ class SlideController extends AdminController
*/
protected function form()
{
return Form::make(new Slide(), function (Form $form) {
return Form::make(new Advertising(), function (Form $form) {
//不允许查看非自己的数据
if ($form->isEditing() && $form->model()->agent_id != Admin::user()->id) {
return $form->response()->error('数据不存在');
}
$form->display('id');
$form->select('display')
->options(admin_trans('advertising.options.display'))
->default(0)
->required();
$form->text('title')
->help('主要用于后台显示,方便管理')
->required();
$form->image('picture')
->required()->removable(false)->uniqueName()
->help('图片大小:750*360');
$form->select('status')->options(['禁用', '启用'])->default(1)->required();
$form->radio('type', '链接类型')
->options(['链接到内部页面', '链接到网址'])
->help('轮播图大小:750*360;横屏广告大小:750*230;产品列表内嵌广告建议跟产品图片大小一致');
$form->select('status')
->options(['禁用', '启用'])
->default(1)
->required();
$form->radio('type', '链接类型')
->options(admin_trans('advertising.options.type'))
->value(0)->default(0)
->when(0, function (Form $form) {
$form->text('url-0', '内部页面地址')
->customFormat(fn() => $this->type == 0 ? $this->url : '')
->help('格式如下:<br>产品详情页:/pages/goodsDetail/index?goods_id=产品ID
<br>文章详情页:/pages/notice/article?article_id=文章ID
<br>公告详情页:/pages/notice/notice?notice_id=公告ID');
<br>公告详情页:/pages/notice/notice?notice_id=公告ID
<br>专题活动页:/pages/activityList/index?special_id=专题ID');
})
->when(1, function (Form $form) {
$form->url('url-1', '链接到网址')
->placeholder('如:https://www.baidu.com/')
->customFormat(fn() => $this->type == 1 ? $this->url : '');
});
})
->required();
$form->text('sort')->default(255)->required();
})->saving(function (Form $form) {
//不允许修改非自己的数据
@ -108,6 +121,17 @@ class SlideController extends AdminController
return $form->response()->error('数据不存在');
}
//处理特殊字段
$form->hidden(['agent_id', 'url']);
$form->agent_id = Admin::user()->id;
if (!is_null($form->status)) {
$form->status = $form->status ? 1 : 0;
}
if (!is_null($form->type)) {
$form->url = $form->{'url-' . $form->type};
$form->deleteInput(['url-0', 'url-1']);
}
//将null字段设置为空值,防止插入数据库出错
foreach ($form->input() as $k => $v) {
if (is_null($v)) {
@ -115,18 +139,11 @@ class SlideController extends AdminController
}
}
//处理特殊字段
$form->hidden(['agent_id', 'url']);
$form->agent_id = Admin::user()->id;
$form->status = $form->status ? 1 : 0;
$form->url = $form->{'url-' . $form->type};
$form->deleteInput(['url-0', 'url-1']);
//不允许编辑的字段
$form->ignore(['id', 'created_at', 'updated_at']);
})->deleting(function (Form $form) {
//不允许删除非自己的数据
if ($form->model()[0]['agent_id'] != Admin::user()->id) {
if (array_filter($form->model()->toArray(), fn($v) => $v['agent_id'] != Admin::user()->id)) {
return $form->response()->error('数据不存在');
}
});

18
app/AdminAgent/Controllers/AgentInfoController.php

@ -0,0 +1,18 @@
<?php
namespace App\AdminAgent\Controllers;
use App\AdminAgent\Forms\AgentInfo;
use Dcat\Admin\Layout\Content;
use Dcat\Admin\Http\Controllers\AdminController;
use Dcat\Admin\Widgets\Card;
class AgentInfoController extends AdminController
{
public function index(Content $content)
{
return $content
->title('代理商信息')
->body(new Card('&nbsp;', new AgentInfo()));
}
}

171
app/AdminAgent/Controllers/AgentProductController.php

@ -21,7 +21,6 @@ use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
use Dcat\Admin\Widgets\Alert;
use Dcat\Admin\Widgets\Table;
class AgentProductController extends AdminController
{
@ -37,11 +36,24 @@ class AgentProductController extends AdminController
$grid->model()->where('agent_id', $agent_id);
$grid->column('id')->sortable();
$grid->column('product.picture', '产品图片')->image('', 60, 60);
$grid->column('product.title', '产品名称')->limit(15);
$grid->column('product_id', '产品详情')
$grid->column('picture', '产品图片')->image('', 60, 60);
$grid->column('title', '产品名称')->limit(15);
$grid->column('price');
$grid->column('original_price');
$grid->column('sale');
$grid->column('stock');
$channels = Channel::where('agent_id', $agent_id)->pluck('name', 'id')->toArray();
$grid->column('channel_id', '频道')
->display(function ($modal) use ($channels) {
$data = array_flip(explode(',', $this->channel_id));
return join(',',array_intersect_key($channels, $data));
})
->limit(10);
$grid->column('category.name', '分类');
/*$grid->column('product_ids', '产品详情')
->display('查看')
->modal(function ($v) {
->modal(function ($modal) {
$titles = ['供应商', '产品标题', '产品图片', '原价', '现价', '销量', '库存'];
$pic = isset($this->product->picture)
? "<img data-action=\"preview-img\" src=\"{$this->product->picture}\" style=\"max-width:80px;max-height:200px;cursor:pointer\" class=\"img img-thumbnail\">"
@ -56,20 +68,8 @@ class AgentProductController extends AdminController
$this->product->stock ?? '',
]];
return Table::make($titles, $data);
});
$grid->column('price');
$grid->column('original_price');
$grid->column('sale');
$grid->column('stock');
});*/
$channels = Channel::where('agent_id', $agent_id)->pluck('name', 'id')->toArray();
$grid->column('channel_id', '频道')
->display(function ($modal) use ($channels) {
$data = array_flip(explode(',', $this->channel_id));
return join(',',array_intersect_key($channels, $data));
})
->limit(10);
$grid->column('category.name', '分类')->label();
$grid->column('status')
->using(ProductStatus::array())
->dot([
@ -78,7 +78,7 @@ class AgentProductController extends AdminController
ProductStatus::REFUSE => 'danger',
ProductStatus::SOLD_OUT => 'warning',
], 'primary');
$grid->column('created_at');
$grid->column('is_rec')->switch()->help('推荐后将在“我的”页面下方显示');
$grid->column('updated_at');
$grid->filter(function (Grid\Filter $filter) {
@ -125,6 +125,11 @@ class AgentProductController extends AdminController
if (Admin::user()->type == AgentType::CLUSTER) {
$show->field('guide.name', '地接');
}
$show->field('is_rec')->using(['未推荐', '已推荐']);
$show->field('title');
$show->field('pictures')->image('', 80, 80);
$show->field('know')->unescape();
$show->field('content')->unescape();
$show->field('created_at');
$show->field('updated_at');
@ -150,7 +155,7 @@ class AgentProductController extends AdminController
*/
protected function form()
{
return Form::make(new AgentProduct(['product:id,title']), function (Form $form) {
return Form::make(new AgentProduct(), function (Form $form) {
$agent_id = Admin::user()->id;
//不允许查看非自己的数据
@ -159,32 +164,43 @@ class AgentProductController extends AdminController
}
$form->display('id');
$form->hidden('product_id');
$form->selectTable('product_id', '封面产品')
->help('产品列表显示的是该产品的标题和图片')
->title('选择产品')
->dialogWidth('80%;min-width:825px;')
->from(SelectProduct::make())
->model(Product::class)
->required();
$form->multipleSelectTable('product_ids', '选择产品')
->help('可单选或多选组合销售')
->title('选择产品')
->dialogWidth('80%;min-width:825px;')
->from(SelectProduct::make())
->model(Product::class)
->required();
$form->radio('type')
->options(['单品销售', '组合销售'])
->default(0)
->when(0, function (Form $form) {
/** 单品销售 **/
$form->selectTable('product_id', '选择产品')
->help('产品列表显示的是该产品的标题和图片')
->title('选择产品')
->dialogWidth('80%;min-width:825px;')
->from(SelectProduct::make())
->model(Product::class);
})->when(1, function (Form $form) {
/** 组合销售 **/
$form->multipleSelectTable('product_ids', '选择产品')
->help('可单选或多选组合销售')
->title('选择产品')
->dialogWidth('80%;min-width:825px;')
->from(SelectProduct::make())
->model(Product::class);
/** 自定义内容 **/
$form->text('title');
$form->multipleImage('pictures')->removable(false)->uniqueName();
$form->editor('know');
$form->editor('content');
});
$form->text('price')->required();
$form->text('original_price')->required();
$form->text('sale')->default(0);
$form->text('stock')->default(9999);
$form->text('stock')->default(8888);
$options = Channel::selectOptions(fn($query) => $query->where('agent_id', $agent_id));
$form->multipleSelect('channel_id')->options(array_slice($options, 1));
$form->multipleSelect('channel_id')->options(array_slice($options, 1, null, true));
$options = Category::selectOptions(fn($query) => $query->where('agent_id', $agent_id));
$form->select('category_id')
->options(array_slice($options, 1))
->options(array_slice($options, 1, null, true))
->required();
$form->radio('status')
@ -194,10 +210,11 @@ class AgentProductController extends AdminController
ProductStatus::SOLD_OUT => '下架',
])
->required();
$form->switch('is_rec')->help('推荐后将在“我的”页面下方显示');
$form->selectTable('verifier')
->title('选择核销人员')
->dialogWidth('50%;min-width:600px;') //不起作用
->from(SelectUser::make())
->from(SelectUser::make(['is_verify' => 1]))
->model(User::class, 'id', 'nickname')
->customFormat(fn($v) => !$v ? '' : $v)
->required();
@ -216,30 +233,74 @@ class AgentProductController extends AdminController
return $form->response()->error('数据不存在');
}
$agent_id = Admin::user()->id;
//推荐按钮开关
if ($form->product_id === null && $form->product_ids === null && $form->is_rec !== null) {
$form->model()->is_rec = $form->is_rec ? 1 : 0;
$form->model()->save();
return $form->response()->success('更新成功');
}
$product_ids = explode(',', $form->product_ids);
if (empty($product_ids)) {
return $form->response()->error('请选择产品');
//单品销售
if ($form->type == 0) {
$form->product_id = (int)$form->product_id;
if (!$form->product_id) {
return $form->response()->error('请选择产品');
}
$form->product_ids = $form->product_id;
//将供应商产品写入title,pictures,know,content
$product = Product::find($form->product_id);
if ($product->status != ProductStatus::ON_SALE) {
return $form->response()->error('产品ID '. $form->product_id .' 已下架');
} else if ($product->stock < $form->stock) {
return $form->response()->error('库存不足,你设置的库存应小于等于' . $form->stock);
}
$form->title = $product->title;
$form->pictures = $product->pictures;
$form->know = $product->know;
$form->content = $product->content;
}
//组合销售
else if ($form->type == 1) {
if (!$form->product_ids) {
return $form->response()->error('请选择产品');
}
$product_ids = explode(',', $form->product_ids);
//判断供应商产品是否存在或下架
$not_in_id = Product::query()
->whereIn('id', $product_ids)
->where(function ($query) use ($form) {
$query->where('status', '<>', ProductStatus::ON_SALE)
->orWhere('stock', '<', $form->stock);
})
->pluck('id')
->toArray();
if ($not_in_id) {
return $form->response()->error('产品ID '. join(',', $not_in_id) .' 库存小于你设置的库存' . $form->stock . ',或不存在、已下架');
if (count($product_ids) < 2) {
return $form->response()->error('组合销售必须选择两个以上产品,否则请选择单品销售');
}
$form->product_id = $product_ids[0];
$required_fields = ['title', 'pictures', 'know', 'content'];
foreach ($required_fields as $field) {
if (!$form->$field) {
return $form->response()->error('内容输入不完整,标题、产品图片、旅游须知、产品详情必填');
}
}
//判断供应商产品是否存在或下架
$not_in_id = Product::query()
->whereIn('id', $product_ids)
->where(function ($query) use ($form) {
$query->where('status', '<>', ProductStatus::ON_SALE)
->orWhere('stock', '<', $form->stock);
})
->pluck('id')
->toArray();
if ($not_in_id) {
return $form->response()->error('产品ID ' . join(',', $not_in_id) . ' 库存小于你设置的库存' . $form->stock . ',或不存在、已下架');
}
} else {
return $form->response()->error('不存在此销售方式');
}
$agent_id = Admin::user()->id;
//处理特殊字段
$form->hidden(['agent_id', 'status']); //表单没有的字段,必须加这句才能够重写
$form->agent_id = $agent_id;
$form->status = $form->status == ProductStatus::ON_SALE ? ProductStatus::ON_SALE : ProductStatus::SOLD_OUT;
$form->guide_id = $form->guide_id ?? 0;
//不允许编辑的字段
$form->ignore(['id', 'agent_id', 'status', 'created_at', 'updated_at', 'deleted_at']);
@ -297,7 +358,7 @@ class AgentProductController extends AdminController
}
})->deleting(function (Form $form) {
//不允许删除非自己的数据
if ($form->model()[0]['agent_id'] != Admin::user()->id) {
if (array_filter($form->model()->toArray(), fn($v) => $v['agent_id'] != Admin::user()->id)) {
return $form->response()->error('数据不存在');
}
});

110
app/AdminAgent/Controllers/ArticleController.php

@ -0,0 +1,110 @@
<?php
namespace App\AdminAgent\Controllers;
use App\AdminAgent\Repositories\Article;
use Dcat\Admin\Admin;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class ArticleController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new Article(), function (Grid $grid) {
$grid->model()->where('agent_id', Admin::user()->id)
->orderBy('sort')->orderBy('id', 'desc');
$grid->column('id')->sortable();
$grid->column('author');
$grid->column('title');
$grid->column('image')->image('', 60, 60);
$grid->column('sort')->editable()->width(120)->help('数字超小越靠前');
$grid->column('type')->using(['普通列表', '大图显示']);
$grid->column('created_at');
$grid->column('updated_at')->sortable();
$grid->filter(function (Grid\Filter $filter) {
$filter->panel();
$filter->equal('id')->width(2);
$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) {
//不允许查看非自己的数据
if ($show->model()->agent_id != Admin::user()->id) {
Admin::exit('数据不存在');
}
$show->field('id');
$show->field('author');
$show->field('title');
$show->field('image')->image('', 80, 80);
$show->field('content')->unescape();
$show->field('sort');
$show->field('type')->using(['普通列表', '大图显示']);
$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) {
//不允许查看非自己的数据
if ($form->isEditing() && $form->model()->agent_id != Admin::user()->id) {
return $form->response()->error('数据不存在');
}
$form->display('id');
$form->text('author')->default(Admin::user()->name);
$form->text('title')->required();
$form->image('image')->required()->removable(false)->uniqueName();
$form->editor('content')->required();
$form->text('sort')->default(255);
$form->select('type')->options(['普通列表', '大图显示'])->default(0)->required();
})->saving(function (Form $form) {
//不允许修改非自己的数据
if ($form->isEditing() && $form->model()->agent_id != Admin::user()->id) {
return $form->response()->error('数据不存在');
}
//特殊字段处理
$form->hidden(['agent_id']);
$form->agent_id = Admin::user()->id;
$form->sort = $form->sort ?? 255;
//不允许编辑的字段
$form->ignore(['id', 'created_at', 'updated_at']);
})->deleting(function (Form $form) {
//不允许删除非自己的数据
if (array_filter($form->model()->toArray(), fn($v) => $v['agent_id'] != Admin::user()->id)) {
return $form->response()->error('数据不存在');
}
});
}
}

2
app/AdminAgent/Controllers/CategoryController.php

@ -104,7 +104,7 @@ class CategoryController extends AdminController
$form->sort = $form->sort ?? 255;
})->deleting(function (Form $form) {
//不允许修改非自己的数据
if ($form->model()[0]['agent_id'] != Admin::user()->id) {
if (array_filter($form->model()->toArray(), fn($v) => $v['agent_id'] != Admin::user()->id)) {
return $form->response()->error('数据不存在');
}

127
app/AdminAgent/Controllers/MessageController.php

@ -0,0 +1,127 @@
<?php
namespace App\AdminAgent\Controllers;
use App\AdminAgent\Renderable\SelectUser;
use App\AdminAgent\Repositories\Message;
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;
class MessageController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new Message(), function (Grid $grid) {
$grid->model()->where('agent_id', Admin::user()->id);
$grid->column('id')->sortable();
$grid->column('user_id');
$grid->column('title');
// $grid->column('is_read')->if(fn($v) => $this->user_id != 0)->bool()->else()->display('所有人接收');
$grid->column('created_at');
$grid->filter(function (Grid\Filter $filter) {
$filter->panel();
$filter->model()->where('agent_id', Admin::user()->id);
$filter->equal('id')->width(2);
$filter->like('title')->width(3);
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new Message(), function (Show $show) {
//不允许查看非自己的数据
if ($show->model()->agent_id != Admin::user()->id) {
Admin::exit('数据不存在');
}
$show->field('id');
$show->field('user_id');
$show->field('title');
$show->field('content')->unescape();
/*$show->field('is_read')
->as(function () {
if ($this->user_id) {
return $this->is_read ? '已读' : '未读';
}
return '所有人接收';
});*/
$show->field('created_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new Message(), function (Form $form) {
//不允许查看非自己的数据
if ($form->isEditing() && $form->model()->agent_id != Admin::user()->id) {
return $form->response()->error('数据不存在');
}
$form->display('id');
$form->selectTable('user_id')
->from(new SelectUser())
->model(User::class, 'id', 'nickname')
->default(0)
->help('不选择则表示所有人都收到消息');
$form->text('title')->required();
$form->editor('content');
/*if ($form->isCreating()) {
$form->confirm('发布确认', '为了保证消费者利益,所有人接收的消息发布后禁止编辑,确定发布?');
}*/
})->saving(function (Form $form) {
//不允许修改非自己的数据
if ($form->isEditing() && $form->model()->agent_id != Admin::user()->id) {
return $form->response()->error('数据不存在');
}
//消息已读后禁止编辑
/*if ($form->isEditing()) {
if ($form->model()->user_id == 0) {
return $form->response()->error('为了保证消费者利益,所有人接收的消息禁止编辑');
}
if ($form->model()->is_read) {
return $form->response()->error('消息已读,禁止修改');
}
}*/
//特殊字段处理
$form->hidden(['agent_id']);
$form->agent_id = Admin::user()->id;
$form->user_id = $form->user_id ?? 0;
//不允许编辑的字段
$form->ignore(['id', 'status', 'created_at', 'updated_at', 'deleted_at']);
})->deleting(function (Form $form) {
//不允许删除非自己的数据
if (array_filter($form->model()->toArray(), fn($v) => $v['agent_id'] != Admin::user()->id)) {
return $form->response()->error('数据不存在');
}
});
}
}

101
app/AdminAgent/Controllers/NoticeController.php

@ -0,0 +1,101 @@
<?php
namespace App\AdminAgent\Controllers;
use App\AdminAgent\Repositories\Notice;
use Dcat\Admin\Admin;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class NoticeController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new Notice(), function (Grid $grid) {
$grid->model()->where('agent_id', Admin::user()->id)
->orderBy('sort')->orderBy('id', 'DESC');
$grid->column('id')->sortable();
$grid->column('title');
$grid->column('sort')->editable()->width(120);
$grid->column('created_at');
$grid->column('updated_at');
$grid->filter(function (Grid\Filter $filter) {
$filter->panel();
$filter->equal('id')->width(2);
$filter->like('title')->width(3);
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new Notice(), function (Show $show) {
//不允许查看非自己的数据
if ($show->model()->agent_id != Admin::user()->id) {
Admin::exit('数据不存在');
}
$show->field('id');
$show->field('title');
$show->field('content')->unescape();
$show->field('sort');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new Notice(), function (Form $form) {
//不允许查看非自己的数据
if ($form->isEditing() && $form->model()->agent_id != Admin::user()->id) {
return $form->response()->error('数据不存在');
}
$form->display('id');
$form->text('title');
$form->editor('content');
$form->text('sort')->default(255);
})->saving(function (Form $form) {
//不允许修改非自己的数据
if ($form->isEditing() && $form->model()->agent_id != Admin::user()->id) {
return $form->response()->error('数据不存在');
}
//特殊字段处理
$form->hidden(['agent_id']);
$form->agent_id = Admin::user()->id;
$form->sort = $form->sort ?? 255;
//不允许编辑的字段
$form->ignore(['id', 'created_at', 'updated_at']);
})->deleting(function (Form $form) {
//不允许删除非自己的数据
if (array_filter($form->model()->toArray(), fn($v) => $v['agent_id'] != Admin::user()->id)) {
return $form->response()->error('数据不存在');
}
});
}
}

4
app/AdminAgent/Controllers/OrderController.php

@ -139,7 +139,7 @@ class OrderController extends AdminController
$show->field('name');
$show->field('mobile');
$show->field('title');
$show->field('picture')->image(80, 80);
$show->field('picture')->image('', 80, 80);
$show->field('status')->using(OrderStatus::array());
$show->field('pay_type')->using(PayType::array());
$show->field('created_at');
@ -184,7 +184,7 @@ class OrderController extends AdminController
return $form->response()->error('请通过订单列表的”通过“和”拒绝“按钮来审核退款');
}
})->deleting(function (Form $form) {
return $form->response()->error('禁止删除');
return $form->response()->error('操作禁止');
});
}
}

36
app/AdminAgent/Controllers/SpecialController.php

@ -28,34 +28,31 @@ class SpecialController extends AdminController
$grid->model()->where('agent_id', Admin::user()->id);
$grid->column('id')->sortable();
$grid->column('picture_ad')->image('', 60, 60);
$grid->column('agent_product_id', '专题产品')
->display('查看')
->modal(function ($modal) use ($grid) {
$data = AgentProduct::with('product:id,title,pictures')
->whereIn('id', $this->agent_product_id)
->get(['id', 'product_id', 'sale', 'stock']);
$data = AgentProduct::whereIn('id', $this->agent_product_id)
->get(['id', 'product_id', 'sale', 'stock', 'title', 'pictures']);
$result = [];
$prefix = Storage::disk('public')->url('');
foreach ($data as $k => $v) {
$result[] = [
$v->id,
$v->product->title,
'<img data-action="preview-img" src="'.$prefix.$v->product->picture.'" style="max-width:60px;max-height:60px;cursor:pointer" class="img img-thumbnail">',
$v->title,
'<img data-action="preview-img" src="'.$prefix.$v->picture.'" style="max-width:60px;max-height:60px;cursor:pointer" class="img img-thumbnail">',
$v->sale,
$v->stock,
];
}
return Table::make(['产品ID', '标题', '图片', '销量', '库存'], $result);
});
$grid->column('sort');
$grid->column('created_at');
$grid->column('updated_at')->sortable();
$grid->filter(function (Grid\Filter $filter) {
$filter->panel();
$filter->equal('id');
$filter->equal('id')->width(2);
});
});
}
@ -76,17 +73,14 @@ class SpecialController extends AdminController
}
$show->field('id');
$show->field('picture_ad')->image('', 80, 80);
$show->field('picture')->image('', 80, 80);
$show->field('agent_product_id', '产品')
->unescape()
->as(function ($v) {
$data = AgentProduct::with('product:id,title')
->whereIn('id', $v)
$data = AgentProduct::whereIn('id', $v)
->orderBy('id')->get(['id', 'product_id']);
return join("<br>", $data->map(fn($v) => $v->product->title)->toArray());
return join("<br>", $data->map(fn($v) => $v->title)->toArray());
});
$show->field('sort');
$show->field('created_at');
$show->field('updated_at');
});
@ -106,11 +100,7 @@ class SpecialController extends AdminController
}
$form->display('id');
$form->image('picture_ad')
->required()->removable(false)->uniqueName()
->help('图片大小:750*230');
$form->multipleImage('picture')
->required()->removable(false)->uniqueName()
$form->multipleImage('picture')->required()->removable(false)->uniqueName()
->help('图片大小:750*490');
$form->multipleSelectTable('agent_product_id')
->title('选择在售产品')->required()
@ -118,19 +108,17 @@ class SpecialController extends AdminController
->from(SelectAgentProduct::make())
->options(function ($v) {
if (!$v) return [];
$agent_product = AgentProduct::with('product:id,title')
->select(['id', 'product_id'])
$agent_product = AgentProduct::select(['id', 'product_id', 'title'])
->whereIn('id', $v)
->orderBy('id')->get();
$result = [];
foreach ($agent_product as $v) {
$result[$v->id] = $v->product->title ?? '';
$result[$v->id] = $v->title ?? '';
}
return $result;
})
->pluck('product.title')
->pluck('title', 'id')
->value(join(',', $form->model()->agent_product_id ?? []));
$form->text('sort')->default(255);
})->saving(function (Form $form) {
//不允许修改非自己的数据
if ($form->isEditing() && $form->model()->agent_id != Admin::user()->id) {
@ -145,7 +133,7 @@ class SpecialController extends AdminController
$form->ignore(['id', 'agent_id', 'created_at', 'updated_at']);
})->deleting(function (Form $form) {
//不允许删除非自己的数据
if ($form->model()[0]['agent_id'] != Admin::user()->id) {
if (array_filter($form->model()->toArray(), fn($v) => $v['agent_id'] != Admin::user()->id)) {
return $form->response()->error('数据不存在');
}
});

92
app/AdminAgent/Controllers/SupplierController.php

@ -0,0 +1,92 @@
<?php
namespace App\AdminAgent\Controllers;
use App\AdminAgent\Repositories\Supplier;
use Dcat\Admin\Admin;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class SupplierController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
//考虑到供应商表数据相对较少,故直接从供应商表查询,外加条件判断即可
return Grid::make(new Supplier(), function (Grid $grid) {
$grid->disableActions();
$grid->disableCreateButton();
$grid->disableRowSelector();
$grid->disableFilterButton();
$grid->model()->where(function ($query) {
return $query->whereHas('AgentProductItem', function ($query) {
return $query->where('agent_id', Admin::user()->id);
});
});
$grid->column('id')->sortable();
$grid->column('name');
$grid->column('company_name');
$grid->column('address');
$grid->column('director');
$grid->column('contact_phone');
$grid->column('logo')->image('', 60, 60);
$grid->column('avatar')->image('', 60, 60);
$grid->column('license_pic')->image('', 60, 60);
$grid->column('created_at', '入驻时间');
$grid->filter(function (Grid\Filter $filter) {
$filter->panel();
$filter->equal('id');
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new Supplier(), function (Show $show) {
$show->field('id');
/*$show->field('name');
$show->field('company_name');
$show->field('address');
$show->field('director');
$show->field('contact_phone');
$show->field('logo');
$show->field('avatar');
$show->field('license_pic');
$show->field('created_at');
$show->field('updated_at');*/
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new Supplier(), function (Form $form) {
$form->display('id');
})->saving(function (Form $form) {
$form->response()->error('操作禁止');
})->deleting(function (Form $form) {
$form->response()->error('操作禁止');
});
}
}

29
app/AdminAgent/Controllers/UserController.php

@ -8,6 +8,7 @@ use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
use Illuminate\Support\Facades\Route;
class UserController extends AdminController
{
@ -25,13 +26,19 @@ class UserController extends AdminController
$grid->disableBatchDelete();
$grid->disableDeleteButton();
//如果是核销人员页面,多加where条件判断
if (strpos(Route::current()->uri, 'verifier')) {
$grid->model()->where('is_verify', 1);
}
$grid->model()->where('agent_id', Admin::user()->id);
$grid->column('id')->sortable();
$grid->column('avatar')->image(60, 60);
$grid->column('avatar')->image('', 60, 60);
$grid->column('mobile');
$grid->column('nickname');
$grid->column('status')->switch();
$grid->column('status')->switch()->help('禁用后用户将无法登录');
$grid->column('is_verify')->switch();
$grid->column('created_at');
$grid->filter(function (Grid\Filter $filter) {
@ -61,7 +68,7 @@ class UserController extends AdminController
}
$show->field('id');
$show->field('avatar')->image(80, 80);
$show->field('avatar')->image('', 80, 80);
$show->field('mobile');
$show->field('nickname');
$show->field('status')->bool();
@ -88,20 +95,26 @@ class UserController extends AdminController
$form->display('nickname');
$form->text('mobile');
$form->switch('status');
$form->switch('is_verify');
})->saving(function (Form $form) {
//不允许修改非自己的数据
if ($form->isEditing() && $form->model()->agent_id != Admin::user()->id) {
return $form->response()->error('数据不存在');
}
//不允许编辑的字段
$form->ignore(['id', 'agent_id', 'nickname', 'deleted_at']);
//处理特殊字段
$form->agent_id = Admin::user()->id;
$form->status = $form->status ? 1 : 0;
if (!is_null($form->status)) { //为防止行内编辑出错,此处需要加判断
$form->status = $form->status ? 1 : 0;
}
if (!is_null($form->is_verify)) { //为防止行内编辑出错,此处需要加判断
$form->is_verify = $form->is_verify ? 1 : 0;
}
//不允许编辑的字段
$form->ignore(['id', 'agent_id', 'nickname', 'deleted_at']);
})->deleting(function (Form $form) {
return $form->response()->error('禁止删除');
return $form->response()->error('操作禁止');
});
}
}

130
app/AdminAgent/Controllers/WaterfallAdController.php

@ -1,130 +0,0 @@
<?php
namespace App\AdminAgent\Controllers;
use App\AdminAgent\Repositories\WaterfallAd;
use Dcat\Admin\Admin;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class WaterfallAdController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new WaterfallAd('agentProduct.product:id,title'), function (Grid $grid) {
$grid->model()->where('agent_id', Admin::user()->id)->orderBy('sort')->orderBy('id', 'DESC');
$grid->column('id')->sortable();
$grid->column('title');
$grid->column('picture')->image('', 60, 60);
$grid->column('type')->using(['链接内部页面', '链接网址']);
$grid->column('url');
$grid->column('status')->switch();
$grid->column('sort')->editable()->sortable()->width(120);
$grid->filter(function (Grid\Filter $filter) {
$filter->panel();
$filter->equal('id');
$filter->like('title');
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new WaterfallAd('agentProduct.product:id,title'), function (Show $show) {
//不允许查看非自己的数据
if ($show->model()->agent_id != Admin::user()->id) {
Admin::exit('数据不存在');
}
$show->field('id');
$show->field('title');
$show->field('picture')->image('', 80, 80);
$show->field('type')->using(['链接内部页面', '链接网址']);
$show->field('url');
$show->field('status')->using(['禁用', '启用']);
$show->field('sort');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new WaterfallAd(), function (Form $form) {
//不允许查看非自己的数据
if ($form->isEditing() && $form->model()->agent_id != Admin::user()->id) {
return $form->response()->error('数据不存在');
}
$form->display('id');
$form->text('title')->required();
$form->image('picture')
->required()->removable(false)->uniqueName();
$form->radio('type', '链接类型')
->options(['链接到内部页面', '链接到网址'])
->value(0)->default(0)
->when(0, function (Form $form) {
$form->text('url-0', '内部页面地址')
->customFormat(fn() => $this->type == 0 ? $this->url : '')
->help('格式如下:<br>产品详情页:/pages/goodsDetail/index?goods_id=产品ID
<br>文章详情页:/pages/notice/article?article_id=文章ID
<br>公告详情页:/pages/notice/notice?notice_id=公告ID');
})
->when(1, function (Form $form) {
$form->url('url-1', '链接到网址')
->placeholder('如:https://www.baidu.com/')
->customFormat(fn() => $this->type == 1 ? $this->url : '');
});
$form->text('sort')->default(255)->required();
})->saving(function (Form $form) {
//不允许修改非自己的数据
if ($form->isEditing() && $form->model()->agent_id != Admin::user()->id) {
return $form->response()->error('数据不存在');
}
//将null字段设置为空值,防止插入数据库出错
foreach ($form->input() as $k => $v) {
if (is_null($v)) {
$form->$k = '';
}
}
//处理特殊字段
$form->hidden(['agent_id', 'url']);
$form->agent_id = Admin::user()->id;
$form->status = $form->status ? 1 : 0;
$form->url = $form->{'url-' . $form->type};
$form->deleteInput(['url-0', 'url-1']);
//不允许编辑的字段
$form->ignore(['id', 'created_at', 'updated_at']);
})->deleting(function (Form $form) {
//不允许删除非自己的数据
if ($form->model()[0]['agent_id'] != Admin::user()->id) {
return $form->response()->error('数据不存在');
}
});
}
}

75
app/AdminAgent/Forms/AgentInfo.php

@ -0,0 +1,75 @@
<?php
namespace App\AdminAgent\Forms;
use App\Common\UserStatus;
use App\Models\Agent;
use Dcat\Admin\Admin;
use Dcat\Admin\Widgets\Form;
class AgentInfo extends Form
{
/**
* Handle the form request.
*
* @param array $input
*
* @return mixed
*/
public function handle(array $input)
{
// dump($input);
$model = Agent::query()->find(Admin::user()->id);
$model->name = $input['name'];
$model->company_name = $input['company_name'];
$model->address = $input['address'];
$model->director = $input['director'];
$model->contact_phone = $input['contact_phone'];
$model->logo = $input['logo'];
$model->avatar = $input['avatar'];
$model->license_pic = $input['license_pic'];
$model->status = UserStatus::UNAUDITED;
$model->agentInfo->about = $input['agentInfo']['about'];
$model->agentInfo->reg_protocol = $input['agentInfo']['reg_protocol'];
$model->agentInfo->buy_protocol = $input['agentInfo']['buy_protocol'];
$model->save();
$model->agentInfo()->save($model->agentInfo);
return $this->response()->success('保存成功')->refresh();
}
/**
* Build a form here.
*/
public function form()
{
Admin::translation('agent');
$this->text('name')->required();
$this->text('company_name')->required();
$this->text('address')->required();
$this->text('director')->required();
$this->text('contact_phone')->required();
$this->image('logo')->required();
$this->image('avatar');
$this->image('license_pic')->required();
$this->editor('agentInfo.about')->required();
$this->editor('agentInfo.reg_protocol')->required();
$this->editor('agentInfo.buy_protocol')->required();
$this->confirm('编辑确认', '编辑内容需要管理员重新审核,确定要提交吗?');
}
/**
* The data of the form.
*
* @return array
*/
public function default()
{
return Agent::with('agentInfo')->find(Admin::user()->id)->toArray();
}
}

16
app/AdminAgent/Renderable/SelectAgentProduct.php

@ -8,7 +8,7 @@ use Dcat\Admin\Grid;
use Dcat\Admin\Grid\LazyRenderable;
/**
* 选择产品
* 选择代理商在售产品
* Class SelectProduct
* @package App\AdminAgent\Renderable
*/
@ -19,19 +19,18 @@ class SelectAgentProduct extends LazyRenderable
// 获取外部传递的参数
// $id = $this->id;
Admin::translation('agent-product');
return Grid::make(new AgentProduct(['product.supplier:id,name']), function (Grid $grid) {
return Grid::make(new AgentProduct(), function (Grid $grid) {
$grid->disableActions();
$grid->disableBatchDelete();
$grid->disableBatchActions();
$grid->model()->where('stock', '>', 0)
->where(['agent_id' => Admin::user()->id, 'status' => ProductStatus::ON_SALE]);
$grid->quickSearch(['product.title', 'product.supplier.name'])->placeholder('搜索产品名称、供应商');
$grid->quickSearch(['title'])->placeholder('搜索产品名称');
$grid->column('id');
$grid->column('product.supplier.name');
$grid->column('product.title');
$grid->column('product.picture')->image(60, 60);
$grid->column('title');
$grid->column('picture')->image('', 60, 60);
$grid->column('sale');
$grid->column('stock');
$grid->column('updated_at');
@ -39,8 +38,9 @@ class SelectAgentProduct extends LazyRenderable
$grid->paginate(15);
$grid->filter(function (Grid\Filter $filter) {
$filter->like('product.title')->width(4);
$filter->like('product.supplier.name', '供应商名称')->width(4);
$filter->panel();
$filter->like('title')->width(4);
});
});
}

2
app/AdminAgent/Renderable/SelectProduct.php

@ -30,7 +30,7 @@ class SelectProduct extends LazyRenderable
$grid->column('id');
$grid->column('supplier.name', '供应商');
$grid->column('title');
$grid->column('picture')->image(60, 60);
$grid->column('picture')->image('',60, 60);
$grid->column('sale');
$grid->column('stock');
$grid->column('updated_at');

8
app/AdminAgent/Renderable/SelectUser.php

@ -24,7 +24,13 @@ class SelectUser extends LazyRenderable
$grid->disableBatchDelete();
$grid->disableBatchActions();
$grid->model()->where(['status' => UserStatus::NORMAL, 'agent_id' => Admin::user()->id]);
$where = ['status' => UserStatus::NORMAL, 'agent_id' => Admin::user()->id];
//核销人员选择
if ($this->is_verify !== null) {
$where['is_verify'] = $this->is_verify;
}
$grid->model()->where($where);
$grid->quickSearch(['mobile', 'nickname'])->placeholder('搜索手机号、用户昵称');
$grid->column('id');

4
app/AdminAgent/Repositories/WaterfallAd.php → app/AdminAgent/Repositories/Advertising.php

@ -2,10 +2,10 @@
namespace App\AdminAgent\Repositories;
use App\Models\WaterfallAd as Model;
use App\Models\Advertising as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class WaterfallAd extends EloquentRepository
class Advertising extends EloquentRepository
{
/**
* Model.

16
app/AdminAgent/Repositories/Article.php

@ -0,0 +1,16 @@
<?php
namespace App\AdminAgent\Repositories;
use App\Models\Article as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class Article extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
}

16
app/AdminAgent/Repositories/Message.php

@ -0,0 +1,16 @@
<?php
namespace App\AdminAgent\Repositories;
use App\Models\Message as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class Message extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
}

4
app/AdminAgent/Repositories/Slide.php → app/AdminAgent/Repositories/Notice.php

@ -2,10 +2,10 @@
namespace App\AdminAgent\Repositories;
use App\Models\Slide as Model;
use App\Models\Notice as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class Slide extends EloquentRepository
class Notice extends EloquentRepository
{
/**
* Model.

16
app/AdminAgent/Repositories/Supplier.php

@ -0,0 +1,16 @@
<?php
namespace App\AdminAgent\Repositories;
use App\Models\Supplier as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class Supplier extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
}

13
app/AdminAgent/routes.php

@ -18,14 +18,25 @@ Route::group([
$router->resource('product/list', 'AgentProductController');
$router->resource('category/list', 'CategoryController');
$router->resource('user/list', 'UserController');
$router->resource('user/verifier', 'UserController');
$router->resource('order/list', 'OrderController');
$router->resource('slide/list', 'SlideController');
$router->resource('advertising/list', 'AdvertisingController');
$router->resource('special/list', 'SpecialController');
$router->resource('waterfall_ad/list', 'WaterfallAdController');
$router->resource('demand', 'DemandController');
$router->resource('demand_bidding', 'DemandBiddingController');
$router->resource('my_demand', 'MyDemandController');
$router->resource('message/list', 'MessageController');
$router->resource('notice/list', 'NoticeController');
$router->resource('agent_info', 'AgentInfoController');
$router->resource('supplier/list', 'SupplierController');
$router->resource('article/list', 'ArticleController');
$router->resource('setting', 'SettingController');
//api
$router->any('/api/demand/binding', 'DemandController@binding');
});

4
app/AdminSettled/Controllers/AgentController.php

@ -68,9 +68,9 @@ class AgentController extends AdminController
->default(AgentType::OPERATOR)
->required();
$form->text('company_name')->required();
$form->image('logo')->required();
$form->image('logo')->required()->removable(false)->uniqueName();
$form->text('address')->required();
$form->image('license_pic')->required();
$form->image('license_pic')->required()->removable(false)->uniqueName();
$form->text('director')->required();
$form->text('contact_phone')->required();
})->saving(function (Form $form) {

4
app/AdminSettled/Controllers/GuideController.php

@ -58,8 +58,8 @@ class GuideController extends AdminController
$form->text('username')->required();
$form->text('password')->required();
$form->text('name')->required();
$form->image('photo')->required();
$form->image('license_pic')->required();
$form->image('photo')->required()->removable(false)->uniqueName();
$form->image('license_pic')->required()->removable(false)->uniqueName();
$form->text('contact_phone')->required();
})->saving(function (Form $form) {
//判断账号是否唯一

4
app/AdminSettled/Controllers/SupplierController.php

@ -59,9 +59,9 @@ class SupplierController extends AdminController
$form->text('password')->required();
$form->text('name')->required();
$form->text('company_name')->required();
$form->image('logo');
$form->image('logo')->removable(false)->uniqueName();
$form->text('address')->required();
$form->image('license_pic')->required();
$form->image('license_pic')->required()->removable(false)->uniqueName();
$form->text('director')->required();
$form->text('contact_phone')->required();
})->saving(function (Form $form) {

8
app/AdminSupplier/Controllers/AgentController.php

@ -42,8 +42,8 @@ class AgentController extends AdminController
$grid->column('address');
$grid->column('director');
$grid->column('contact_phone');
$grid->column('logo')->image(60, 60);
$grid->column('license_pic')->image(60, 60);
$grid->column('logo')->image('', 60, 60);
$grid->column('license_pic')->image('', 60, 60);
$grid->column('status')->using(UserStatus::array());
$grid->column('created_at', '注册时间');
@ -103,9 +103,9 @@ class AgentController extends AdminController
$form->display('id');
})->saving(function (Form $form) {
return $form->response()->error('禁止操作');
return $form->response()->error('操作禁止');
})->deleting(function (Form $form) {
return $form->response()->error('禁止删除');
return $form->response()->error('操作禁止');
});
}
}

20
app/AdminSupplier/Controllers/OrderController.php

@ -33,13 +33,15 @@ class OrderController extends AdminController
$grid->disableEditButton();
$grid->model()->where(function ($query) {
return $query->whereHas('product', fn($q) => $q->where('supplier_id', Admin::user()->id));
return $query->whereHas('agentProductItem', function($query) {
return $query->where('supplier_id', Admin::user()->id);
});
});
$grid->column('id')->sortable();
$grid->column('agent.name', '代理商');
$grid->column('title');
$grid->column('picture')->image(60, 60);
$grid->column('picture')->image('', 60, 60);
$grid->column('product', '订单信息')
->display('查看')
->modal('订单信息', function ($modal) {
@ -88,13 +90,14 @@ class OrderController extends AdminController
*/
protected function detail($id)
{
return Show::make($id, new Order(['agent:id,name']), function (Show $show) {
return Show::make($id, new Order(['agent:id,name', 'agentProductItem']), function (Show $show) {
$show->disableDeleteButton();
$show->disableQuickEdit();
$show->disableEditButton();
//不允许查看非自己的数据
if ($show->model()->supplier_id != Admin::user()->id) {
$item_supplier_id = $show->model()->agentProductItem[0]->supplier_id ?? 0;
if ($item_supplier_id != Admin::user()->id) {
Admin::exit('数据不存在');
}
@ -108,7 +111,7 @@ class OrderController extends AdminController
$show->field('paid_money');
$show->field('pay_type')->using(PayType::array());
$show->field('title');
$show->field('picture')->image(80, 80);
$show->field('picture')->image('', 80, 80);
$show->field('price');
$show->field('product_id');
$show->field('status')->using(OrderStatus::array());
@ -126,9 +129,10 @@ class OrderController extends AdminController
*/
protected function form()
{
return Form::make(new Order(), function (Form $form) {
return Form::make(new Order('agentProductItem'), function (Form $form) {
//不允许查看非自己的数据
if ($form->isEditing() && $form->model()->supplier_id != Admin::user()->id) {
$item_supplier_id = $form->model()->agentProductItem[0]->supplier_id ?? 0;
if ($form->isEditing() && $item_supplier_id != Admin::user()->id) {
return $form->response()->error('数据不存在');
}
@ -140,7 +144,7 @@ class OrderController extends AdminController
})->saving(function (Form $form) {
return $form->response()->error('操作禁止');
})->deleting(function (Form $form) {
return $form->response()->error('禁止删除');
return $form->response()->error('操作禁止');
});
}
}

12
app/AdminSupplier/Controllers/ProductController.php

@ -61,7 +61,7 @@ class ProductController extends AdminController
$show->field('title');
$show->field('price');
$show->field('original_price');
$show->field('pictures')->image(80, 80);
$show->field('pictures')->image('', 80, 80);
$show->field('stock');
$show->field('sale');
$show->field('status');
@ -88,11 +88,11 @@ class ProductController extends AdminController
$form->display('id');
$options = Category::selectOptions(fn($query) => $query->where('agent_id', 0));
$form->select('category_id')->options(array_slice($options, 1))->required();
$form->select('category_id')->options(array_slice($options, 1, null, true))->required();
$form->text('title')->required();
$form->text('price')->required();
$form->text('original_price')->required();
$form->multipleImage('pictures')->required()->removable()->retainable();
$form->multipleImage('pictures')->required()->removable(false)->retainable()->uniqueName();
$form->text('stock')->default(9999)->required();
$form->editor('know');
$form->editor('content')->required();
@ -129,9 +129,9 @@ class ProductController extends AdminController
->update(['status' => ProductStatus::SOLD_OUT]);
}
})->deleting(function (Form $form) {
//这里获取字段值和saving不同
if ($form->model()[0]['supplier_id'] != Admin::user()->id) {
return $form->response()->error('删除失败');
//不允许删除非自己的数据
if (array_filter($form->model()->toArray(), fn($v) => $v['supplier_id'] != Admin::user()->id)) {
return $form->response()->error('数据不存在');
}
});
}

18
app/AdminSupplier/Controllers/SupplierInfoController.php

@ -0,0 +1,18 @@
<?php
namespace App\AdminSupplier\Controllers;
use App\AdminSupplier\Forms\SupplierInfo;
use Dcat\Admin\Layout\Content;
use Dcat\Admin\Http\Controllers\AdminController;
use Dcat\Admin\Widgets\Card;
class SupplierInfoController extends AdminController
{
public function index(Content $content)
{
return $content
->title('供应商信息')
->body(new Card('&nbsp;', new SupplierInfo()));
}
}

67
app/AdminSupplier/Forms/SupplierInfo.php

@ -0,0 +1,67 @@
<?php
namespace App\AdminSupplier\Forms;
use App\Common\UserStatus;
use App\Models\Supplier;
use Dcat\Admin\Admin;
use Dcat\Admin\Widgets\Form;
class SupplierInfo extends Form
{
/**
* Handle the form request.
*
* @param array $input
*
* @return mixed
*/
public function handle(array $input)
{
// dump($input);
$model = Supplier::find(Admin::user()->id);
$model->name = $input['name'];
$model->company_name = $input['company_name'];
$model->address = $input['address'];
$model->director = $input['director'];
$model->contact_phone = $input['contact_phone'];
$model->avatar = $input['avatar'];
$model->logo = $input['logo'];
$model->license_pic = $input['license_pic'];
$model->status = UserStatus::UNAUDITED;
$model->save();
return $this->response()->success('保存成功')->refresh();
}
/**
* Build a form here.
*/
public function form()
{
Admin::translation('supplier');
$this->text('name')->required();
$this->text('company_name')->required();
$this->text('address')->required();
$this->text('director')->required();
$this->text('contact_phone')->required();
$this->image('avatar');
$this->image('logo')->required();
$this->image('license_pic')->required();
$this->confirm('编辑确认', '编辑内容需要管理员重新审核,确定要提交吗?');
}
/**
* The data of the form.
*
* @return array
*/
public function default()
{
return Supplier::find(Admin::user()->id)->toArray();
}
}

1
app/AdminSupplier/routes.php

@ -18,4 +18,5 @@ Route::group([
$router->resource('product/list', 'ProductController');
$router->resource('order/list', 'OrderController');
$router->resource('agent/list', 'AgentController');
$router->resource('supplier_info', 'SupplierInfoController');
});

56
app/Http/Controllers/Api/AgentProductController.php

@ -3,9 +3,9 @@
namespace App\Http\Controllers\Api;
use App\Common\ProductStatus;
use App\Http\Controllers\Controller;
use App\Models\Advertising;
use App\Models\AgentProduct;
use App\Models\UserFav;
use App\Models\WaterfallAd;
use Illuminate\Support\Facades\Storage;
/**
@ -25,7 +25,7 @@ class AgentProductController extends Controller
$where['agent_id'] = $this->agent_id;
$list = AgentProduct::list()->where($where)->simplePaginate();
$list = AgentProduct::list()->where($where)->orderBy('id', 'DESC')->simplePaginate();
$list = $this->paginatePicAddHost($list);
$list = $this->insertAd($list);
@ -39,7 +39,6 @@ class AgentProductController extends Controller
// TODO 优惠券查询待优化
$agent_product = AgentProduct::query()
->with('product:id,title,pictures,know,stock,content')
->with('coupon:tag,agent_product_id')
->with('fav:agent_product_id')
->whereHas('product', function ($query) {
@ -53,9 +52,10 @@ class AgentProductController extends Controller
}
$prefix = Storage::disk('public')->url('');
$agent_product->product->pictures = array_map(fn($item) => ($prefix . $item), $agent_product->product->pictures);
$agent_product->pictures = array_map(fn($item) => ($prefix . $item), $agent_product->pictures);
$agent_product->is_collect = !is_null($agent_product->fav); //判断是否收藏
unset($agent_product->fav);
//计算折扣
if ($agent_product->price < $agent_product->original_price) {
$agent_product->cost = round($agent_product->price / $agent_product->original_price * 10, 1);
@ -70,22 +70,36 @@ class AgentProductController extends Controller
// 猜你喜欢
public function guessLike()
{
// TODO 此处需要再优化排序规则,并增加广告功能
return $this->index();
$list = AgentProduct::list()->where('agent_id', $this->agent_id)->orderBy('id', 'DESC')->simplePaginate();
$list = $this->paginatePicAddHost($list);
$list = $list->toArray();
if (!empty($list['data']) && is_array($list['data'])) {
shuffle($list['data']); //随机乱序
}
$list = $this->insertAd($list);
return $this->success($list);
}
//【我的】页面下方推荐
public function recommendList()
{
//TODO 推荐数据暂时使用产品列表,后期需要通过后台设置获取或根据用户购买过的关键词获取
return $this->index();
$list = AgentProduct::list()->where(['agent_id' => $this->agent_id, 'is_rec' => 1])
->orderBy('id', 'DESC')->simplePaginate();
$list = $this->paginatePicAddHost($list);
$list = $this->insertAd($list);
return $this->success($list);
}
//人气爆款列表
//人气爆款列表,销量排序
public function hotList()
{
//TODO 具体排序规则,后期再做修改
return $this->index();
$list = AgentProduct::list()->where('agent_id', $this->agent_id)->orderBy('id', 'DESC')->simplePaginate();
$list = $this->paginatePicAddHost($list);
$list = $this->insertAd($list);
return $this->success($list);
}
//分页列表产品图片加域名
@ -94,9 +108,9 @@ class AgentProductController extends Controller
if (!$list->isEmpty()) {
$prefix = Storage::disk('public')->url('');
foreach ($list->items() as $k=>&$v) {
$v->product->pictures = array_map(function($item) use ($prefix) {
$v->pictures = array_map(function($item) use ($prefix) {
return strpos($item, $prefix) === false ? $prefix . $item : $item;
}, $v->product->pictures);
}, $v->pictures);
}
}
return $list;
@ -106,27 +120,27 @@ class AgentProductController extends Controller
private function insertAd($list)
{
//插入瀑布流广告,分别在第8个和第16个插入,同时需要考虑到分页。当所有瀑布流广告插入完之后,再次循环插入
$list = $list->toArray();
if ($list['data']) {
$ad_total = WaterfallAd::where(['agent_id' => $this->agent_id, 'status' => 1])->count();
if (is_object($list) && method_exists($list, 'toArray')) {
$list = $list->toArray();
}
$ad_total = Advertising::where(['agent_id' => $this->agent_id, 'status' => 1, 'display' => 2])->count();
if ($list['data'] && $ad_total > 0) {
$page = (int)request()->input('page');
$start = ($page ? $page - 1 : 0) * 2 % $ad_total;
$ad = WaterfallAd::where(['agent_id' => $this->agent_id, 'status' => 1])
$ad = Advertising::where(['agent_id' => $this->agent_id, 'status' => 1, 'display' => 2])
->orderBy('sort')->orderBy('id', 'DESC')
->offset($start)->limit(2)->get(['title', 'picture', 'type', 'url'])->toArray();
$prefix = Storage::disk('public')->url('');
//每隔8个插入广告
$gap = 4;
foreach ($ad as $k => &$v) {
$v['is_ad'] = true;
$v['picture'] = $prefix . $v['picture'];
//插入广告
$temp = $gap * ($k+1);
//每隔8个插入广告
$temp = 8 * ($k+1);
if (!empty($list['data'][$temp - 1]) && !empty($ad[$k])) {
array_splice($list['data'], $temp + $k, 0, [$ad[$k]]);
}

26
app/Http/Controllers/Api/ArticleController.php

@ -16,25 +16,27 @@ class ArticleController extends Controller
//文章列表
public function index()
{
//TODO 此处仅为演示数据,调用数据需要再修改
$list = Article::query()
->where('agent_id', $this->agent_id)
->select('id', 'image', 'title', 'updated_at')
->orderBy('id', 'DESC')
$list = Article::where('agent_id', $this->agent_id)
->select('id', 'image', 'title', 'type', 'updated_at')
->orderBy('sort')->orderBy('id', 'DESC')
->simplePaginate()->toArray();
$new_data = [];
$prefix = Storage::disk('public')->url('');
foreach ($list['data'] as $k => &$item) {
$item['image'] = $prefix . $item['image'];
$new_key = floor($k / 4);
if ($k % 4 == 0) {
$new_data[$new_key] = [
'big' => $item,
'children' => []
];
//type=1是大图
if ($item['type'] == 1) {
$new_data[] = ['big' => $item];
continue;
}
//普通列表
$count = count($new_data);
if ($count) {
$new_data[$count - 1]['children'][] = $item;
} else {
$new_data[$new_key]['children'][] = $item;
$new_data[] = ['children' => [$item]];
}
}
$list['data'] = $new_data;

10
app/Http/Controllers/Api/ChannelController.php

@ -5,7 +5,7 @@ use App\Http\Controllers\Controller;
use App\Models\AgentProduct;
use App\Models\Channel;
use App\Models\UserChannel;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage;
/**
* 频道列表
@ -22,6 +22,10 @@ class ChannelController extends Controller
->orderBy('sort')
->orderBy('id')
->get(['id', 'pid', 'name', 'icon']);
$prefix = Storage::disk('public')->url('');
foreach ($list as $k => &$v) {
$v->icon = $prefix . $v->icon;
}
return $this->success($list);
}
@ -38,10 +42,8 @@ class ChannelController extends Controller
{
$channel_id = (int)request()->input('channel_id');
$list = AgentProduct::where('agent_id', $this->agent_id)
$list = AgentProduct::list()->where('agent_id', $this->agent_id)
->whereRaw("FIND_IN_SET($channel_id, `channel_id`)")
->with('product:id,title,pictures')
->select('id', 'sale', 'product_id', 'price', 'original_price')
->orderBy('id', 'DESC')
->simplePaginate();
return $this->success($list);

35
app/Http/Controllers/Api/IndexController.php

@ -5,8 +5,7 @@ use App\Http\Controllers\Controller;
use App\Models\Channel;
use App\Models\Notice;
use App\Models\AgentProduct;
use App\Models\Slide;
use App\Models\Special;
use App\Models\Advertising;
use App\Models\UserChannel;
use Illuminate\Support\Facades\Storage;
@ -23,15 +22,18 @@ class IndexController extends Controller
$img_prefix = Storage::disk('public')->url('');
# 轮播图
$slide = Slide::where(['agent_id' => $this->agent_id, 'status' => 1])
$slide = Advertising::where(['agent_id' => $this->agent_id, 'status' => 1, 'display' => 0])
->orderBy('sort')->orderBy('id', 'DESC')->limit(10)
->get(['title', 'picture', 'type', 'url']);
foreach ($slide as &$v) {
$v->picture = $img_prefix . $v->picture;
if (!$slide->isEmpty()) {
foreach ($slide as &$v) {
$v->picture = $img_prefix . $v->picture;
}
}
# 公告
$notice = Notice::where('agent_id', $this->agent_id)->limit(10)->get(['id', 'title', 'updated_at']);
$notice = Notice::where('agent_id', $this->agent_id)->limit(10)
->orderBy('sort')->orderBy('id', 'desc')->get(['id', 'title']);
# 我的频道
if ($this->user_id) {
@ -70,28 +72,25 @@ class IndexController extends Controller
}
# 专题列表
$special = Special::query()
->where('agent_id', $this->agent_id)
->orderBy('sort')->orderBy('id')
->limit(6)->get(['id', 'picture_ad']);
$special = Advertising::where(['agent_id' => $this->agent_id, 'display' => 1])
->orderBy('sort')->orderBy('id', 'desc')->limit(6)
->get(['title', 'picture', 'type', 'url']);
if (!$special->isEmpty()) {
foreach ($special as $k=>&$v) {
$v->picture_ad = $img_prefix . $v->picture_ad;
$v->picture = $img_prefix . $v->picture;
}
}
# 人气爆款
$hots = AgentProduct::query()
->where('agent_id', $this->agent_id)
->select('id', 'sale', 'product_id', 'price', 'original_price') //必须查询product_id才能with
->with('product:id,title,pictures') //必须查询ID才能正常查询
$hots = AgentProduct::list()->where('agent_id', $this->agent_id)
->orderBy('sale', 'desc')->orderBy('id', 'desc')
->limit(6)->get();
if (!$hots->isEmpty()) {
foreach ($hots as &$v) {
if (!empty($v->product->pictures) && is_array($v->product->pictures)) {
$v->product->pictures = array_map(function($item) use ($img_prefix) {
if (!empty($v->pictures) && is_array($v->pictures)) {
$v->pictures = array_map(function($item) use ($img_prefix) {
return strpos($item, $img_prefix) === false ? $img_prefix . $item : $item;
}, $v->product->pictures);
}, $v->pictures);
}
}
}

3
app/Http/Controllers/Api/LoginController.php

@ -67,8 +67,7 @@ class LoginController extends Controller
//TODO 存入初始化数据 user_channel
// TODO 用于测试
$token_key = md5($userModel->id);
$token_key = md5($userModel->id . env('APP_KEY'));
Cache::put($token_key, $userModel->id);
// 测试代码结束
$userModel->token = $token_key;

19
app/Http/Controllers/Api/MessageController.php

@ -4,6 +4,7 @@ namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Models\Message;
use App\Models\MessageRead;
use Illuminate\Http\Request;
/**
@ -15,10 +16,16 @@ class MessageController extends Controller
{
public function index()
{
$list = Message::where(['agent_id' => $this->agent_id, 'user_id' => $this->user_id])
->select('id', 'title', 'is_read', 'created_at')
$list = Message::where('agent_id', $this->agent_id)
->whereIn('user_id', [$this->user_id, 0]) //0是所有人都接收的系统消息
->select('id', 'user_id', 'title', 'created_at')
->orderBy('id', 'DESC')
->simplePaginate(15);
if (!empty($list->items())) {
foreach ($list->items() as &$v) {
$v->is_read = (int)MessageRead::where(['id' => $v->id, 'user_id' => $v->user_id])->exists();
}
}
return $this->success($list);
}
@ -26,8 +33,9 @@ class MessageController extends Controller
{
$id = (int)request()->input('id');
$message = Message::query()
->where(['agent_id' => $this->agent_id, 'user_id' => $this->user_id])
//增加where条件是为了防止偷看别人的消息
$message = Message::where(['agent_id' => $this->agent_id])
->whereIn('user_id', [$this->user_id, 0]) //0是所有人都接收的系统消息
->find($id);
if (!$message) {
@ -35,8 +43,7 @@ class MessageController extends Controller
}
//标记短消息为已读
$message->is_read = 1;
$message->save();
MessageRead::insertOrIgnore(['id' => $id, 'user_id' => $this->user_id]);
return $this->success($message);
}

34
app/Http/Controllers/Api/OrderController.php

@ -46,8 +46,7 @@ class OrderController extends Controller
$where['user_id'] = $this->user_id;
$order_list = Order::where($where)
->with('product:id,title,pictures')
->select('id', 'agent_product_id', 'product_id', 'picture', 'price', 'num', 'status', 'created_at')
->select('id', 'agent_product_id', 'product_id', 'title', 'picture', 'price', 'num', 'status', 'created_at')
->orderBy('id', 'DESC')
->simplePaginate(15)
->toArray();
@ -61,14 +60,14 @@ class OrderController extends Controller
$v['picture'] = $prefix . $v['picture'];
}
if (strpos($v['product']['picture'], $prefix) === false) {
$v['product']['picture'] = $prefix . $v['product']['picture'];
if (strpos($v['picture'], $prefix) === false) {
$v['picture'] = $prefix . $v['picture'];
}
if (!empty($v['product']['pictures']) && is_array($v['product']['pictures'])) {
$v['product']['pictures'] = array_map(function($item) use ($prefix) {
if (!empty($v['pictures']) && is_array($v['pictures'])) {
$v['pictures'] = array_map(function($item) use ($prefix) {
return strpos($item, $prefix) === false ? $prefix . $item : $item;
}, $v['product']['pictures']);
}, $v['pictures']);
}
//10分钟内未付款订单提示付款
@ -124,9 +123,10 @@ class OrderController extends Controller
->where('id', $formData['id'])
->with('coupon')
->with('product')
->has('product')
->first();
if (!$ap || !$ap->product) {
$this->error('产品不存在');
$this->error('产品不存在或已下架');
}
if ($ap->stock < $formData['num'] || $ap->product->stock < $formData['num']) {
$this->error('对不起,库存不足');
@ -142,12 +142,9 @@ class OrderController extends Controller
DB::beginTransaction();
try {
$price = $this->calc($ap->price, $ap->coupon, $formData['num'], $formData['pay_type']);
$title = $ap->product->title; //产品标题
//代理商产品表增加销量
// $ap->increment('sale', $formData['num']); TODO 支付成功之后再增加销量
$title = $ap->title; //产品标题
//供应商产品表加销量、减库存
// $ap->product->sale += $formData['num']; TODO 支付成功之后再增加销量
//供应商产品表减库存
$ap->product->decrement('stock', $formData['num']);
//代理商产品表减库存
@ -163,7 +160,7 @@ class OrderController extends Controller
'name' => $formData['name'],
'mobile' => $formData['mobile'],
'title' => $title,
'picture' => $ap->product->picture,
'picture' => $ap->picture,
'agent_product_id' => $ap->id,
'product_id' => $ap->product_id,
'product_ids' => $ap->product->product_ids ?? $ap->product_id,
@ -250,14 +247,17 @@ class OrderController extends Controller
}
$ap = AgentProduct::query()
->with('product:id,title,pictures')
->has('product')
->with('coupon:agent_product_id,type,detail,agent_id,tag,start_at,end_at')
->find($formData['id'], ['id', 'price', 'original_price', 'product_id']);
->find($formData['id'], ['id', 'price', 'original_price', 'product_id', 'title', 'pictures']);
if (!$ap) {
return $this->error('产品信息不存在');
}
$prefix = Storage::disk('public')->url('');
$ap->pictures = array_map(fn($v) => $prefix . $v, $ap->pictures);
//如果是线下支付,显示的价格跟在线全款支付价格一样
if ($formData['pay_type'] == PayType::OFFLINE) {
$formData['pay_type'] = PayType::ONLINE;
@ -321,7 +321,7 @@ class OrderController extends Controller
$result = $app->order->unify([
'body' => $order->title,
'out_trade_no' => $order->order_no . '-' . $order->status, //后面加status,主要是为了方便微信支付回调时区分定金(首付款)和尾款支付
'total_fee' => round($price * 100), //支付金额单位为分
'total_fee' => 1, //TODO 测试暂时注释 round($price * 100), //支付金额单位为分
'notify_url' => route('wxpay_notify', ['agent_id' => $this->agent_id]), // 支付结果通知网址,如果不设置则会使用配置里的默认地址
'trade_type' => 'JSAPI',
'openid' => $openid,

11
app/Http/Controllers/Api/SpecialController.php

@ -4,6 +4,7 @@ namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Models\AgentProduct;
use App\Models\Special;
use Illuminate\Support\Facades\Storage;
class SpecialController extends Controller
{
@ -11,14 +12,20 @@ class SpecialController extends Controller
public function show()
{
$id = (int)request()->input('id');
$prefix = Storage::disk('public')->url('');
$detail = Special::query()
->select(['id', 'picture', 'picture_ad', 'updated_at', 'agent_product_id'])
->select(['id', 'picture', 'updated_at', 'agent_product_id'])
->find($id);
$detail->picture = array_map(fn($v) => $prefix . $v, $detail->picture);
$detail->product = AgentProduct::list()
->where('agent_id', $this->agent_id)
->whereIn('id', $detail->agent_product_id)
->limit(6)->get();
->orderBy('id', 'DESC')->limit(6)->get();
foreach ($detail->product as $k => &$v) {
$v->pictures = array_map(fn($item) => $prefix . $item, $v->pictures);
}
unset($detail->agent_product_id);
return $this->success($detail);

17
app/Http/Controllers/Api/UserFavController.php

@ -18,8 +18,7 @@ class UserFavController extends Controller
{
$list = UserFav::query()
->with([
'agentProduct:id,price,original_price',
'product:id,title,pictures',
'agentProduct:id,price,original_price,title,pictures',
])
->where('user_id', $this->user_id)
->select('id', 'agent_product_id', 'product_id', 'created_at')
@ -30,16 +29,14 @@ class UserFavController extends Controller
$prefix = Storage::disk('public')->url('');
if ($list['data']) {
foreach ($list['data'] as &$v) {
if (!empty($v['product']['pictures'])) {
//单图
if (strpos($v['product']['picture'], $prefix) === false) {
$v['product']['picture'] = $prefix . $v['product']['picture'];
}
if (!empty($v['agent_product']['pictures'])) {
//多图
$v['product']['pictures'] = array_map(function ($v) use ($prefix) {
$v['agent_product']['pictures'] = array_map(function ($v) use ($prefix) {
return strpos($v, $prefix) === false ? $prefix . $v : $v;
}, $v['product']['pictures']);
}, $v['agent_product']['pictures']);
//单图
$v['agent_product']['picture'] = $prefix . $v['agent_product']['picture'];
}
}
}

2
app/Http/Controllers/Api/VerificationController.php

@ -28,7 +28,7 @@ class VerificationController extends Controller
}
$user = User::firstWhere(['id' => $this->user_id, 'status' => 1]);
if (!$user || $user->id != $order->agentProduct->verifier) {
if (!$user || $user->is_verify !=1 || $user->id != $order->agentProduct->verifier) {
return $this->error('对不起,你没有核销权限,请联系管理员');
}

3
app/Http/Controllers/Api/WxpayController.php

@ -30,6 +30,9 @@ class WxpayController
$app = Factory::payment($config);
try {
$response = $app->handlePaidNotify(function ($message, $fail) {
//TODO 仅测试用
DB::table('pay_debugs')->insert(['content' => json_encode($message)]);
$this->log($message);
// 请求成功
if ($message['return_code'] === 'SUCCESS') {

4
app/Models/Slide.php → app/Models/Advertising.php

@ -6,10 +6,10 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
/**
* 轮播图
* Class Slide
* Class Advertising
* @package App\Models
*/
class Slide extends BaseModel
class Advertising extends BaseModel
{
use HasFactory;

29
app/Models/AgentProduct.php

@ -59,6 +59,13 @@ class AgentProduct extends BaseModel
}
}
public function setPicturesAttribute($value)
{
if (is_array($value)) {
$this->attributes['pictures'] = json_encode(array_filter($value));
}
}
public function setProductIdsAttribute($value)
{
if (is_array($value)) {
@ -66,15 +73,29 @@ class AgentProduct extends BaseModel
}
}
// 获取所有产品图片
public function getPicturesAttribute($value): array
{
if (is_string($value)) {
$value = $value ? json_decode($value, true) : [];
}
$this->append('picture');
return $value ?? [];
}
// 获取第一张产品图片
public function getPictureAttribute($value): string
{
return $this->pictures[0] ?? '';
}
//列表查询统一查询条件
public function scopeList($query)
{
return $query->with('product:id,title,pictures')
->whereHas('product', function ($query) {
return $query->whereHas('product', function ($query) {
return $query->where('status', ProductStatus::ON_SALE)->where('stock', '>', 0);
})
->where('status', ProductStatus::ON_SALE)->where('stock', '>', 0)
->select('id', 'sale', 'product_id', 'price', 'original_price')
->orderBy('id', 'DESC');
->select('id', 'sale', 'product_id', 'price', 'original_price', 'title', 'pictures');
}
}

3
app/Models/Article.php

@ -3,8 +3,9 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\SoftDeletes;
class Article extends BaseModel
{
use HasFactory;
use HasFactory, SoftDeletes;
}

14
app/Models/MessageRead.php

@ -0,0 +1,14 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
/**
* 消息已读状态记录
* Class MessageRead
* @package App\Models
*/
class MessageRead extends BaseModel
{
use HasFactory;
}

5
app/Models/Order.php

@ -84,4 +84,9 @@ class Order extends BaseModel
{
return $this->belongsTo(User::class);
}
public function agentProductItem()
{
return $this->hasMany(AgentProductItem::class, 'agent_product_id', 'agent_product_id');
}
}

9
app/Models/Product.php

@ -32,7 +32,14 @@ class Product extends BaseModel
return $this->pictures[0] ?? '';
}
public function supplier()
public function setPicturesAttribute($value)
{
if (is_array($value)) {
$this->attributes['pictures'] = json_encode(array_filter($value));
}
}
public function supplier()
{
return $this->belongsTo(Supplier::class);
}

6
app/Models/Supplier.php

@ -17,6 +17,7 @@ class Supplier extends BaseModel
}
}
public function demand()
{
return $this->morphOne('App\Models\Demand', 'publisher');
@ -31,4 +32,9 @@ class Supplier extends BaseModel
{
return $this->morphOne('App\Models\DemandBidding', 'biddingUser');
}
public function agentProductItem()
{
return $this->hasMany(AgentProductItem::class);
}
}

18
app/Models/WaterfallAd.php

@ -1,18 +0,0 @@
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
class WaterfallAd extends Model
{
use HasDateTimeFormatter;
protected $table = 'waterfall_ads';
public function agentProduct()
{
return $this->belongsTo(AgentProduct::class);
}
}

2
config/admin-agent.php

@ -22,7 +22,7 @@ return [
| `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',
'logo' => '<img src="/vendor/dcat-admin/images/logo.png" width="35"> &nbsp;代理商管理后台',
/*
|--------------------------------------------------------------------------

2
config/admin-guide.php

@ -22,7 +22,7 @@ return [
| `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',
'logo' => '<img src="/vendor/dcat-admin/images/logo.png" width="35"> &nbsp;地接管理后台',
/*
|--------------------------------------------------------------------------

2
config/admin-supplier.php

@ -22,7 +22,7 @@ return [
| `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',
'logo' => '<img src="/vendor/dcat-admin/images/logo.png" width="35"> &nbsp;供应商管理后台',
/*
|--------------------------------------------------------------------------

380
dcat_admin_ide_helper.php

@ -11,214 +11,196 @@ namespace Dcat\Admin {
use Illuminate\Support\Collection;
/**
* @property Grid\Column|Collection agent_id
* @property Grid\Column|Collection created_at
* @property Grid\Column|Collection desc
* @property Grid\Column|Collection id
* @property Grid\Column|Collection name
* @property Grid\Column|Collection picture
* @property Grid\Column|Collection tag
* @property Grid\Column|Collection updated_at
* @property Grid\Column|Collection content
* @property Grid\Column|Collection know
* @property Grid\Column|Collection product_id
* @property Grid\Column|Collection detail
* @property Grid\Column|Collection type
* @property Grid\Column|Collection version
* @property Grid\Column|Collection detail
* @property Grid\Column|Collection created_at
* @property Grid\Column|Collection updated_at
* @property Grid\Column|Collection is_enabled
* @property Grid\Column|Collection parent_id
* @property Grid\Column|Collection order
* @property Grid\Column|Collection extension
* @property Grid\Column|Collection icon
* @property Grid\Column|Collection order
* @property Grid\Column|Collection parent_id
* @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 permission_id
* @property Grid\Column|Collection http_method
* @property Grid\Column|Collection http_path
* @property Grid\Column|Collection slug
* @property Grid\Column|Collection role_id
* @property Grid\Column|Collection user_id
* @property Grid\Column|Collection value
* @property Grid\Column|Collection username
* @property Grid\Column|Collection password
* @property Grid\Column|Collection avatar
* @property Grid\Column|Collection password
* @property Grid\Column|Collection remember_token
* @property Grid\Column|Collection agent_id
* @property Grid\Column|Collection username
* @property Grid\Column|Collection about
* @property Grid\Column|Collection reg_protocol
* @property Grid\Column|Collection buy_protocol
* @property Grid\Column|Collection supplier_id
* @property Grid\Column|Collection reg_protocol
* @property Grid\Column|Collection agent_product_id
* @property Grid\Column|Collection product_id
* @property Grid\Column|Collection product_ids
* @property Grid\Column|Collection price
* @property Grid\Column|Collection original_price
* @property Grid\Column|Collection sale
* @property Grid\Column|Collection stock
* @property Grid\Column|Collection channel_id
* @property Grid\Column|Collection supplier_id
* @property Grid\Column|Collection category_id
* @property Grid\Column|Collection channel_id
* @property Grid\Column|Collection deleted_at
* @property Grid\Column|Collection guide_id
* @property Grid\Column|Collection original_price
* @property Grid\Column|Collection price
* @property Grid\Column|Collection product_ids
* @property Grid\Column|Collection sale
* @property Grid\Column|Collection status
* @property Grid\Column|Collection stock
* @property Grid\Column|Collection verifier
* @property Grid\Column|Collection deleted_at
* @property Grid\Column|Collection address
* @property Grid\Column|Collection appid
* @property Grid\Column|Collection appsecret
* @property Grid\Column|Collection mchid
* @property Grid\Column|Collection mchkey
* @property Grid\Column|Collection company_name
* @property Grid\Column|Collection logo
* @property Grid\Column|Collection address
* @property Grid\Column|Collection license_pic
* @property Grid\Column|Collection director
* @property Grid\Column|Collection contact_phone
* @property Grid\Column|Collection director
* @property Grid\Column|Collection license_pic
* @property Grid\Column|Collection logo
* @property Grid\Column|Collection mchid
* @property Grid\Column|Collection mchkey
* @property Grid\Column|Collection rate
* @property Grid\Column|Collection author
* @property Grid\Column|Collection image
* @property Grid\Column|Collection content
* @property Grid\Column|Collection pid
* @property Grid\Column|Collection sort
* @property Grid\Column|Collection pid
* @property Grid\Column|Collection template
* @property Grid\Column|Collection tag
* @property Grid\Column|Collection start_at
* @property Grid\Column|Collection end_at
* @property Grid\Column|Collection comment
* @property Grid\Column|Collection deadline
* @property Grid\Column|Collection publisher_type
* @property Grid\Column|Collection publisher_id
* @property Grid\Column|Collection state
* @property Grid\Column|Collection bidding_user_type
* @property Grid\Column|Collection bidding_user_id
* @property Grid\Column|Collection bidding_id
* @property Grid\Column|Collection images
* @property Grid\Column|Collection demand_id
* @property Grid\Column|Collection uuid
* @property Grid\Column|Collection start_at
* @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 payload
* @property Grid\Column|Collection queue
* @property Grid\Column|Collection uuid
* @property Grid\Column|Collection photo
* @property Grid\Column|Collection is_read
* @property Grid\Column|Collection order_no
* @property Grid\Column|Collection num
* @property Grid\Column|Collection mobile
* @property Grid\Column|Collection picture
* @property Grid\Column|Collection pay_type
* @property Grid\Column|Collection coupon_id
* @property Grid\Column|Collection paid_money
* @property Grid\Column|Collection mobile
* @property Grid\Column|Collection num
* @property Grid\Column|Collection order_no
* @property Grid\Column|Collection paid_at
* @property Grid\Column|Collection paid_money
* @property Grid\Column|Collection pay_type
* @property Grid\Column|Collection refund_info
* @property Grid\Column|Collection verify_code
* @property Grid\Column|Collection email
* @property Grid\Column|Collection token
* @property Grid\Column|Collection pictures
* @property Grid\Column|Collection know
* @property Grid\Column|Collection url
* @property Grid\Column|Collection picture_ad
* @property Grid\Column|Collection channels
* @property Grid\Column|Collection money
* @property Grid\Column|Collection order_id
* @property Grid\Column|Collection desc
* @property Grid\Column|Collection transaction_id
* @property Grid\Column|Collection is_verify
* @property Grid\Column|Collection nickname
* @property Grid\Column|Collection openid
* @property Grid\Column|Collection unionid
*
* @method Grid\Column|Collection agent_id(string $label = null)
* @method Grid\Column|Collection created_at(string $label = null)
* @method Grid\Column|Collection desc(string $label = null)
* @method Grid\Column|Collection id(string $label = null)
* @method Grid\Column|Collection name(string $label = null)
* @method Grid\Column|Collection picture(string $label = null)
* @method Grid\Column|Collection tag(string $label = null)
* @method Grid\Column|Collection updated_at(string $label = null)
* @method Grid\Column|Collection content(string $label = null)
* @method Grid\Column|Collection know(string $label = null)
* @method Grid\Column|Collection product_id(string $label = null)
* @method Grid\Column|Collection detail(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 created_at(string $label = null)
* @method Grid\Column|Collection updated_at(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 extension(string $label = null)
* @method Grid\Column|Collection icon(string $label = null)
* @method Grid\Column|Collection order(string $label = null)
* @method Grid\Column|Collection parent_id(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 permission_id(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 slug(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 username(string $label = null)
* @method Grid\Column|Collection password(string $label = null)
* @method Grid\Column|Collection avatar(string $label = null)
* @method Grid\Column|Collection password(string $label = null)
* @method Grid\Column|Collection remember_token(string $label = null)
* @method Grid\Column|Collection agent_id(string $label = null)
* @method Grid\Column|Collection username(string $label = null)
* @method Grid\Column|Collection about(string $label = null)
* @method Grid\Column|Collection reg_protocol(string $label = null)
* @method Grid\Column|Collection buy_protocol(string $label = null)
* @method Grid\Column|Collection supplier_id(string $label = null)
* @method Grid\Column|Collection reg_protocol(string $label = null)
* @method Grid\Column|Collection agent_product_id(string $label = null)
* @method Grid\Column|Collection product_id(string $label = null)
* @method Grid\Column|Collection product_ids(string $label = null)
* @method Grid\Column|Collection price(string $label = null)
* @method Grid\Column|Collection original_price(string $label = null)
* @method Grid\Column|Collection sale(string $label = null)
* @method Grid\Column|Collection stock(string $label = null)
* @method Grid\Column|Collection channel_id(string $label = null)
* @method Grid\Column|Collection supplier_id(string $label = null)
* @method Grid\Column|Collection category_id(string $label = null)
* @method Grid\Column|Collection channel_id(string $label = null)
* @method Grid\Column|Collection deleted_at(string $label = null)
* @method Grid\Column|Collection guide_id(string $label = null)
* @method Grid\Column|Collection original_price(string $label = null)
* @method Grid\Column|Collection price(string $label = null)
* @method Grid\Column|Collection product_ids(string $label = null)
* @method Grid\Column|Collection sale(string $label = null)
* @method Grid\Column|Collection status(string $label = null)
* @method Grid\Column|Collection stock(string $label = null)
* @method Grid\Column|Collection verifier(string $label = null)
* @method Grid\Column|Collection deleted_at(string $label = null)
* @method Grid\Column|Collection address(string $label = null)
* @method Grid\Column|Collection appid(string $label = null)
* @method Grid\Column|Collection appsecret(string $label = null)
* @method Grid\Column|Collection mchid(string $label = null)
* @method Grid\Column|Collection mchkey(string $label = null)
* @method Grid\Column|Collection company_name(string $label = null)
* @method Grid\Column|Collection logo(string $label = null)
* @method Grid\Column|Collection address(string $label = null)
* @method Grid\Column|Collection license_pic(string $label = null)
* @method Grid\Column|Collection director(string $label = null)
* @method Grid\Column|Collection contact_phone(string $label = null)
* @method Grid\Column|Collection director(string $label = null)
* @method Grid\Column|Collection license_pic(string $label = null)
* @method Grid\Column|Collection logo(string $label = null)
* @method Grid\Column|Collection mchid(string $label = null)
* @method Grid\Column|Collection mchkey(string $label = null)
* @method Grid\Column|Collection rate(string $label = null)
* @method Grid\Column|Collection author(string $label = null)
* @method Grid\Column|Collection image(string $label = null)
* @method Grid\Column|Collection content(string $label = null)
* @method Grid\Column|Collection pid(string $label = null)
* @method Grid\Column|Collection sort(string $label = null)
* @method Grid\Column|Collection pid(string $label = null)
* @method Grid\Column|Collection template(string $label = null)
* @method Grid\Column|Collection tag(string $label = null)
* @method Grid\Column|Collection start_at(string $label = null)
* @method Grid\Column|Collection end_at(string $label = null)
* @method Grid\Column|Collection comment(string $label = null)
* @method Grid\Column|Collection deadline(string $label = null)
* @method Grid\Column|Collection publisher_type(string $label = null)
* @method Grid\Column|Collection publisher_id(string $label = null)
* @method Grid\Column|Collection state(string $label = null)
* @method Grid\Column|Collection bidding_user_type(string $label = null)
* @method Grid\Column|Collection bidding_user_id(string $label = null)
* @method Grid\Column|Collection bidding_id(string $label = null)
* @method Grid\Column|Collection images(string $label = null)
* @method Grid\Column|Collection demand_id(string $label = null)
* @method Grid\Column|Collection uuid(string $label = null)
* @method Grid\Column|Collection start_at(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 payload(string $label = null)
* @method Grid\Column|Collection queue(string $label = null)
* @method Grid\Column|Collection uuid(string $label = null)
* @method Grid\Column|Collection photo(string $label = null)
* @method Grid\Column|Collection is_read(string $label = null)
* @method Grid\Column|Collection order_no(string $label = null)
* @method Grid\Column|Collection num(string $label = null)
* @method Grid\Column|Collection mobile(string $label = null)
* @method Grid\Column|Collection picture(string $label = null)
* @method Grid\Column|Collection pay_type(string $label = null)
* @method Grid\Column|Collection coupon_id(string $label = null)
* @method Grid\Column|Collection paid_money(string $label = null)
* @method Grid\Column|Collection mobile(string $label = null)
* @method Grid\Column|Collection num(string $label = null)
* @method Grid\Column|Collection order_no(string $label = null)
* @method Grid\Column|Collection paid_at(string $label = null)
* @method Grid\Column|Collection paid_money(string $label = null)
* @method Grid\Column|Collection pay_type(string $label = null)
* @method Grid\Column|Collection refund_info(string $label = null)
* @method Grid\Column|Collection verify_code(string $label = null)
* @method Grid\Column|Collection email(string $label = null)
* @method Grid\Column|Collection token(string $label = null)
* @method Grid\Column|Collection pictures(string $label = null)
* @method Grid\Column|Collection know(string $label = null)
* @method Grid\Column|Collection url(string $label = null)
* @method Grid\Column|Collection picture_ad(string $label = null)
* @method Grid\Column|Collection channels(string $label = null)
* @method Grid\Column|Collection money(string $label = null)
* @method Grid\Column|Collection order_id(string $label = null)
* @method Grid\Column|Collection desc(string $label = null)
* @method Grid\Column|Collection transaction_id(string $label = null)
* @method Grid\Column|Collection is_verify(string $label = null)
* @method Grid\Column|Collection nickname(string $label = null)
* @method Grid\Column|Collection openid(string $label = null)
* @method Grid\Column|Collection unionid(string $label = null)
@ -228,214 +210,196 @@ namespace Dcat\Admin {
class MiniGrid extends Grid {}
/**
* @property Show\Field|Collection agent_id
* @property Show\Field|Collection created_at
* @property Show\Field|Collection desc
* @property Show\Field|Collection id
* @property Show\Field|Collection name
* @property Show\Field|Collection picture
* @property Show\Field|Collection tag
* @property Show\Field|Collection updated_at
* @property Show\Field|Collection content
* @property Show\Field|Collection know
* @property Show\Field|Collection product_id
* @property Show\Field|Collection detail
* @property Show\Field|Collection type
* @property Show\Field|Collection version
* @property Show\Field|Collection detail
* @property Show\Field|Collection created_at
* @property Show\Field|Collection updated_at
* @property Show\Field|Collection is_enabled
* @property Show\Field|Collection parent_id
* @property Show\Field|Collection order
* @property Show\Field|Collection extension
* @property Show\Field|Collection icon
* @property Show\Field|Collection order
* @property Show\Field|Collection parent_id
* @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 permission_id
* @property Show\Field|Collection http_method
* @property Show\Field|Collection http_path
* @property Show\Field|Collection slug
* @property Show\Field|Collection role_id
* @property Show\Field|Collection user_id
* @property Show\Field|Collection value
* @property Show\Field|Collection username
* @property Show\Field|Collection password
* @property Show\Field|Collection avatar
* @property Show\Field|Collection password
* @property Show\Field|Collection remember_token
* @property Show\Field|Collection agent_id
* @property Show\Field|Collection username
* @property Show\Field|Collection about
* @property Show\Field|Collection reg_protocol
* @property Show\Field|Collection buy_protocol
* @property Show\Field|Collection supplier_id
* @property Show\Field|Collection reg_protocol
* @property Show\Field|Collection agent_product_id
* @property Show\Field|Collection product_id
* @property Show\Field|Collection product_ids
* @property Show\Field|Collection price
* @property Show\Field|Collection original_price
* @property Show\Field|Collection sale
* @property Show\Field|Collection stock
* @property Show\Field|Collection channel_id
* @property Show\Field|Collection supplier_id
* @property Show\Field|Collection category_id
* @property Show\Field|Collection channel_id
* @property Show\Field|Collection deleted_at
* @property Show\Field|Collection guide_id
* @property Show\Field|Collection original_price
* @property Show\Field|Collection price
* @property Show\Field|Collection product_ids
* @property Show\Field|Collection sale
* @property Show\Field|Collection status
* @property Show\Field|Collection stock
* @property Show\Field|Collection verifier
* @property Show\Field|Collection deleted_at
* @property Show\Field|Collection address
* @property Show\Field|Collection appid
* @property Show\Field|Collection appsecret
* @property Show\Field|Collection mchid
* @property Show\Field|Collection mchkey
* @property Show\Field|Collection company_name
* @property Show\Field|Collection logo
* @property Show\Field|Collection address
* @property Show\Field|Collection license_pic
* @property Show\Field|Collection director
* @property Show\Field|Collection contact_phone
* @property Show\Field|Collection director
* @property Show\Field|Collection license_pic
* @property Show\Field|Collection logo
* @property Show\Field|Collection mchid
* @property Show\Field|Collection mchkey
* @property Show\Field|Collection rate
* @property Show\Field|Collection author
* @property Show\Field|Collection image
* @property Show\Field|Collection content
* @property Show\Field|Collection pid
* @property Show\Field|Collection sort
* @property Show\Field|Collection pid
* @property Show\Field|Collection template
* @property Show\Field|Collection tag
* @property Show\Field|Collection start_at
* @property Show\Field|Collection end_at
* @property Show\Field|Collection comment
* @property Show\Field|Collection deadline
* @property Show\Field|Collection publisher_type
* @property Show\Field|Collection publisher_id
* @property Show\Field|Collection state
* @property Show\Field|Collection bidding_user_type
* @property Show\Field|Collection bidding_user_id
* @property Show\Field|Collection bidding_id
* @property Show\Field|Collection images
* @property Show\Field|Collection demand_id
* @property Show\Field|Collection uuid
* @property Show\Field|Collection start_at
* @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 payload
* @property Show\Field|Collection queue
* @property Show\Field|Collection uuid
* @property Show\Field|Collection photo
* @property Show\Field|Collection is_read
* @property Show\Field|Collection order_no
* @property Show\Field|Collection num
* @property Show\Field|Collection mobile
* @property Show\Field|Collection picture
* @property Show\Field|Collection pay_type
* @property Show\Field|Collection coupon_id
* @property Show\Field|Collection paid_money
* @property Show\Field|Collection mobile
* @property Show\Field|Collection num
* @property Show\Field|Collection order_no
* @property Show\Field|Collection paid_at
* @property Show\Field|Collection paid_money
* @property Show\Field|Collection pay_type
* @property Show\Field|Collection refund_info
* @property Show\Field|Collection verify_code
* @property Show\Field|Collection email
* @property Show\Field|Collection token
* @property Show\Field|Collection pictures
* @property Show\Field|Collection know
* @property Show\Field|Collection url
* @property Show\Field|Collection picture_ad
* @property Show\Field|Collection channels
* @property Show\Field|Collection money
* @property Show\Field|Collection order_id
* @property Show\Field|Collection desc
* @property Show\Field|Collection transaction_id
* @property Show\Field|Collection is_verify
* @property Show\Field|Collection nickname
* @property Show\Field|Collection openid
* @property Show\Field|Collection unionid
*
* @method Show\Field|Collection agent_id(string $label = null)
* @method Show\Field|Collection created_at(string $label = null)
* @method Show\Field|Collection desc(string $label = null)
* @method Show\Field|Collection id(string $label = null)
* @method Show\Field|Collection name(string $label = null)
* @method Show\Field|Collection picture(string $label = null)
* @method Show\Field|Collection tag(string $label = null)
* @method Show\Field|Collection updated_at(string $label = null)
* @method Show\Field|Collection content(string $label = null)
* @method Show\Field|Collection know(string $label = null)
* @method Show\Field|Collection product_id(string $label = null)
* @method Show\Field|Collection detail(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 created_at(string $label = null)
* @method Show\Field|Collection updated_at(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 extension(string $label = null)
* @method Show\Field|Collection icon(string $label = null)
* @method Show\Field|Collection order(string $label = null)
* @method Show\Field|Collection parent_id(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 permission_id(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 slug(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 username(string $label = null)
* @method Show\Field|Collection password(string $label = null)
* @method Show\Field|Collection avatar(string $label = null)
* @method Show\Field|Collection password(string $label = null)
* @method Show\Field|Collection remember_token(string $label = null)
* @method Show\Field|Collection agent_id(string $label = null)
* @method Show\Field|Collection username(string $label = null)
* @method Show\Field|Collection about(string $label = null)
* @method Show\Field|Collection reg_protocol(string $label = null)
* @method Show\Field|Collection buy_protocol(string $label = null)
* @method Show\Field|Collection supplier_id(string $label = null)
* @method Show\Field|Collection reg_protocol(string $label = null)
* @method Show\Field|Collection agent_product_id(string $label = null)
* @method Show\Field|Collection product_id(string $label = null)
* @method Show\Field|Collection product_ids(string $label = null)
* @method Show\Field|Collection price(string $label = null)
* @method Show\Field|Collection original_price(string $label = null)
* @method Show\Field|Collection sale(string $label = null)
* @method Show\Field|Collection stock(string $label = null)
* @method Show\Field|Collection channel_id(string $label = null)
* @method Show\Field|Collection supplier_id(string $label = null)
* @method Show\Field|Collection category_id(string $label = null)
* @method Show\Field|Collection channel_id(string $label = null)
* @method Show\Field|Collection deleted_at(string $label = null)
* @method Show\Field|Collection guide_id(string $label = null)
* @method Show\Field|Collection original_price(string $label = null)
* @method Show\Field|Collection price(string $label = null)
* @method Show\Field|Collection product_ids(string $label = null)
* @method Show\Field|Collection sale(string $label = null)
* @method Show\Field|Collection status(string $label = null)
* @method Show\Field|Collection stock(string $label = null)
* @method Show\Field|Collection verifier(string $label = null)
* @method Show\Field|Collection deleted_at(string $label = null)
* @method Show\Field|Collection address(string $label = null)
* @method Show\Field|Collection appid(string $label = null)
* @method Show\Field|Collection appsecret(string $label = null)
* @method Show\Field|Collection mchid(string $label = null)
* @method Show\Field|Collection mchkey(string $label = null)
* @method Show\Field|Collection company_name(string $label = null)
* @method Show\Field|Collection logo(string $label = null)
* @method Show\Field|Collection address(string $label = null)
* @method Show\Field|Collection license_pic(string $label = null)
* @method Show\Field|Collection director(string $label = null)
* @method Show\Field|Collection contact_phone(string $label = null)
* @method Show\Field|Collection director(string $label = null)
* @method Show\Field|Collection license_pic(string $label = null)
* @method Show\Field|Collection logo(string $label = null)
* @method Show\Field|Collection mchid(string $label = null)
* @method Show\Field|Collection mchkey(string $label = null)
* @method Show\Field|Collection rate(string $label = null)
* @method Show\Field|Collection author(string $label = null)
* @method Show\Field|Collection image(string $label = null)
* @method Show\Field|Collection content(string $label = null)
* @method Show\Field|Collection pid(string $label = null)
* @method Show\Field|Collection sort(string $label = null)
* @method Show\Field|Collection pid(string $label = null)
* @method Show\Field|Collection template(string $label = null)
* @method Show\Field|Collection tag(string $label = null)
* @method Show\Field|Collection start_at(string $label = null)
* @method Show\Field|Collection end_at(string $label = null)
* @method Show\Field|Collection comment(string $label = null)
* @method Show\Field|Collection deadline(string $label = null)
* @method Show\Field|Collection publisher_type(string $label = null)
* @method Show\Field|Collection publisher_id(string $label = null)
* @method Show\Field|Collection state(string $label = null)
* @method Show\Field|Collection bidding_user_type(string $label = null)
* @method Show\Field|Collection bidding_user_id(string $label = null)
* @method Show\Field|Collection bidding_id(string $label = null)
* @method Show\Field|Collection images(string $label = null)
* @method Show\Field|Collection demand_id(string $label = null)
* @method Show\Field|Collection uuid(string $label = null)
* @method Show\Field|Collection start_at(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 payload(string $label = null)
* @method Show\Field|Collection queue(string $label = null)
* @method Show\Field|Collection uuid(string $label = null)
* @method Show\Field|Collection photo(string $label = null)
* @method Show\Field|Collection is_read(string $label = null)
* @method Show\Field|Collection order_no(string $label = null)
* @method Show\Field|Collection num(string $label = null)
* @method Show\Field|Collection mobile(string $label = null)
* @method Show\Field|Collection picture(string $label = null)
* @method Show\Field|Collection pay_type(string $label = null)
* @method Show\Field|Collection coupon_id(string $label = null)
* @method Show\Field|Collection paid_money(string $label = null)
* @method Show\Field|Collection mobile(string $label = null)
* @method Show\Field|Collection num(string $label = null)
* @method Show\Field|Collection order_no(string $label = null)
* @method Show\Field|Collection paid_at(string $label = null)
* @method Show\Field|Collection paid_money(string $label = null)
* @method Show\Field|Collection pay_type(string $label = null)
* @method Show\Field|Collection refund_info(string $label = null)
* @method Show\Field|Collection verify_code(string $label = null)
* @method Show\Field|Collection email(string $label = null)
* @method Show\Field|Collection token(string $label = null)
* @method Show\Field|Collection pictures(string $label = null)
* @method Show\Field|Collection know(string $label = null)
* @method Show\Field|Collection url(string $label = null)
* @method Show\Field|Collection picture_ad(string $label = null)
* @method Show\Field|Collection channels(string $label = null)
* @method Show\Field|Collection money(string $label = null)
* @method Show\Field|Collection order_id(string $label = null)
* @method Show\Field|Collection desc(string $label = null)
* @method Show\Field|Collection transaction_id(string $label = null)
* @method Show\Field|Collection is_verify(string $label = null)
* @method Show\Field|Collection nickname(string $label = null)
* @method Show\Field|Collection openid(string $label = null)
* @method Show\Field|Collection unionid(string $label = null)

64
ready.md

@ -6,8 +6,72 @@
5、关于我们、注册协议、购买协议等信息;
```sql
# 11:12 2021/8/26
TRUNCATE `advertisings`;
TRUNCATE `agent_products`;
TRUNCATE `agent_product_items`;
TRUNCATE `articles`;
TRUNCATE `coupons`;
TRUNCATE `messages`;
TRUNCATE `message_reads`;
TRUNCATE `notices`;
TRUNCATE `orders`;
TRUNCATE `products`;
TRUNCATE `specials`;
TRUNCATE `users`;
TRUNCATE `user_channels`;
TRUNCATE `user_favs`;
TRUNCATE `user_money_logs`;
TRUNCATE `agents`;
TRUNCATE `suppliers`;
TRUNCATE `guides`;
INSERT INTO `categories` (`id`, `agent_id`, `pid`, `name`, `sort`, `template`, `deleted_at`) VALUES (1, 0, 0, '酒店', 255, '', NULL);
INSERT INTO `categories` (`id`, `agent_id`, `pid`, `name`, `sort`, `template`, `deleted_at`) VALUES (2, 0, 0, '景点', 255, '', NULL);
INSERT INTO `categories` (`id`, `agent_id`, `pid`, `name`, `sort`, `template`, `deleted_at`) VALUES (3, 0, 0, '国内游', 255, '', NULL);
INSERT INTO `categories` (`id`, `agent_id`, `pid`, `name`, `sort`, `template`, `deleted_at`) VALUES (4, 0, 0, '国际游', 255, '', NULL);
INSERT INTO `categories` (`id`, `agent_id`, `pid`, `name`, `sort`, `template`, `deleted_at`) VALUES (5, 0, 0, '跟团游', 255, '', NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (1, 0, 0, '机票酒店', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (2, 0, 0, '旅游度假', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (3, 0, 0, '接送服务', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (4, 0, 0, '其它精选', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (5, 0, 0, '攻略社区', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (6, 0, 1, '多地比价', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (7, 0, 1, '降价提醒', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (8, 0, 1, '团体机票', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (9, 0, 2, '冲浪', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (10, 0, 2, '热气球', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (11, 0, 2, '蹦极', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (12, 0, 2, '滑翔伞', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (13, 0, 2, '主题玩法', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (14, 0, 2, '取景地', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (15, 0, 2, '周边游', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (16, 0, 2, '国内游', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (17, 0, 2, '尾单特卖', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (18, 0, 2, '邮轮', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (19, 0, 2, '汽车·船票', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (20, 0, 2, '定制游', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (21, 0, 2, '家庭游', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (22, 0, 2, '签证·上网', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (23, 0, 2, '自驾·租车', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (24, 0, 2, '旅游·团购', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (25, 0, 3, '接送机', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (26, 0, 3, '接送火车', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (27, 0, 3, '打车', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (28, 0, 3, '按天包车', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (29, 0, 3, '定制包车', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (30, 0, 3, '国内租车', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (31, 0, 3, '境外租车', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (32, 0, 4, '每日签到', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (33, 0, 4, '会员中心', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (34, 0, 4, '任务中心', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (35, 0, 4, '智慧旅游', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (36, 0, 4, '兑换会员', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (37, 0, 4, '旅盟', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (38, 0, 5, '旅游攻略', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (39, 0, 5, '玩法指南', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (40, 0, 5, '有问必答', 'images/icon.jpg', 255, NULL);
INSERT INTO `channels` (`id`, `agent_id`, `pid`, `name`, `icon`, `sort`, `deleted_at`) VALUES (41, 0, 5, '热门笔记', 'images/icon.jpg', 255, NULL);
```

28
resources/lang/zh_CN/advertising.php

@ -0,0 +1,28 @@
<?php
return [
'labels' => [
'Advertising' => '广告图',
'advertising' => '广告图',
],
'fields' => [
'title' => '标题',
'picture' => '图片地址',
'status' => '状态',
'agent_id' => '代理商ID',
'sort' => '排序',
'type' => '链接类型',
'url' => '链接到',
'display' => '显示位置',
],
'options' => [
'type' => [
0 => '内部页面',
1 => '网址',
],
'display' => [
0 => '轮播图',
1 => '首页横屏广告',
2 => '产品列表内嵌广告',
],
],
];

15
resources/lang/zh_CN/agent-info.php

@ -0,0 +1,15 @@
<?php
return [
'labels' => [
'AgentInfo' => '代理商信息',
'agent-info' => '代理商信息',
],
'fields' => [
'about' => '关于我们',
'agent_id' => '代理商ID',
'buy_protocol' => '购买协议',
'reg_protocol' => '注册协议',
],
'options' => [
],
];

6
resources/lang/zh_CN/agent-product.php

@ -15,6 +15,12 @@ return [
'category_id' => '分类',
'status' => '状态',
'verifier' => '核销人员',
'is_rec' => '是否推荐',
'title' => '标题',
'content' => '产品详情',
'know' => '旅游须知',
'pictures' => '产品图片',
'picture' => '产品图片',
'product' => trans('product.fields'),
],
'options' => [

1
resources/lang/zh_CN/agent.php

@ -21,6 +21,7 @@ return [
'license_pic' => '营业执照',
'director' => '负责人',
'contact_phone' => '联系电话',
'agentInfo' => trans('agent-info.fields'),
],
'options' => [
],

22
resources/lang/zh_CN/article.php

@ -0,0 +1,22 @@
<?php
return [
'labels' => [
'Article' => '文章',
'article' => '文章',
],
'fields' => [
'agent_id' => '代理商ID',
'author' => '作者',
'title' => '文章标题',
'image' => '文章缩略图',
'content' => '文章内容',
'sort' => '排序',
'type' => '显示方式',
],
'options' => [
'type' => [
0 => '普通列表',
1 => '大图显示',
],
],
];

16
resources/lang/zh_CN/message.php

@ -0,0 +1,16 @@
<?php
return [
'labels' => [
'Message' => '系统消息',
'message' => '系统消息',
],
'fields' => [
'agent_id' => '代理商ID',
'user_id' => '接收者ID',
'title' => '消息标题',
'content' => '消息内容',
'is_read' => '是否已读',
],
'options' => [
],
];

15
resources/lang/zh_CN/notice.php

@ -0,0 +1,15 @@
<?php
return [
'labels' => [
'Notice' => '系统公告',
'notice' => '系统公告',
],
'fields' => [
'agent_id' => '发布者ID',
'title' => '公告标题',
'sort' => '排序',
'content' => '公告内容',
],
'options' => [
],
];

2
resources/lang/zh_CN/product.php

@ -7,7 +7,7 @@ return [
'fields' => [
'category_id' => '产品分类ID',
'content' => '产品详情',
'know' => '旅须知',
'know' => '旅须知',
'original_price' => '原价',
'pictures' => '产品图片',
'picture' => '产品图片',

18
resources/lang/zh_CN/slide.php

@ -1,18 +0,0 @@
<?php
return [
'labels' => [
'Slide' => '轮播图',
'slide' => '轮播图',
],
'fields' => [
'title' => '图片说明',
'picture' => '图片地址',
'status' => '状态',
'agent_id' => '代理商ID',
'sort' => '排序',
'type' => '链接类型',
'url' => '链接到',
],
'options' => [
],
];

2
resources/lang/zh_CN/user.php

@ -13,7 +13,7 @@ return [
'openid' => '微信openid',
'status' => '用户状态',
'unionid' => '微信unionid',
'verifier' => '是否核销人员',
'is_verify' => '是否核销人员',
'created_at' => '注册时间',
],
'options' => [

17
routes/api.php

@ -21,6 +21,13 @@ use Illuminate\Support\Facades\Route;
# 登录
Route::post('login', 'App\Http\Controllers\Api\LoginController@login');
# 微信支付
Route::namespace('App\Http\Controllers\Api')
->prefix('wxpay')->group(function () {
Route::post('notify/{agent_id}', 'WxpayController@notify')->name('wxpay_notify'); //异步通知,aid为代理商ID
Route::post('refund/{agent_id}', 'WxpayController@refund')->name('wxpay_refund'); //退款通知,aid为代理商ID
});
# 仅用于测试
Route::get('t/index', \App\Http\Controllers\Api\TestController::class . '@index');
@ -71,11 +78,6 @@ Route::namespace('App\Http\Controllers\Api')
Route::post('show', 'SpecialController@show'); //专题详情
});
# 微信支付
Route::prefix('wxpay')->group(function () {
Route::post('notify/{agent_id}', 'WxpayController@notify')->name('wxpay_notify'); //异步通知,aid为代理商ID
Route::post('refund/{agent_id}', 'WxpayController@refund')->name('wxpay_refund'); //退款通知,aid为代理商ID
});
});
# 需要登录才能请求
@ -100,7 +102,10 @@ Route::namespace('App\Http\Controllers\Api')
});
# 核销订单
Route::post('verification/verify', 'VerificationController@verify');
Route::prefix('verification')->group(function () {
Route::post('verify', 'VerificationController@verify');
Route::post('qrcode', 'VerificationController@qrcode');
});
# 短信息
Route::prefix('message')->group(function () {

Loading…
Cancel
Save