6
0
Fork 0

store excel

base
panliang 2023-02-15 11:53:38 +08:00
parent 8fcfc148e9
commit fddb704877
4 changed files with 64 additions and 65 deletions

View File

@ -20,18 +20,19 @@ class HomeController extends Controller
->header('首页')
->description('首页')
->body(function (Row $row) {
$row->column(6, function (Column $column) {
$user = Admin::user();
$row->column(6, function (Column $column) use ($user) {
$column->row(Dashboard::title());
if (Admin::user()->can('dcat.admin.home.statistics')) {
if ($user->can('dcat.admin.home.statistics')) {
$column->row(new StatisticsTotal());
}
});
$row->column(6, function (Column $column) {
if (Admin::user()->can('dcat.admin.home.new_users')) {
$row->column(6, function (Column $column) use ($user) {
if ($user->can('dcat.admin.home.new_users')) {
$column->row(new NewUsers());
}
if (Admin::user()->can('dcat.admin.home.orders')) {
if ($user->can('dcat.admin.home.orders')) {
$column->row(new Orders());
}
});

View File

@ -27,6 +27,7 @@ class StoreProduct
$index = 0;
$storeName = $cells[$index];// 店铺名称
$goodsName = $cells[++$index];// 商品名称
$stock = $cells[++$index];// 库存
$goodsTitle = $cells[++$index];// 商品副标题
$categoryName = $cells[++$index];// 分类名称
$goodsImage = $cells[++$index];// 商品图片
@ -47,13 +48,13 @@ class StoreProduct
// https://qiniu.abcdefg.fun/banner/banner4.png,https://qiniu.abcdefg.fun/banner/banner5.png
$goodsContent = $cells[++$index];
$stock = $cells[++$index];// 库存
$store = Store::where(['title' => $storeName])->first();
if (!$store) {
throw new ImportException('门店 '.$storeName.' 不存在');
}
$product = ProductSpu::where('name', $goodsName)->first();
if (!$product) {
$goods = [
'name' => $goodsName,
'subtitle' => $goodsTitle,
@ -103,9 +104,6 @@ class StoreProduct
'sales_value' => $saleValue,
'stock' => $stock,
]);
$product = ProductSpu::where('name', $goods['name'])->first();
if (!$product) {
$product = ProductSpu::create($goods);
// 属性规格
if ($rowAttrs) {

View File

@ -70,9 +70,9 @@ class AdminPermissionSeeder extends Seeder
'name'=>'主页',
'curd' => false,
'children' =>[
'home.statistics'=>['name' =>'统计预览'],
'home.new_users'=>['name' =>'新注册'],
'home.orders'=>['name' =>'订单'],
'statistics'=>['name' =>'统计预览'],
'new_users'=>['name' =>'新注册'],
'orders'=>['name' =>'订单'],
],
],
'users'=>[

Binary file not shown.