From 0265197fff9e5b6056727727e52f4aae058569f8 Mon Sep 17 00:00:00 2001 From: "home.fengxinyhyl" Date: Sun, 31 Mar 2024 12:01:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=BA=E5=9F=9F=E4=BB=A3=E7=90=86=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store/order/StoreOrderBaseRepository.php | 7 ++++++ .../merchant/MerchantIntentionRepository.php | 6 ++++- .../user/UserAssetsLogRepository.php | 22 +++++++++++++++---- app/controller/merchant/system/Merchant.php | 6 ++++- 4 files changed, 35 insertions(+), 6 deletions(-) diff --git a/app/common/repositories/store/order/StoreOrderBaseRepository.php b/app/common/repositories/store/order/StoreOrderBaseRepository.php index 270b6f6..7b3e3c0 100644 --- a/app/common/repositories/store/order/StoreOrderBaseRepository.php +++ b/app/common/repositories/store/order/StoreOrderBaseRepository.php @@ -48,6 +48,13 @@ class StoreOrderBaseRepository extends BaseRepository } + public function deleteByOrderId($orderId){ + $item = $this->dao->getWhere(['order_id' => $orderId]); + if($item){ + $this->dao->delete($item['id']); + } + } + public function getTotalBase($day = ''){ return $this->dao->getTotalBase($day); } diff --git a/app/common/repositories/system/merchant/MerchantIntentionRepository.php b/app/common/repositories/system/merchant/MerchantIntentionRepository.php index b542876..23f9bd3 100644 --- a/app/common/repositories/system/merchant/MerchantIntentionRepository.php +++ b/app/common/repositories/system/merchant/MerchantIntentionRepository.php @@ -13,6 +13,7 @@ namespace app\common\repositories\system\merchant; use app\common\repositories\BaseRepository; +use app\common\repositories\system\config\ConfigValueRepository; use crmeb\jobs\SendSmsJob; use crmeb\services\SmsService; use FormBuilder\Factory\Elm; @@ -129,7 +130,7 @@ class MerchantIntentionRepository extends BaseRepository 'is_bro_goods' => $config['broadcast_goods_type'] == 1 ? 0 : 1, 'mer_password' => $password, 'is_margin' => $margin['is_margin'] ?? -1, - 'margin' => $margin['margin'] ?? 0 + 'margin' => $margin['margin'] ?? 0, ]; $data['fail_msg'] = ''; $smsData = [ @@ -154,6 +155,9 @@ class MerchantIntentionRepository extends BaseRepository if ($create) { $merchant = app()->make(MerchantRepository::class)->createMerchant($merData); $data['mer_id'] = $merchant->mer_id; + app()->make(ConfigValueRepository::class)->setFormData([ + 'mer_certificate' => $intention['images'] + ], $merchant->mer_id); Queue::push(SendSmsJob::class, ['tempId' => 'APPLY_MER_SUCCESS', 'id' => $smsData]); } } else { diff --git a/app/common/repositories/user/UserAssetsLogRepository.php b/app/common/repositories/user/UserAssetsLogRepository.php index 0ba7674..20aead5 100644 --- a/app/common/repositories/user/UserAssetsLogRepository.php +++ b/app/common/repositories/user/UserAssetsLogRepository.php @@ -169,7 +169,7 @@ class UserAssetsLogRepository extends BaseRepository $this->breedAssets($startProjectUid, $orderItem['order_id'], $config, $base); // 4.区域代理资产 - $this->agentAssets($orderItem['district_id'], $orderItem['order_id'], $config, $base); + $this->agentAssets($orderItem['mer_id'], $orderItem['order_id'], $config, $base); // 5. 推荐资产 $this->recommendAssets($orderItem['mer_id'], $orderItem['order_id'], $config, $base); @@ -327,9 +327,20 @@ class UserAssetsLogRepository extends BaseRepository * @author zhangkxiang * @editor */ - public function agentAssets($districtId, $orderId, $config, $base) + public function agentAssets($merId, $orderId, $config, $base) { $consume = $welfare = $huitong = $contribution = 0; + $merRepository = app(MerchantRepository::class); + $merchant = $merRepository->get($merId); + if(empty($merchant)){ + return ; + } + $districtArr = explode(',', $merchant['district_id']); + if(count($districtArr) != 3){ + return ; + } + $districtId = $districtArr[2]; + Log::info("agentAssets districtId is {$districtId}"); /** * @var UserRepository $userRepository */ @@ -339,7 +350,7 @@ class UserAssetsLogRepository extends BaseRepository return; } - // 1. 项目经理的福利积分 + // 1. 区域代理的福利积分 $orderWelfare = round($base * $config['welfare_agent'] / 100, 2); $welfare = $this->_getValue($orderWelfare); $logList[] = array( @@ -541,7 +552,7 @@ class UserAssetsLogRepository extends BaseRepository // 如果该订单奖励基数大于0 if ($base) { // 2. 本人的福利积分 - $orderWelfare = round($base * 0.1, 2); + $orderWelfare = round($base * $config['welfare_user'] / 100, 2); $welfare = $this->_getValue($orderWelfare); $logList[] = array( 'uid' => $orderItem['uid'], @@ -654,6 +665,9 @@ class UserAssetsLogRepository extends BaseRepository } } + // 退款删除订单 + app(StoreOrderBaseRepository::class)->deleteByOrderId($orderItem['order_id']); + // 更新该订单的所有数据为退款状态 $this->dao->updateOrderStatus($orderItem['order_id'], self::STATUS_REFUND); } diff --git a/app/controller/merchant/system/Merchant.php b/app/controller/merchant/system/Merchant.php index 620ebce..008451c 100644 --- a/app/controller/merchant/system/Merchant.php +++ b/app/controller/merchant/system/Merchant.php @@ -153,7 +153,11 @@ class Merchant extends BaseController $delivery = $repository->get($this->request->merId()) + systemConfig(['tx_map_key']); $data = array_merge($data,$delivery); $data['sys_bases_status'] = systemConfig('sys_bases_status') === '0' ? 0 : 1; - $data['mer_pics'] = explode(',', $data['mer_pics']); + if($data['mer_pics']){ + $data['mer_pics'] = explode(',', $data['mer_pics']); + }else{ + $data['mer_pics'] = []; + } $data['assets'] = \app(FinancialRecordRepository::class)->getMerchantStatistics(array('is_mer' => $this->request->merId())); // $user = \app(UserRepository::class)->getUserByMerId($this->request->merId());