Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
service
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
aimeiyue
service
Commits
27e6c88c
Commit
27e6c88c
authored
Oct 18, 2024
by
lizhilin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
ed851adc
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
0 additions
and
476 deletions
+0
-476
app/Admin/Actions/DownloadTemplateExcel.php
+0
-46
app/Admin/Actions/GoodsExcel.php
+0
-69
app/Admin/Controllers/CheckNumberController.php
+0
-92
app/Admin/Controllers/GoodController.php
+0
-21
app/Admin/Controllers/UserCollectController.php
+0
-62
app/Admin/Controllers/VerifierController.php
+0
-68
app/Admin/Extensions/GoodsExport.php
+0
-118
No files found.
app/Admin/Actions/DownloadTemplateExcel.php
deleted
100644 → 0
View file @
ed851adc
<?php
namespace
App\Admin\Actions
;
use
Dcat\Admin\Actions\Action
;
use
Dcat\Admin\Actions\Response
;
use
Illuminate\Support\Facades\Storage
;
/**
* 下载导入模板
* Class DownloadTemplate
*
* @package App\Admin\Actions
*/
class
DownloadTemplateExcel
extends
Action
{
/**
* @return string
*/
protected
$title
=
'<button class="btn btn-primary"><i class="feather icon-download"></i> 下载导入模板</button>'
;
/**
* Handle the action request.
*
* @return Response
*/
public
function
handle
()
{
$file_name
=
''
;
switch
(
$this
->
getKey
())
{
case
'good'
:
$file_name
=
'商品资源库导入模版'
;
break
;
}
return
$this
->
response
()
->
download
(
'/excelTemplate/'
.
$file_name
.
'.xlsx'
);
}
public
function
parameters
()
{
return
[
'mode'
=>
''
,
];
}
}
app/Admin/Actions/GoodsExcel.php
deleted
100644 → 0
View file @
ed851adc
<?php
namespace
App\Admin\Actions
;
use
App\Command\Log
;
use
Dcat\Admin\Actions\Action
;
use
Dcat\Admin\Actions\Response
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\Storage
;
/**
* 导出商品
*
* @package App\Admin\Actions
*/
class
GoodsExcel
extends
Action
{
protected
$request_param
=
[];
protected
$request_filename
=
''
;
protected
$title
=
''
;
/**
* 接收参数
*/
public
function
__construct
(
$param
=
[],
$filename
=
''
,
$title
=
''
)
{
$this
->
request_param
=
$param
;
$this
->
request_filename
=
$filename
;
parent
::
__construct
(
$title
);
$this
->
title
=
$title
;
}
//protected $title = '<button class="btn btn-primary"><i class="feather icon-download"></i> 下载模板</button>';
/**
* 按钮文本
*
* @return string|void
*/
public
function
title
()
{
return
'<button class="btn btn-primary"><i class="feather icon-download"></i> '
.
$this
->
title
.
'</button>'
;
}
/**
* Handle the action request.
*
* @return Response
*/
public
function
handle
(
Request
$request
)
{
$param
=
$request
->
get
(
'param'
);
$filename
=
$request
->
get
(
'filename'
);
//调用导出接口
return
$this
->
response
()
->
download
(
'/goods-export?filename='
.
$filename
.
'¶m='
.
json_encode
(
$param
)
.
'&_export_=1'
);
}
public
function
parameters
()
{
return
[
'mode'
=>
''
,
'param'
=>
$this
->
request_param
,
'filename'
=>
$this
->
request_filename
,
'title'
=>
$this
->
title
,
];
}
}
app/Admin/Controllers/CheckNumberController.php
deleted
100644 → 0
View file @
ed851adc
<?php
namespace
App\Admin\Controllers
;
use
App\Models\CheckNumber
;
use
Dcat\Admin\Form
;
use
Dcat\Admin\Grid
;
use
Dcat\Admin\Show
;
use
Dcat\Admin\Http\Controllers\AdminController
;
use
Illuminate\Support\Str
;
use
Dcat\Admin\Widgets\Modal
;
use
App\Admin\Forms\GenerateUserCode
;
class
CheckNumberController
extends
AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected
function
grid
()
{
return
Grid
::
make
(
new
CheckNumber
(),
function
(
Grid
$grid
)
{
$grid
->
tools
(
function
(
Grid\Tools
$tools
)
{
$tools
->
append
(
Modal
::
make
()
// 大号弹窗
->
lg
()
// 弹窗标题
->
title
(
'新增'
)
// 按钮
->
button
(
'<button class="btn btn-primary"> 新增</button>'
)
// 弹窗内容
->
body
(
GenerateUserCode
::
make
()
->
payload
([
'className'
=>
CheckNumber
::
class
])));
//->body(ImportExcel::make()->payload(['className' => CheckNumber::class])));
});
$grid
->
model
()
->
orderBy
(
'id'
,
'DESC'
);
$grid
->
column
(
'id'
)
->
sortable
();
$grid
->
column
(
'code'
,
'审核编号'
);
$grid
->
column
(
'status'
,
'使用状态'
)
->
display
(
function
(
$val
)
{
return
$val
==
0
?
'未使用'
:
'已使用'
;
});;
$grid
->
column
(
'created_at'
);
//$randomNumber = $this->generateRandomString(6);
$grid
->
disableFilterButton
();
$grid
->
disableViewButton
();
$grid
->
disableEditButton
();
$grid
->
disableCreateButton
();
$grid
->
enableDialogCreate
();
$grid
->
filter
(
function
(
Grid\Filter
$filter
)
{
$filter
->
equal
(
'id'
);
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected
function
detail
(
$id
)
{
return
Show
::
make
(
$id
,
new
CheckNumber
(),
function
(
Show
$show
)
{
$show
->
field
(
'id'
);
$show
->
field
(
'code'
);
$show
->
field
(
'status'
)
->
display
(
function
(
$val
)
{
return
$val
==
0
?
'未使用'
:
'已使用'
;
});
$show
->
field
(
'created_at'
);
$show
->
field
(
'updated_at'
);
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected
function
form
()
{
return
Form
::
make
(
new
CheckNumber
(),
function
(
Form
$form
)
{
$form
->
display
(
'id'
);
$form
->
text
(
'number'
,
'生成数量'
);
//$form->text('status');
$form
->
display
(
'created_at'
);
$form
->
display
(
'updated_at'
);
});
}
}
app/Admin/Controllers/GoodController.php
View file @
27e6c88c
...
...
@@ -12,15 +12,10 @@
use
Dcat\Admin\Http\Controllers\AdminController
;
use
Dcat\Admin\Widgets\Card
;
use
Dcat\Admin\Widgets\Modal
;
use
App\Admin\Forms\ImportExcel
;
use
App\Admin\Actions\DownloadTemplateExcel
;
use
Illuminate\Support\Facades\DB
;
use
App\Admin\Renderable\RenderGoodSku
;
use
App\Admin\Repositories\GoodSku
as
SkuRepos
;
use
App\Admin\Actions\GoodsExcel
;
use
Illuminate\Http\Request
;
use
App\Admin\Extensions\GoodsExport
;
use
Maatwebsite\Excel\Facades\Excel
;
class
GoodController
extends
AdminController
{
...
...
@@ -320,20 +315,4 @@ public static function editGoodSkuData($attrsKey, $sku, $gid)
return
$sku
;
}
/**
* 导出
*
* @param Request $request
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
*/
public
function
export
(
Request
$request
)
{
$filename
=
$request
->
get
(
'filename'
);
$param
=
json_decode
(
$request
->
get
(
'param'
));
ob_end_clean
();
return
Excel
::
download
(
new
GoodsExport
(
$param
),
$filename
.
'.xlsx'
);
}
}
app/Admin/Controllers/UserCollectController.php
deleted
100644 → 0
View file @
ed851adc
<?php
namespace
App\Admin\Controllers
;
use
App\Models\UserCollect
;
use
Dcat\Admin\Form
;
use
Dcat\Admin\Grid
;
use
Dcat\Admin\Show
;
use
Dcat\Admin\Http\Controllers\AdminController
;
class
UserCollectController
extends
AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected
function
grid
()
{
return
Grid
::
make
(
new
UserCollect
(),
function
(
Grid
$grid
)
{
$grid
->
column
(
'id'
)
->
sortable
();
$grid
->
column
(
'created_at'
);
$grid
->
column
(
'updated_at'
)
->
sortable
();
$grid
->
filter
(
function
(
Grid\Filter
$filter
)
{
$filter
->
equal
(
'id'
);
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected
function
detail
(
$id
)
{
return
Show
::
make
(
$id
,
new
UserCollect
(),
function
(
Show
$show
)
{
$show
->
field
(
'id'
);
$show
->
field
(
'created_at'
);
$show
->
field
(
'updated_at'
);
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected
function
form
()
{
return
Form
::
make
(
new
UserCollect
(),
function
(
Form
$form
)
{
$form
->
display
(
'id'
);
$form
->
display
(
'created_at'
);
$form
->
display
(
'updated_at'
);
});
}
}
app/Admin/Controllers/VerifierController.php
deleted
100644 → 0
View file @
ed851adc
<?php
namespace
App\Admin\Controllers
;
use
App\Admin\Repositories\Verifier
;
use
Dcat\Admin\Form
;
use
Dcat\Admin\Grid
;
use
Dcat\Admin\Show
;
use
Dcat\Admin\Http\Controllers\AdminController
;
class
VerifierController
extends
AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected
function
grid
()
{
return
Grid
::
make
(
new
Verifier
(),
function
(
Grid
$grid
)
{
$grid
->
column
(
'id'
)
->
sortable
();
$grid
->
column
(
'merchant_id'
);
$grid
->
column
(
'store_id'
);
$grid
->
column
(
'created_at'
);
$grid
->
column
(
'updated_at'
)
->
sortable
();
$grid
->
filter
(
function
(
Grid\Filter
$filter
)
{
$filter
->
equal
(
'id'
);
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected
function
detail
(
$id
)
{
return
Show
::
make
(
$id
,
new
Verifier
(),
function
(
Show
$show
)
{
$show
->
field
(
'id'
);
$show
->
field
(
'merchant_id'
);
$show
->
field
(
'store_id'
);
$show
->
field
(
'created_at'
);
$show
->
field
(
'updated_at'
);
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected
function
form
()
{
return
Form
::
make
(
new
Verifier
(),
function
(
Form
$form
)
{
$form
->
display
(
'id'
);
$form
->
text
(
'merchant_id'
);
$form
->
text
(
'store_id'
);
$form
->
display
(
'created_at'
);
$form
->
display
(
'updated_at'
);
});
}
}
app/Admin/Extensions/GoodsExport.php
deleted
100644 → 0
View file @
ed851adc
<?php
namespace
App\Admin\Extensions
;
use
App\Models\Good
as
GoodModel
;
use
App\Models\Category
as
CategoryModel
;
use
App\Models\GoodSku
as
GoodSkuModel
;
use
Illuminate\Support\Facades\DB
;
use
Maatwebsite\Excel\Concerns\FromCollection
;
use
Maatwebsite\Excel\Concerns\WithHeadings
;
class
GoodsExport
implements
FromCollection
,
WithHeadings
{
private
$row
;
private
$data
;
private
$headings
;
/**
* TaskDataExcelExpoter constructor.
* @param array $param 筛选条件
* @param array $data 数据
* @param array $headings 表头
*/
public
function
__construct
(
$param
=
[],
$data
=
[],
$headings
=
[])
{
//表头设定
$headings
=
[[
'goods_id'
=>
'商品ID'
,
'goods_name'
=>
'商品名称'
,
'catname'
=>
'分类'
,
'sku'
=>
'规格信息'
,
'product_no'
=>
'型号'
,
'material'
=>
'材质'
,
'box_size'
=>
'箱规'
,
'is_jd'
=>
'是否京东自营'
,
'supplier'
=>
'供应商联系人'
,
'su_phone'
=>
'联系方式'
,
]];
$data
=
$this
->
getList
(
$param
);
$this
->
headings
=
$headings
;
$this
->
data
=
$data
;
}
public
function
headings
()
:
array
{
return
$this
->
headings
;
}
public
function
collection
()
{
return
collect
(
$this
->
data
);
}
// 获取导出数据
public
function
getList
(
$param
)
{
$param
=
json_decode
(
json_encode
(
$param
),
true
);
$prePage
=
$param
[
'per_page'
]
??
200
;
$start
=
$param
[
'start'
]
??
0
;
$goods_name
=
$param
[
'search'
][
'goods_name'
]
??
''
;
$cat_id
=
$param
[
'search'
][
'cat_id'
]
??
0
;
DB
::
enableQueryLog
();
$note_monitor
=
DB
::
table
(
'li_goods'
);
$where
=
[];
if
(
$cat_id
)
{
$where
[
'cat_id'
]
=
$cat_id
;
}
if
(
$goods_name
)
{
$where
[
'goods_name'
]
=
$goods_name
;
}
$note_monitor
=
$note_monitor
->
where
(
$where
);
// 计算列表总数
$count
=
$note_monitor
->
count
();
// 获取列表
$data
=
[];
$list
=
$note_monitor
->
orderBy
(
"id"
,
'desc'
)
->
limit
(
$prePage
)
->
offset
(
$start
)
->
get
()
->
toArray
();
//$queries = DB::getQueryLog();
foreach
(
$list
as
$key
=>
$objVal
)
{
$tmp
=
[];
//ID
$tmp
[
'goods_id'
]
=
$objVal
->
id
;
//名称
$tmp
[
'goods_name'
]
=
$objVal
->
goods_name
;
//分类
$catObj
=
CategoryModel
::
find
(
$objVal
->
cat_id
);
$tmp
[
'catname'
]
=
$catObj
?
$catObj
->
title
:
''
;
//规格
$skufield
=
$objVal
->
sku
?
json_decode
(
$objVal
->
sku
,
true
)
:
[];
$attrsKey
=
isset
(
$skufield
[
'attrs'
])
?
array_keys
(
$skufield
[
'attrs'
])
:
[];
$attrsVal
=
isset
(
$skufield
[
'attrs'
])
?
array_values
(
$skufield
[
'attrs'
])
:
[];
$skuData
=
isset
(
$skufield
[
'sku'
])
?
$skufield
[
'sku'
]
:
[];
$skuStr
=
""
;
foreach
(
$skuData
as
$kk
=>
$vv
)
{
$attr_sn
=
isset
(
$vv
[
'attr_sn'
])
?
$vv
[
'attr_sn'
]
:
''
;
if
(
!
$attr_sn
)
{
continue
;
}
$gattr
=
DB
::
table
(
"li_goods_sku"
)
->
where
(
'goods_id'
,
$objVal
->
id
)
->
where
(
'attr_sn'
,
$attr_sn
)
->
first
();
$skuStr
.=
" 规格:"
.
$gattr
->
attr_val
.
" 购买数量:"
.
$vv
[
'numb'
]
.
" 折扣价:"
.
$vv
[
'price'
]
.
" 采购价:"
.
$vv
[
'cg_price'
]
.
" 京东价:"
.
$vv
[
'jd_price'
]
.
" 市场价:"
.
$vv
[
'market_price'
]
.
" 库存:"
.
$vv
[
'stock'
]
.
"
\n
"
;
}
$tmp
[
'sku'
]
=
$skuStr
;
$tmp
[
'product_no'
]
=
$objVal
->
product_no
;
$tmp
[
'material'
]
=
$objVal
->
material
;
$tmp
[
'box_size'
]
=
$objVal
->
box_size
;
$tmp
[
'is_jd'
]
=
(
$objVal
->
is_jd
==
1
)
?
'京东自营'
:
'非京东自营'
;
$tmp
[
'supplier'
]
=
$objVal
->
supplier
;
$tmp
[
'su_phone'
]
=
$objVal
->
su_phone
;
array_push
(
$data
,
$tmp
);
}
return
$data
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment