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
3bb855cb
Commit
3bb855cb
authored
Jul 15, 2021
by
jianghaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
https://gitlab.yidian-inc.com/bp/goods
into develop
parents
68786876
1b604a67
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
46 deletions
+50
-46
PaySuccessGoodsCallbackValidate.php
...tion/library/Validate/PaySuccessGoodsCallbackValidate.php
+4
-6
GoodsService.php
application/services/goods/GoodsService.php
+46
-40
No files found.
application/library/Validate/PaySuccessGoodsCallbackValidate.php
View file @
3bb855cb
...
...
@@ -12,14 +12,12 @@ namespace Validate;
class
PaySuccessGoodsCallbackValidate
extends
BaseValidate
{
protected
$rule
=
[
'pay_order_id'
=>
'require'
,
'goods_sku_id'
=>
'require'
,
'num'
=>
'require'
,
'order_id'
=>
'require'
,
'goods'
=>
'require'
,
];
protected
$message
=
[
"pay_order_id"
=>
"pay_order_id 不能为空"
,
"goods_sku_id"
=>
"goods_sku_id 不能为空"
,
"num"
=>
"商品数量不能为空"
,
"order_id"
=>
"order_id 不能为空"
,
"goods"
=>
"goods 信息不能为空"
,
];
}
\ No newline at end of file
application/services/goods/GoodsService.php
View file @
3bb855cb
...
...
@@ -769,7 +769,7 @@ class GoodsService
}
}
}
$recordList
=
GoodsOperationRecord
::
select
(
"*"
,
[
"goods_spu_id"
=>
$goodsSpuId
,
"ORDER"
=>
[
"create_time"
=>
"DESC"
]]);
$recordList
=
GoodsOperationRecord
::
select
(
"*"
,
[
"goods_spu_id"
=>
$goodsSpuId
,
"ORDER"
=>
[
"create_time"
=>
"DESC"
]]);
if
(
!
empty
(
$recordList
))
{
foreach
(
$recordList
as
$key
=>
$record
)
{
$data
[
"record_list"
][
$key
][
"status"
]
=
$record
[
"goods_status"
];
...
...
@@ -824,7 +824,7 @@ class GoodsService
$data
[
"goods_info"
][
"rule"
][
"rule_limit"
]
=
$sku
[
"rule_limit"
];
$data
[
"goods_info"
][
"rule"
][
"rule_refund"
]
=
$ruleRefundDesc
;
$data
[
"goods_info"
][
"rule"
][
"rule_date_type"
]
=
$ruleDateTypeDesc
;
$data
[
"goods_info"
][
"rule"
][
"rule_time"
]
=
date
(
'H:i'
,
strtotime
(
$sku
[
"rule_start_time"
]))
.
" ~ "
.
date
(
'H:i'
,
strtotime
(
$sku
[
"rule_end_time"
]));
$data
[
"goods_info"
][
"rule"
][
"rule_time"
]
=
date
(
'H:i'
,
strtotime
(
$sku
[
"rule_start_time"
]))
.
" ~ "
.
date
(
'H:i'
,
strtotime
(
$sku
[
"rule_end_time"
]));
$data
[
"goods_info"
][
"rule"
][
"rule_desc"
]
=
$sku
[
"rule_desc"
];
$data
[
"goods_info"
][
"rule"
][
"expiration_time"
]
=
$sku
[
"expiration_time"
];
...
...
@@ -905,7 +905,7 @@ class GoodsService
$status
=
explode
(
","
,
$params
[
"audit_status"
]);
$where
[
"audit_status"
]
=
$status
;
}
if
(
!
empty
(
$params
[
"online_status"
])
||
(
isset
(
$params
[
"online_status"
])
&&
$params
[
"online_status"
]
===
'0'
))
{
if
(
!
empty
(
$params
[
"online_status"
])
||
(
isset
(
$params
[
"online_status"
])
&&
$params
[
"online_status"
]
===
'0'
))
{
$onlineStatus
=
explode
(
","
,
$params
[
"online_status"
]);
$where
[
"online_status"
]
=
$onlineStatus
;
}
...
...
@@ -1017,7 +1017,7 @@ class GoodsService
if
(
!
empty
(
$subShopList
))
{
foreach
(
$subShopList
as
$subShop
)
{
if
(
!
empty
(
$subShop
[
"latitude"
])
&&
!
empty
(
$subShop
[
"longitude"
]))
{
$esId
=
$goodsSkuInfo
[
"goods_sku_id"
]
.
"_"
.
$subShop
[
"sub_shop_id"
];
$esId
=
$goodsSkuInfo
[
"goods_sku_id"
]
.
"_"
.
$subShop
[
"sub_shop_id"
];
$data
=
[
"doc"
=>
[
"goods_sku_id"
=>
$goodsSkuInfo
[
"goods_sku_id"
],
...
...
@@ -1040,7 +1040,7 @@ class GoodsService
"life_account_icon"
=>
empty
(
$lifeAccountRes
[
"response"
][
"result"
][
"life_account_icon"
])
?
""
:
$lifeAccountRes
[
"response"
][
"result"
][
"life_account_icon"
],
"shop_name"
=>
$subShop
[
"shop_name"
],
"shop_address"
=>
$subShop
[
"address"
],
"shop_location"
=>
$subShop
[
"latitude"
]
.
","
.
$subShop
[
"longitude"
],
"shop_location"
=>
$subShop
[
"latitude"
]
.
","
.
$subShop
[
"longitude"
],
"update_time"
=>
strtotime
(
$goodsSkuInfo
[
"update_time"
]),
],
];
...
...
@@ -1225,8 +1225,8 @@ class GoodsService
}
$info
=
GoodsSku
::
getRecord
(
$where
);
$info
[
'original_price'
]
=
empty
(
$info
[
'original_price'
])
?
0
:
$info
[
'original_price'
]
/
100
;
$info
[
'price'
]
=
!
empty
(
$info
[
'price'
])
?
$info
[
'price'
]
/
100
:
0
;
$info
[
'original_price'
]
=
empty
(
$info
[
'original_price'
])
?
0
:
$info
[
'original_price'
]
/
100
;
$info
[
'price'
]
=
!
empty
(
$info
[
'price'
])
?
$info
[
'price'
]
/
100
:
0
;
$info
[
'desc_pic_url'
]
=
!
empty
(
$info
[
'desc_pic_url'
])
?
self
::
getUrlList
(
$info
[
'desc_pic_url'
])
:
''
;
$info
[
'introduce_pic_url'
]
=
!
empty
(
$info
[
'introduce_pic_url'
])
?
self
::
getUrlList
(
$info
[
'introduce_pic_url'
])
:
""
;
return
$info
;
...
...
@@ -1283,7 +1283,7 @@ class GoodsService
if
(
empty
(
$params
))
{
return
[];
}
if
(
!
empty
(
$params
[
'goods_spu_id'
]))
{
$where
[
'goods_spu_id'
]
=
$params
[
'goods_spu_id'
];
}
...
...
@@ -1353,46 +1353,52 @@ class GoodsService
*/
public
static
function
paySuccessGoodsCallback
(
$params
=
[])
{
$payOrderId
=
$params
[
"pay_order_id"
];
$goodsSkuId
=
$params
[
"goods_sku_id"
];
$num
=
$params
[
"num"
];
$record
=
PaySuccessGoodsCallbackRecord
::
getRecord
([
"pay_order_id"
=>
$payOrderId
,
"goods_sku_id"
=>
$goodsSkuId
,
"operator_result"
=>
PaySuccessGoodsCallbackRecord
::
OPERATOR_RESULT_SUCCESS
]
);
if
(
empty
(
$record
))
{
GoodsSku
::
beginTransaction
();
$goodsSku
=
GoodsSku
::
getRecord
([
"goods_sku_id"
=>
$goodsSkuId
]);
if
(
empty
(
$goodsSku
))
{
throw
new
GoodsException
([
"cus"
=>
15
]);
}
GoodsSku
::
save
([
"total_amount_sold"
=>
$goodsSku
[
"total_amount_sold"
]
+
$num
]
,
[
"goods_sku_id"
=>
$goodsSkuId
]);
$orderId
=
$params
[
"order_id"
];
$goodsPayInfos
=
json_decode
(
$params
[
"goods"
],
true
);
PaySuccessGoodsCallbackRecord
::
insertRecord
([
"pay_order_id"
=>
$payOrderId
,
"goods_sku_id"
=>
$goodsSkuId
,
"operator_result"
=>
PaySuccessGoodsCallbackRecord
::
OPERATOR_RESULT_SUCCESS
]
GoodsSku
::
beginTransaction
();
foreach
(
$goodsPayInfos
as
$goodsSkuId
=>
$num
)
{
$record
=
PaySuccessGoodsCallbackRecord
::
getRecord
([
"order_id"
=>
$orderId
,
"goods_sku_id"
=>
$goodsSkuId
,
"operator_result"
=>
PaySuccessGoodsCallbackRecord
::
OPERATOR_RESULT_SUCCESS
]
);
if
(
empty
(
$record
))
{
$goodsSku
=
GoodsSku
::
getRecord
([
"goods_sku_id"
=>
$goodsSkuId
]);
if
(
empty
(
$goodsSku
))
{
throw
new
GoodsException
([
"cus"
=>
15
]);
}
if
(
!
GoodsSku
::
commit
())
{
GoodsSku
::
rollback
(
);
GoodsSku
::
save
([
"total_amount_sold"
=>
$goodsSku
[
"total_amount_sold"
]
+
$num
]
,
[
"goods_sku_id"
=>
$goodsSkuId
]
);
PaySuccessGoodsCallbackRecord
::
insertRecord
([
"pay_order_id"
=>
$payOrderId
,
"order_id"
=>
$orderId
,
"goods_sku_id"
=>
$goodsSkuId
,
"num"
=>
$num
,
"operator_result"
=>
PaySuccessGoodsCallbackRecord
::
OPERATOR_RESULT_SUCCESS
]
);
}
}
if
(
!
GoodsSku
::
commit
())
{
GoodsSku
::
rollback
();
foreach
(
$goodsPayInfos
as
$goodsSkuId
=>
$num
)
{
PaySuccessGoodsCallbackRecord
::
insertRecord
([
"order_id"
=>
$orderId
,
"goods_sku_id"
=>
$goodsSkuId
,
"num"
=>
$num
,
"operator_result"
=>
PaySuccessGoodsCallbackRecord
::
OPERATOR_RESULT_FAIL
]
);
return
false
;
}
return
false
;
}
else
{
//同步到es
self
::
updateGoodsInfoToEs
(
$goodsSkuId
);
foreach
(
$goodsPayInfos
as
$goodsSkuId
=>
$num
)
{
self
::
updateGoodsInfoToEs
(
$goodsSkuId
);
}
}
return
true
;
}
...
...
@@ -1411,14 +1417,14 @@ class GoodsService
$introducePicUrl
=
explode
(
","
,
$skuData
[
"introduce_pic_url"
]);
}
$ids
=
GoodsSkuPicRecord
::
select
(
"id"
,
[
"goods_sku_id"
=>
$goodsSkuId
]);
GoodsSkuPicRecord
::
delete
([
"id"
=>
$ids
]);
$ids
=
GoodsSkuPicRecord
::
select
(
"id"
,
[
"goods_sku_id"
=>
$goodsSkuId
]);
GoodsSkuPicRecord
::
delete
([
"id"
=>
$ids
]);
$urlList
=
array_unique
(
array_merge
(
$descPicUrl
,
$introducePicUrl
));
$data
=
[];
if
(
!
empty
(
$urlList
))
{
foreach
(
$urlList
as
$url
)
{
$data
[]
=
[
"goods_sku_id"
=>
$goodsSkuId
,
"url"
=>
$url
];
$data
[]
=
[
"goods_sku_id"
=>
$goodsSkuId
,
"url"
=>
$url
];
}
GoodsSkuPicRecord
::
save
(
$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