Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
21ac9ac1
Commit
21ac9ac1
authored
Mar 30, 2022
by
linlinjava
Browse files
fix[litemall-wx, litemall-wx-api]: 修复订单商品评价
parent
31bf153c
Changes
5
Hide whitespace changes
Inline
Side-by-side
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallOrderGoodsService.java
View file @
21ac9ac1
...
...
@@ -26,12 +26,6 @@ public class LitemallOrderGoodsService {
return
orderGoodsMapper
.
selectByExample
(
example
);
}
public
List
<
LitemallOrderGoods
>
findByOidAndGid
(
Integer
orderId
,
Integer
goodsId
)
{
LitemallOrderGoodsExample
example
=
new
LitemallOrderGoodsExample
();
example
.
or
().
andOrderIdEqualTo
(
orderId
).
andGoodsIdEqualTo
(
goodsId
).
andDeletedEqualTo
(
false
);
return
orderGoodsMapper
.
selectByExample
(
example
);
}
public
LitemallOrderGoods
findById
(
Integer
id
)
{
return
orderGoodsMapper
.
selectByPrimaryKey
(
id
);
}
...
...
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/service/WxOrderService.java
View file @
21ac9ac1
...
...
@@ -955,29 +955,22 @@ public class WxOrderService {
* 待评价订单商品信息
*
* @param userId 用户ID
* @param orderId 订单ID
* @param goodsId 商品ID
* @param ogid 订单商品ID
* @return 待评价订单商品信息
*/
public
Object
goods
(
Integer
userId
,
Integer
o
rderId
,
Integer
goodsI
d
)
{
public
Object
goods
(
Integer
userId
,
Integer
o
gi
d
)
{
if
(
userId
==
null
)
{
return
ResponseUtil
.
unlogin
();
}
LitemallOrder
order
=
orderService
.
findById
(
userId
,
orderId
);
if
(
order
==
null
)
{
return
ResponseUtil
.
badArgument
();
}
List
<
LitemallOrderGoods
>
orderGoodsList
=
orderGoodsService
.
findByOidAndGid
(
orderId
,
goodsId
);
int
size
=
orderGoodsList
.
size
();
LitemallOrderGoods
orderGoods
=
orderGoodsService
.
findById
(
ogid
);
Assert
.
state
(
size
<
2
,
"存在多个符合条件的订单商品"
);
if
(
size
==
0
)
{
return
ResponseUtil
.
badArgumentValue
();
if
(
orderGoods
!=
null
)
{
Integer
orderId
=
orderGoods
.
getOrderId
();
LitemallOrder
order
=
orderService
.
findById
(
orderId
);
if
(!
order
.
getUserId
().
equals
(
userId
))
{
return
ResponseUtil
.
badArgument
();
}
}
LitemallOrderGoods
orderGoods
=
orderGoodsList
.
get
(
0
);
return
ResponseUtil
.
ok
(
orderGoods
);
}
...
...
@@ -1008,7 +1001,6 @@ public class WxOrderService {
if
(
order
==
null
)
{
return
ResponseUtil
.
badArgumentValue
();
}
Short
orderStatus
=
order
.
getOrderStatus
();
if
(!
OrderUtil
.
isConfirmStatus
(
order
)
&&
!
OrderUtil
.
isAutoConfirmStatus
(
order
))
{
return
ResponseUtil
.
fail
(
ORDER_INVALID_OPERATION
,
"当前商品不能评价"
);
}
...
...
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxOrderController.java
View file @
21ac9ac1
...
...
@@ -159,15 +159,13 @@ public class WxOrderController {
* 待评价订单商品信息
*
* @param userId 用户ID
* @param orderId 订单ID
* @param goodsId 商品ID
* @param ogid 订单商品ID
* @return 待评价订单商品信息
*/
@GetMapping
(
"goods"
)
public
Object
goods
(
@LoginUser
Integer
userId
,
@NotNull
Integer
orderId
,
@NotNull
Integer
goodsId
)
{
return
wxOrderService
.
goods
(
userId
,
orderId
,
goodsId
);
@NotNull
Integer
ogid
)
{
return
wxOrderService
.
goods
(
userId
,
ogid
);
}
/**
...
...
litemall-wx/pages/commentPost/commentPost.js
View file @
21ac9ac1
...
...
@@ -4,9 +4,7 @@ var util = require('../../utils/util.js');
var
api
=
require
(
'
../../config/api.js
'
);
Page
({
data
:
{
orderId
:
0
,
type
:
0
,
valueId
:
0
,
ogid
:
0
,
orderGoods
:
{},
content
:
''
,
stars
:
[
0
,
1
,
2
,
3
,
4
],
...
...
@@ -97,17 +95,14 @@ Page({
onLoad
:
function
(
options
)
{
var
that
=
this
;
that
.
setData
({
orderId
:
options
.
orderId
,
type
:
options
.
type
,
valueId
:
options
.
valueId
ogid
:
options
.
ogid
});
this
.
getOrderGoods
();
},
getOrderGoods
:
function
()
{
let
that
=
this
;
util
.
request
(
api
.
OrderGoods
,
{
orderId
:
that
.
data
.
orderId
,
goodsId
:
that
.
data
.
valueId
ogid
:
that
.
data
.
ogid
}).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
...
...
litemall-wx/pages/ucenter/orderDetail/orderDetail.wxml
View file @
21ac9ac1
...
...
@@ -42,7 +42,7 @@
<view class="attr">{{item.specifications}}</view>
<view class="price">¥{{item.price}}</view>
<view class="btn active" wx:if="{{handleOption.comment && (item.comment == 0)}}">
<navigator url="../../commentPost/commentPost?o
rderI
d={{item.
orderId}}&&valueId={{item.goodsId}}&type=0
">去评价</navigator>
<navigator url="../../commentPost/commentPost?o
gi
d={{item.
id}}
">去评价</navigator>
</view>
<view class="btn active" wx:if="{{handleOption.rebuy}}">
<navigator url="../../goods/goods?id={{item.goodsId}}">再次购买</navigator>
...
...
Write
Preview
Supports
Markdown
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