|
|
@@ -352,16 +352,17 @@ class OrderService extends \app\BaseService
|
|
|
|
|
|
$change_zue_coin_record = null;
|
|
|
$zue_coin_model = $this->zueCoinModel->findByCustomerId($customer->id);
|
|
|
- if(!$zue_coin_model)
|
|
|
- return $this->fail("当前客户御龙币账户余额: 0");
|
|
|
- if ($zue_coin > $zue_coin_model->zue_coin)
|
|
|
- return $this->fail("当前客户御龙币账户余额:{$zue_coin_model->zue_coin}");
|
|
|
- $zue_coin_config = $fmt_pay_channels['11'];
|
|
|
- if(!$zue_coin_config)
|
|
|
- return $this->fail("御龙币设置不存在!");
|
|
|
- $zue_coin_exchange_rate = $zue_coin_config['zue_coin_exchange_rate'] ?? 0; // 兑换比例
|
|
|
- $zue_coin_consume_rate = $zue_coin_config['zue_coin_consume_rate'] ?? 0; // 报销比例
|
|
|
+ $zue_coin_exchange_rate = 0;
|
|
|
if($zue_coin > 0) {
|
|
|
+ if(!$zue_coin_model)
|
|
|
+ return $this->fail("当前客户御龙币账户余额: 0");
|
|
|
+ if ($zue_coin > $zue_coin_model->zue_coin)
|
|
|
+ return $this->fail("当前客户御龙币账户余额:{$zue_coin_model->zue_coin}");
|
|
|
+ $zue_coin_config = $fmt_pay_channels['11'];
|
|
|
+ if(!$zue_coin_config)
|
|
|
+ return $this->fail("御龙币设置不存在!");
|
|
|
+ $zue_coin_exchange_rate = $zue_coin_config['zue_coin_exchange_rate'] ?? 0; // 兑换比例
|
|
|
+ $zue_coin_consume_rate = $zue_coin_config['zue_coin_consume_rate'] ?? 0; // 报销比例
|
|
|
if($zue_coin_exchange_rate == 0 || $zue_coin_consume_rate == 0) {
|
|
|
return $this->fail("该笔订单不支持御龙币支付");
|
|
|
}
|
|
|
@@ -432,7 +433,14 @@ class OrderService extends \app\BaseService
|
|
|
} else {
|
|
|
$update_store_products[$order_product['store_product_id']] = ['id' => $order_product['store_product_id'], 'reduce_num' => 1];
|
|
|
}
|
|
|
- if ($order_product['is_gather_annuity']) {
|
|
|
+ if ($order_product['is_gather_annuity'] && $order_product['annuity'] > 0) {
|
|
|
+ $adviser_ids = [];
|
|
|
+ if($order_product['adviser_1_id']) {
|
|
|
+ array_push($adviser_ids, $order_product['adviser_1_id']);
|
|
|
+ }
|
|
|
+ if($order_product['adviser_2_id']) {
|
|
|
+ array_push($adviser_ids, $order_product['adviser_2_id']);
|
|
|
+ }
|
|
|
array_push($order_annual_fees, [
|
|
|
'order_id' => $order->id,
|
|
|
'customer_id' => $customer->id,
|
|
|
@@ -447,7 +455,7 @@ class OrderService extends \app\BaseService
|
|
|
'start_time' => time(),
|
|
|
'end_time' => time() + (365 * 24 * 60 * 60),
|
|
|
'order_create_time' => strtotime($order->create_time),
|
|
|
- 'adviser_1_id' => $order_product['adviser_1_id'],
|
|
|
+ 'adviser_ids' => join(',', $adviser_ids),
|
|
|
'store_id' => $order->store_id,
|
|
|
'create_time' => time(),
|
|
|
'update_time' => time()
|
|
|
@@ -478,7 +486,7 @@ class OrderService extends \app\BaseService
|
|
|
'service_charge_amount' => $order->service_charge_amount + $service_charge,
|
|
|
'zue_coin' => $order_use_zue_coin,
|
|
|
'zue_coin_amount' => $order_use_zue_coin_amount,
|
|
|
- 'remarks' => $params['remarks']
|
|
|
+ 'remarks' => $params['remarks'] ?? null
|
|
|
];
|
|
|
|
|
|
if (round($receive_amount) == round($imposed_amount)) { // 支付满了
|
|
|
@@ -674,7 +682,7 @@ class OrderService extends \app\BaseService
|
|
|
|
|
|
public function fetchWaitGatherAnnualFee($admin_id, $text = null, $start_time = null, $end_time = null, $page = 1, $size = 10) {
|
|
|
$res = $this->orderAnnualFeeModel->fetchByAdviser($admin_id, $text, $start_time, $end_time, $page, $size);
|
|
|
- return [$res->items(),$res->total()];
|
|
|
+ return [$res[0]->items(),$res[0]->total(), $res[1]];
|
|
|
}
|
|
|
|
|
|
public function paymentAnnualFee($annual_fee_id) {
|
|
|
@@ -1004,8 +1012,7 @@ class OrderService extends \app\BaseService
|
|
|
'create_time' => time(),
|
|
|
'update_time' => time(),
|
|
|
]);
|
|
|
-
|
|
|
- array_push($order_annual_fees, $store_product['product']['is_gather_annuity'] ? [
|
|
|
+ array_push($order_annual_fees, $store_product['product']['is_gather_annuity'] && $store_product['product']['annuity'] > 0 ? [
|
|
|
'order_id' => $order->id,
|
|
|
'customer_id' => $order->customer_id,
|
|
|
'customer_name' => $order->customer_name,
|
|
|
@@ -1014,12 +1021,12 @@ class OrderService extends \app\BaseService
|
|
|
'index' => 1,
|
|
|
'order_product_id' => -1,
|
|
|
'order_product_name' => $store_product['product']['name'],
|
|
|
- 'fee' => $store_product['product']['name'],
|
|
|
+ 'fee' => $store_product['product']['annuity'],
|
|
|
'is_pay' => 1,
|
|
|
'start_time' => time(),
|
|
|
'end_time' => time() + (365 * 24 * 60 * 60),
|
|
|
'order_create_time' => strtotime($order->create_time),
|
|
|
- 'adviser_1_id' => $store_product['product']['annuity'],
|
|
|
+ 'adviser_ids' => $admin_id,
|
|
|
'store_id' => $order->store_id,
|
|
|
'create_time' => time(),
|
|
|
'update_time' => time()
|
|
|
@@ -1118,7 +1125,13 @@ class OrderService extends \app\BaseService
|
|
|
}
|
|
|
|
|
|
|
|
|
+ public function findOrderByOrderId($order_id) {
|
|
|
+ return $this->orderModel->findById($order_id);
|
|
|
+ }
|
|
|
|
|
|
+ public function fetchOrderPayments($order_id) {
|
|
|
+ return $this->orderPaymentModel->findByOrderId($order_id);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|