liudan 8 months ago
commit 25f3aa6761
  1. 7
      app/common/repositories/store/order/StoreOrderBaseRepository.php
  2. 6
      app/common/repositories/system/merchant/MerchantIntentionRepository.php
  3. 22
      app/common/repositories/user/UserAssetsLogRepository.php
  4. 4
      app/controller/merchant/system/Merchant.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);
}

@ -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 {

@ -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);
}

@ -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;
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());

Loading…
Cancel
Save