|
|
|
@ -15,6 +15,7 @@ namespace app\common\repositories\user; |
|
|
|
|
|
|
|
|
|
use app\common\dao\user\UserAssetsLogDao; |
|
|
|
|
use app\common\repositories\BaseRepository; |
|
|
|
|
use app\common\repositories\store\order\StoreOrderBaseRepository; |
|
|
|
|
use app\common\repositories\store\product\ProductAssistRepository; |
|
|
|
|
use app\common\repositories\store\product\ProductRepository; |
|
|
|
|
use app\common\repositories\system\groupData\GroupDataRepository; |
|
|
|
@ -128,8 +129,9 @@ class UserAssetsLogRepository extends BaseRepository |
|
|
|
|
public function userPayEvent($groupOrder) |
|
|
|
|
{ |
|
|
|
|
// 配置信息 |
|
|
|
|
$config = $this->groupDataRepository->getGroupDataLst(0, 100, 1, 100); |
|
|
|
|
$config = array_column($config['list'], "value", 'key'); |
|
|
|
|
$config = $this->userAssetsRepository->getConfig(); |
|
|
|
|
|
|
|
|
|
$baseList = array(); |
|
|
|
|
|
|
|
|
|
foreach ($groupOrder['orderList'] as $orderItem) { |
|
|
|
|
$base = 0; |
|
|
|
@ -147,6 +149,7 @@ class UserAssetsLogRepository extends BaseRepository |
|
|
|
|
$this->userAssets($orderItem, $config, $base); |
|
|
|
|
|
|
|
|
|
if ($base) { |
|
|
|
|
$baseList[] = array('order_id' => $orderItem['order_id'], 'base' => $base); |
|
|
|
|
// 2. 项目经理资产 |
|
|
|
|
$startProjectUid = $this->projectAssets($orderItem, $config, $base); |
|
|
|
|
// 3. 培育经理资产 |
|
|
|
@ -163,6 +166,9 @@ class UserAssetsLogRepository extends BaseRepository |
|
|
|
|
// 6. 商户和平台资产 |
|
|
|
|
$this->merchantAndPlatformAssets($orderItem); |
|
|
|
|
} |
|
|
|
|
if ($baseList) { |
|
|
|
|
app(StoreOrderBaseRepository::class)->insertBase($baseList); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -201,7 +207,7 @@ class UserAssetsLogRepository extends BaseRepository |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
$this->addLog($logList); |
|
|
|
|
$this->userAssetsRepository->orderEvent($user['uid'], self::STATUS_FROZEN, compact('consume', 'welfare', 'huitong', 'contribution')); |
|
|
|
|
$this->userAssetsRepository->changeEvent($user['uid'], self::STATUS_FROZEN, compact('consume', 'welfare', 'huitong', 'contribution')); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -290,7 +296,7 @@ class UserAssetsLogRepository extends BaseRepository |
|
|
|
|
$log['ext'] = $ext; |
|
|
|
|
|
|
|
|
|
$this->addLog([$log]); |
|
|
|
|
$this->userAssetsRepository->orderEvent($user['uid'], self::STATUS_FROZEN, compact('consume', 'welfare', 'huitong', 'contribution')); |
|
|
|
|
$this->userAssetsRepository->changeEvent($user['uid'], self::STATUS_FROZEN, compact('consume', 'welfare', 'huitong', 'contribution')); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -333,7 +339,7 @@ class UserAssetsLogRepository extends BaseRepository |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$this->addLog($logList); |
|
|
|
|
$this->userAssetsRepository->orderEvent($user['uid'], self::STATUS_FROZEN, compact('consume', 'welfare', 'huitong', 'contribution')); |
|
|
|
|
$this->userAssetsRepository->changeEvent($user['uid'], self::STATUS_FROZEN, compact('consume', 'welfare', 'huitong', 'contribution')); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -401,7 +407,7 @@ class UserAssetsLogRepository extends BaseRepository |
|
|
|
|
'count' => $contribution, |
|
|
|
|
); |
|
|
|
|
$this->addLog($logList); |
|
|
|
|
$this->userAssetsRepository->orderEvent($userProject['uid'], self::STATUS_FROZEN, compact('consume', 'welfare', 'huitong', 'contribution')); |
|
|
|
|
$this->userAssetsRepository->changeEvent($userProject['uid'], self::STATUS_FROZEN, compact('consume', 'welfare', 'huitong', 'contribution')); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -481,7 +487,7 @@ class UserAssetsLogRepository extends BaseRepository |
|
|
|
|
'count' => $contribution, |
|
|
|
|
); |
|
|
|
|
$this->addLog($logList); |
|
|
|
|
$this->userAssetsRepository->orderEvent($userProject['uid'], self::STATUS_FROZEN, compact('consume', 'welfare', 'huitong', 'contribution')); |
|
|
|
|
$this->userAssetsRepository->changeEvent($userProject['uid'], self::STATUS_FROZEN, compact('consume', 'welfare', 'huitong', 'contribution')); |
|
|
|
|
return $userProject['spread_uid']; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -554,7 +560,7 @@ class UserAssetsLogRepository extends BaseRepository |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
$this->addLog($logList); |
|
|
|
|
$this->userAssetsRepository->orderEvent($orderItem['uid'], self::STATUS_FROZEN, compact('consume', 'welfare', 'huitong', 'contribution')); |
|
|
|
|
$this->userAssetsRepository->changeEvent($orderItem['uid'], self::STATUS_FROZEN, compact('consume', 'welfare', 'huitong', 'contribution')); |
|
|
|
|
|
|
|
|
|
// 5. 本人使用的福利积分 |
|
|
|
|
if ($orderItem['integral']) { |
|
|
|
@ -567,15 +573,35 @@ class UserAssetsLogRepository extends BaseRepository |
|
|
|
|
'count' => $orderItem['integral'], |
|
|
|
|
); |
|
|
|
|
$this->addLog([$log]); |
|
|
|
|
$this->userAssetsRepository->orderEvent($orderItem['uid'], self::STATUS_USED, compact('consume', 'welfare', 'huitong', 'contribution')); |
|
|
|
|
$this->userAssetsRepository->changeEvent($orderItem['uid'], self::STATUS_USED, compact('consume', 'welfare', 'huitong', 'contribution')); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function userTakeEvent() |
|
|
|
|
/** |
|
|
|
|
* notes 订单收货事件处理 |
|
|
|
|
* @param $orderItem |
|
|
|
|
* @throws DataNotFoundException |
|
|
|
|
* @throws DbException |
|
|
|
|
* @throws ModelNotFoundException |
|
|
|
|
* @create 2024/3/19 15:03 |
|
|
|
|
* @update 2024/3/19 15:03 |
|
|
|
|
* @author zhangkxiang |
|
|
|
|
* @editor |
|
|
|
|
*/ |
|
|
|
|
public function userTakeEvent($orderItem) |
|
|
|
|
{ |
|
|
|
|
// 订单发送冻结资产发放 |
|
|
|
|
$refundList = $this->_getOrderData($orderItem['order_id'], self::STATUS_FROZEN); |
|
|
|
|
if ($refundList) { |
|
|
|
|
foreach ($refundList as $refund) { |
|
|
|
|
$this->userAssetsRepository->changeEvent($refund['uid'], self::STATUS_SUCCESS, $refund); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 更新该订单的所有数据为退款状态 |
|
|
|
|
$this->dao->updateOrderStatus($orderItem['order_id'], self::STATUS_SUCCESS); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -595,7 +621,7 @@ class UserAssetsLogRepository extends BaseRepository |
|
|
|
|
$refundList = $this->_getOrderData($orderItem['order_id'], self::STATUS_FROZEN); |
|
|
|
|
if ($refundList) { |
|
|
|
|
foreach ($refundList as $refund) { |
|
|
|
|
$this->userAssetsRepository->orderEvent($refund['uid'], self::STATUS_REFUND, $refund); |
|
|
|
|
$this->userAssetsRepository->changeEvent($refund['uid'], self::STATUS_REFUND, $refund); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -603,7 +629,7 @@ 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'] > 0) { |
|
|
|
|
$info = $this->userAssetsRepository->get($used['uid']); |
|
|
|
|
$this->userAssetsRepository->update($used['uid'], array('welfare' => $info['welfare'] + $used['welfare'])); |
|
|
|
|
} |
|
|
|
|