|
|
|
@ -140,9 +140,11 @@ class UserAssetsLogRepository extends BaseRepository |
|
|
|
|
// 获取商品详情(奖励积分 |
|
|
|
|
$product = $this->productRepository->detail($orderProduct['product_id'], null); |
|
|
|
|
Log::info("product" . json_encode($product)); |
|
|
|
|
$rate = floatval($orderProduct['total_price']) / floatval($orderProduct['product_price']) * 100; |
|
|
|
|
if ($rate >= $product['cash_rate']) { |
|
|
|
|
$base += $product['base']; |
|
|
|
|
if($orderProduct['total_price']){ |
|
|
|
|
$rate = floatval($orderProduct['product_price']) / floatval($orderProduct['total_price']) * 100; |
|
|
|
|
if ($rate >= $product['cash_rate']) { |
|
|
|
|
$base += $product['base'] * $orderProduct['product_num']; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -566,12 +568,13 @@ class UserAssetsLogRepository extends BaseRepository |
|
|
|
|
// 5. 本人使用的福利积分 |
|
|
|
|
if ($orderItem['integral']) { |
|
|
|
|
$consume = $welfare = $huitong = $contribution = 0; |
|
|
|
|
$welfare = $orderItem['integral']; |
|
|
|
|
$log = array('uid' => $orderItem['uid'], |
|
|
|
|
'asset_type' => self::ASSET_TYPE_WELFARE, |
|
|
|
|
'type' => self::CHANGE_TYPE_ORDER, |
|
|
|
|
'status' => self::STATUS_USED, |
|
|
|
|
'order_id' => $orderItem['order_id'], |
|
|
|
|
'count' => $orderItem['integral'], |
|
|
|
|
'count' => -$orderItem['integral'], |
|
|
|
|
); |
|
|
|
|
$this->addLog([$log]); |
|
|
|
|
$this->userAssetsRepository->orderEvent($orderItem['uid'], self::STATUS_USED, compact('consume', 'welfare', 'huitong', 'contribution')); |
|
|
|
@ -630,9 +633,9 @@ class UserAssetsLogRepository extends BaseRepository |
|
|
|
|
$usedList = $this->_getOrderData($orderItem['order_id'], self::STATUS_USED); |
|
|
|
|
if ($usedList) { |
|
|
|
|
foreach ($usedList as $used) { |
|
|
|
|
if ($used['welfare'] > 0) { |
|
|
|
|
if ($used['welfare']) { |
|
|
|
|
$info = $this->userAssetsRepository->get($used['uid']); |
|
|
|
|
$this->userAssetsRepository->update($used['uid'], array('welfare' => $info['welfare'] + $used['welfare'])); |
|
|
|
|
$this->userAssetsRepository->update($used['uid'], array('welfare' => $info['welfare'] - $used['welfare'])); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|