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