From dc214a7d8cd96888ace22999318bab02dfe1d60d Mon Sep 17 00:00:00 2001 From: weigang Date: Wed, 16 Sep 2020 15:34:34 +0800 Subject: [PATCH 1/2] =?UTF-8?q?v1=E5=8F=96=E6=B6=88=E5=B8=82=E5=9C=BA?= =?UTF-8?q?=E7=BB=8F=E7=90=86=E5=88=86=E8=B4=A6=E5=A5=96=E5=8A=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Service/SeparateAccountsService.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/app/Service/SeparateAccountsService.php b/app/Service/SeparateAccountsService.php index 214f7a6..32d2742 100644 --- a/app/Service/SeparateAccountsService.php +++ b/app/Service/SeparateAccountsService.php @@ -185,11 +185,15 @@ class SeparateAccountsService implements SeparateAccountsServiceInterface // 当前订单(子)对应商户是否有市场经理绑定关系 $store = Store::query()->find($order['store_id']); // 商户 - $mmInfo = MmInfo::query()->where(['user_id' => $store->mm_user_id])->first(); // 市场经理 - $market = Market::query()->find($mmInfo->market_id); // 市场 + // $mmInfo = MmInfo::query()->where(['user_id' => $store->mm_user_id])->first(); // 市场经理 + // if (empty($mmInfo)) continue; + // $market = Market::query()->find($mmInfo->market_id); // 市场 + $market = Market::query()->find($orderMain->market_id); // 市场 + if (empty($market)) continue; $mpInfo = MpInfo::query()->find($market->mp_id); // 服务商 + if (empty($mpInfo)) continue; - $ssdbName = 'mm_'.$mmInfo->id.'_award_'.$store->id; + $ssdbName = 'mm_'.$mpInfo->id.'_award_'.$store->id; // TODO 暂时在这里初始化 if (!$ssdb->exec('hexists', $ssdbName, 'is_awarded')) { @@ -203,8 +207,9 @@ class SeparateAccountsService implements SeparateAccountsServiceInterface // 平台新用户 if ($this->userService->isPlatformNewUser($orderMain->user_id, $orderMain->id)) { $ssdb->exec('hincr', $ssdbName, 'new_user_number', 1); - $this->financialRecordService->mmAwardByPlatNewUser($mmInfo->admin_user_id, $global_order_id, $MmMpAwardConfig['mm_new_user'], '发展新用户'); // 市场经理新用户奖励 - $this->financialRecordService->mpAwardByPlatNewUser($mpInfo->admin_user_id, $global_order_id, $MmMpAwardConfig['mp_new_user'], '市场经理「'.$mmInfo->name.'」发展新用户'); // 服务商新用户奖励 + // $this->financialRecordService->mmAwardByPlatNewUser($mmInfo->admin_user_id, $global_order_id, $MmMpAwardConfig['mm_new_user'], '发展新用户'); // 市场经理新用户奖励 + // $this->financialRecordService->mpAwardByPlatNewUser($mpInfo->admin_user_id, $global_order_id, $MmMpAwardConfig['mp_new_user'], '市场经理「'.$mmInfo->name.'」发展新用户'); // 服务商新用户奖励 + $this->financialRecordService->mpAwardByPlatNewUser($mpInfo->admin_user_id, $global_order_id, $MmMpAwardConfig['mp_new_user'], '发展新用户'); // 服务商新用户奖励 } $record = $ssdb->exec('hgetall', $ssdbName); @@ -216,8 +221,9 @@ class SeparateAccountsService implements SeparateAccountsServiceInterface &&$record['new_user_number']>=$MmMpAwardConfig['limit_new_user_number'] ) { // 存在记录且未发放奖励,同时新用户数已经超过10 $ssdb->exec('hset', $ssdbName, 'is_awarded', 1); - $this->financialRecordService->mmAwardByNewStore($mmInfo->admin_user_id, $global_order_id, $MmMpAwardConfig['mm_new_store'], '发展新商户【'.$store->name.'】'); // 市场经理新商户奖励 - $this->financialRecordService->mpAwardByNewStore($mpInfo->admin_user_id, $global_order_id, $MmMpAwardConfig['mp_new_store'], '市场经理「'.$mmInfo->name.'」发展新商户【'.$store->name.'】'); // 服务商新商户奖励 + // $this->financialRecordService->mmAwardByNewStore($mmInfo->admin_user_id, $global_order_id, $MmMpAwardConfig['mm_new_store'], '发展新商户【'.$store->name.'】'); // 市场经理新商户奖励 + // $this->financialRecordService->mpAwardByNewStore($mpInfo->admin_user_id, $global_order_id, $MmMpAwardConfig['mp_new_store'], '市场经理「'.$mmInfo->name.'」发展新商户【'.$store->name.'】'); // 服务商新商户奖励 + $this->financialRecordService->mpAwardByNewStore($mpInfo->admin_user_id, $global_order_id, $MmMpAwardConfig['mp_new_store'], '发展新商户【'.$store->name.'】'); // 服务商新商户奖励 } } From 161c16e562e55d58b455bb06f5fcc6b4fffc1411 Mon Sep 17 00:00:00 2001 From: weigang Date: Wed, 16 Sep 2020 15:56:19 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=BD=93=E9=9D=A2=E4=BB=98=E6=94=AF?= =?UTF-8?q?=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Constants/v3/ErrorCode.php | 18 +++++++++++++++++- app/Controller/v3/OrderOfflineController.php | 2 +- .../v3/Implementations/OrderOfflineService.php | 2 +- .../v3/Implementations/PaymentService.php | 8 ++++---- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/app/Constants/v3/ErrorCode.php b/app/Constants/v3/ErrorCode.php index 362d532..df607c8 100644 --- a/app/Constants/v3/ErrorCode.php +++ b/app/Constants/v3/ErrorCode.php @@ -89,12 +89,18 @@ class ErrorCode extends AbstractConstants */ const ORDER_NOT_ENOUGH_INITIAL_DELIVERY = 611; + /** + * 下单失败 + * @Message("付款失败") + */ + const ORDER_OFFLINE_FAIL = 612; + /************************************/ /* 支付相关 651-700 */ /************************************/ /** - * @Message("提现支付失败") + * @Message("支付失败") */ const PAYMENT_FAIL = 651; @@ -118,6 +124,16 @@ class ErrorCode extends AbstractConstants */ const PAYMENT_AMOUNT_LIMIT = 655; + /** + * @Message("提现失败") + */ + const WITHDRAW_PAYMENT_FAIL = 656; + + /** + * @Message("退款失败") + */ + const REFUND_PAYMENT_FAIL = 657; + /************************************/ /* 用户相关 701-750 */ /************************************/ diff --git a/app/Controller/v3/OrderOfflineController.php b/app/Controller/v3/OrderOfflineController.php index c53fb05..e929c3b 100644 --- a/app/Controller/v3/OrderOfflineController.php +++ b/app/Controller/v3/OrderOfflineController.php @@ -47,7 +47,7 @@ class OrderOfflineController extends BaseController $params = $validator->validated(); $store = $this->storeService->detail($params['store_id']); - return $this->success(['store' => $store]); + return $this->success(['store' => $store, 'digit_length' => 8]); } /** diff --git a/app/Service/v3/Implementations/OrderOfflineService.php b/app/Service/v3/Implementations/OrderOfflineService.php index 9e41a25..33883b8 100644 --- a/app/Service/v3/Implementations/OrderOfflineService.php +++ b/app/Service/v3/Implementations/OrderOfflineService.php @@ -99,7 +99,7 @@ class OrderOfflineService implements OrderOfflineServiceInterface } catch (\Exception $e) { Db::rollBack(); $this->log->event(LogLabel::ORDER_OFFLINE_LOG, ['exception_msg' => $e->getMessage()]); - throw new ErrorCodeException(ErrorCode::ORDER_ONLINE_FAIL); + throw new ErrorCodeException(ErrorCode::ORDER_OFFLINE_FAIL); } } diff --git a/app/Service/v3/Implementations/PaymentService.php b/app/Service/v3/Implementations/PaymentService.php index acae5bb..65e6235 100644 --- a/app/Service/v3/Implementations/PaymentService.php +++ b/app/Service/v3/Implementations/PaymentService.php @@ -139,11 +139,11 @@ class PaymentService implements PaymentServiceInterface if ($result['return_code'] == 'SUCCESS' && isset($result['result_code']) && $result['result_code'] == "SUCCESS") { return true; } else { - throw new ErrorCodeException(ErrorCode::PAYMENT_FAIL,$result['err_code_des']); + throw new ErrorCodeException(ErrorCode::REFUND_PAYMENT_FAIL,$result['err_code_des']); } } catch (\Exception $e) { $this->log->event(LogLabel::ORDER_PAYMENT_LOG, ['payment_do_exception_msg' => $e->getMessage()]); - throw new ErrorCodeException(ErrorCode::PAYMENT_FAIL, '[退款失败]'.$e->getMessage()); + throw new ErrorCodeException(ErrorCode::REFUND_PAYMENT_FAIL, '[退款失败]'.$e->getMessage()); } } @@ -182,7 +182,7 @@ class PaymentService implements PaymentServiceInterface 'result' => json_encode($result), 'desc' => $desc ]); - throw new ErrorCodeException(ErrorCode::PAYMENT_FAIL); + throw new ErrorCodeException(ErrorCode::WITHDRAW_PAYMENT_FAIL); } if ($result['result_code'] != 'SUCCESS') { @@ -218,7 +218,7 @@ class PaymentService implements PaymentServiceInterface throw new ErrorCodeException(ErrorCode::PAYMENT_AMOUNT_LIMIT); } - throw new ErrorCodeException(ErrorCode::PAYMENT_FAIL); + throw new ErrorCodeException(ErrorCode::WITHDRAW_PAYMENT_FAIL); } return true;