Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
goods
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bp
goods
Commits
898c4e52
Commit
898c4e52
authored
Sep 15, 2021
by
jianghaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update:修改批量退款退库存
parent
5d6b8571
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
40 deletions
+50
-40
GoodsException.php
application/exception/custom/GoodsException.php
+2
-0
Goods.php
application/modules/Goods/controllers/Goods.php
+1
-1
GoodsService.php
application/services/goods/GoodsService.php
+17
-9
MarketingPindanGoodsService.php
application/services/goods/MarketingPindanGoodsService.php
+30
-30
No files found.
application/exception/custom/GoodsException.php
View file @
898c4e52
...
@@ -19,6 +19,7 @@ class GoodsException extends BaseException
...
@@ -19,6 +19,7 @@ class GoodsException extends BaseException
const
LABEL_PRINTER_ALREADY_EXIST
=
53
;
const
LABEL_PRINTER_ALREADY_EXIST
=
53
;
const
PRINTER_BIND_ERROR
=
54
;
const
PRINTER_BIND_ERROR
=
54
;
const
PRINTER_SN_ERROR
=
55
;
const
PRINTER_SN_ERROR
=
55
;
const
PARAMS_NULL_ERROR
=
56
;
protected
$cus
=
[
protected
$cus
=
[
0
=>
'商品创建失败,请稍后重试'
,
0
=>
'商品创建失败,请稍后重试'
,
...
@@ -77,5 +78,6 @@ class GoodsException extends BaseException
...
@@ -77,5 +78,6 @@ class GoodsException extends BaseException
self
::
LABEL_PRINTER_ALREADY_EXIST
=>
'标签打印机已被%s绑定'
,
self
::
LABEL_PRINTER_ALREADY_EXIST
=>
'标签打印机已被%s绑定'
,
self
::
PRINTER_BIND_ERROR
=>
'打印机绑定失败:%s'
,
self
::
PRINTER_BIND_ERROR
=>
'打印机绑定失败:%s'
,
self
::
PRINTER_SN_ERROR
=>
'打印机sn号码有误'
,
self
::
PRINTER_SN_ERROR
=>
'打印机sn号码有误'
,
self
::
PARAMS_NULL_ERROR
=>
'参数不能为空'
,
];
];
}
}
\ No newline at end of file
application/modules/Goods/controllers/Goods.php
View file @
898c4e52
...
@@ -314,7 +314,7 @@ class GoodsController extends Base
...
@@ -314,7 +314,7 @@ class GoodsController extends Base
*/
*/
public
function
refundAction
()
public
function
refundAction
()
{
{
(
new
RefundGoodsValidate
())
->
validate
();
//
(new RefundGoodsValidate())->validate();
$params
=
$this
->
params
;
$params
=
$this
->
params
;
$res
=
GoodsService
::
refundGoods
(
$params
);
$res
=
GoodsService
::
refundGoods
(
$params
);
$this
->
success
([
"result"
=>
$res
]);
$this
->
success
([
"result"
=>
$res
]);
...
...
application/services/goods/GoodsService.php
View file @
898c4e52
...
@@ -1936,19 +1936,27 @@ class GoodsService
...
@@ -1936,19 +1936,27 @@ class GoodsService
* @return bool
* @return bool
* @throws GoodsException
* @throws GoodsException
*/
*/
public
static
function
refundGoods
(
$
params
)
public
static
function
refundGoods
(
$
dataJson
)
{
{
if
(
empty
(
$dataJson
)){
throw
new
GoodsException
([
"cus"
=>
GoodsException
::
PARAMS_NULL_ERROR
]);
}
foreach
(
$dataJson
as
$params
){
$goodsSukParams
=
GoodsSkuId
::
getGoodsSkuIdParams
(
$params
[
"goods_sku_id"
]);
$goodsSukParams
=
GoodsSkuId
::
getGoodsSkuIdParams
(
$params
[
"goods_sku_id"
]);
if
(
!
empty
(
$goodsSukParams
))
{
if
(
!
empty
(
$goodsSukParams
))
{
if
(
isset
(
$goodsSukParams
[
"table_tag"
])
&&
(
$goodsSukParams
[
"table_tag"
]
==
GoodsSkuId
::
TABLE_TAG_PINDAN
if
(
isset
(
$goodsSukParams
[
"table_tag"
])
&&
(
$goodsSukParams
[
"table_tag"
]
==
GoodsSkuId
::
TABLE_TAG_PINDAN
||
$goodsSukParams
[
"category_1_id"
]
==
"00"
))
{
||
$goodsSukParams
[
"category_1_id"
]
==
"00"
))
{
return
MarketingPindanGoodsService
::
refundGoods
(
$params
)
;
$refundGoodsData
[]
=
$params
;
}
}
}
else
{
}
else
{
throw
new
GoodsException
([
"cus"
=>
41
]);
throw
new
GoodsException
([
"cus"
=>
41
]);
}
}
}
if
(
empty
(
$refundGoodsData
)){
return
true
;
return
true
;
}
}
return
MarketingPindanGoodsService
::
refundGoods
(
$refundGoodsData
);
}
/**
/**
* 通过goods_sku_id 获取 拼单商品的ota信息
* 通过goods_sku_id 获取 拼单商品的ota信息
...
...
application/services/goods/MarketingPindanGoodsService.php
View file @
898c4e52
...
@@ -471,20 +471,22 @@ class MarketingPindanGoodsService
...
@@ -471,20 +471,22 @@ class MarketingPindanGoodsService
}
}
/**
/**
* 退款拼单商品,库存调整
* 退款拼单商品,库存调整
(批量退库存)
* @param $params
* @param $params
* @return bool
* @return bool
* @throws GoodsException
* @throws GoodsException
*/
*/
public
static
function
refundGoods
(
$
params
)
public
static
function
refundGoods
(
$
dataJson
)
{
{
if
(
empty
(
$dataJson
)){
throw
new
GoodsException
([
"cus"
=>
GoodsException
::
PARAMS_NULL_ERROR
]);
}
PindanGoodsSku
::
beginTransaction
();
foreach
(
$dataJson
as
$params
){
$sku
=
PindanGoodsSku
::
get
(
"*"
,
[
"goods_sku_id"
=>
$params
[
"goods_sku_id"
]]);
$sku
=
PindanGoodsSku
::
get
(
"*"
,
[
"goods_sku_id"
=>
$params
[
"goods_sku_id"
]]);
if
(
empty
(
$sku
))
{
if
(
empty
(
$sku
))
{
throw
new
GoodsException
([
"cus"
=>
15
]);
throw
new
GoodsException
([
"cus"
=>
15
]);
}
}
PindanGoodsSku
::
beginTransaction
();
$records
=
GoodsRefundRecord
::
getRecordMaster
([
$records
=
GoodsRefundRecord
::
getRecordMaster
([
"goods_sku_id"
=>
$params
[
"goods_sku_id"
],
"goods_sku_id"
=>
$params
[
"goods_sku_id"
],
"order_item_id"
=>
$params
[
"order_item_id"
],
"order_item_id"
=>
$params
[
"order_item_id"
],
...
@@ -504,9 +506,7 @@ class MarketingPindanGoodsService
...
@@ -504,9 +506,7 @@ class MarketingPindanGoodsService
"total_amount_order[-]"
=>
$params
[
"num"
],
"total_amount_order[-]"
=>
$params
[
"num"
],
"inventory_rest[+]"
=>
$params
[
"num"
],
"inventory_rest[+]"
=>
$params
[
"num"
],
],
[
"goods_sku_id"
=>
$sku
[
"goods_sku_id"
],
"total_amount_sold[>=]"
=>
$params
[
"num"
],
"total_amount_order[>=]"
=>
$params
[
"num"
]]);
],
[
"goods_sku_id"
=>
$sku
[
"goods_sku_id"
],
"total_amount_sold[>=]"
=>
$params
[
"num"
],
"total_amount_order[>=]"
=>
$params
[
"num"
]]);
FileLog
::
info
(
'goods_refund_log'
,
'json decode error raw:'
.
json_encode
(
$params
));
FileLog
::
info
(
'goods_refund_log'
,
'json decode error raw:'
.
json_encode
(
$params
));
if
(
$row
<
1
){
if
(
$row
<
1
){
PindanGoodsSku
::
rollback
();
PindanGoodsSku
::
rollback
();
GoodsRefundRecord
::
save
([
GoodsRefundRecord
::
save
([
...
@@ -519,7 +519,7 @@ class MarketingPindanGoodsService
...
@@ -519,7 +519,7 @@ class MarketingPindanGoodsService
throw
new
GoodsException
([
"cus"
=>
0
]);
throw
new
GoodsException
([
"cus"
=>
0
]);
}
}
}
}
}
if
(
!
PindanGoodsSku
::
commit
())
{
if
(
!
PindanGoodsSku
::
commit
())
{
PindanGoodsSku
::
rollback
();
PindanGoodsSku
::
rollback
();
throw
new
GoodsException
([
"cus"
=>
0
]);
throw
new
GoodsException
([
"cus"
=>
0
]);
...
...
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