@@ -209,6 +209,10 @@ def good_exchange(request): |
||
| 209 | 209 |
# 校验重复兑换 |
| 210 | 210 |
if good.only_once and GoodsOrderInfo.objects.filter(user_id=user_id, good_id=good_id, status=True).exists(): |
| 211 | 211 |
return response(MemberGoodStatusCode.GOOD_EXCHANGE_ONLY_ONCE) |
| 212 |
+ |
|
| 213 |
+ if good.good_type == GoodsInfo.PHYSICAL and address == '': |
|
| 214 |
+ return response(MemberGoodStatusCode.GOOD_NO_ADDRESS) |
|
| 215 |
+ |
|
| 212 | 216 |
|
| 213 | 217 |
user.integral -= good.integral |
| 214 | 218 |
user.save() |
@@ -82,6 +82,7 @@ class MemberGoodStatusCode(BaseStatusCode): |
||
| 82 | 82 |
GOOD_INTEGRAL_NOT_ENOUGH = StatusCodeField(503503, 'Good Integral Not Enough', description=u'商品兑换积分不足') |
| 83 | 83 |
GOOD_STOCK_NOT_ENOUGH = StatusCodeField(503504, 'Good Integral Not Enough', description=u'商品库存不足') |
| 84 | 84 |
GOOD_EXCHANGE_ONLY_ONCE = StatusCodeField(503505, 'Good Exchange Only Once', description=u'商品仅可兑换一次') |
| 85 |
+ GOOD_NO_ADDRESS = StatusCodeField(503506, 'Good Exchange No Address', description=u'实物商品需填写地址') |
|
| 85 | 86 |
|
| 86 | 87 |
|
| 87 | 88 |
class MemberRightStatusCode(BaseStatusCode): |