调试信用购订单结算
This commit is contained in:
parent
9eafcde2c7
commit
a4a27a0705
@ -28,7 +28,7 @@ class StoreOrderInterest extends BaseModel
|
|||||||
{
|
{
|
||||||
$days = ceil((time() - strtotime($this->start_time)) / 86400);
|
$days = ceil((time() - strtotime($this->start_time)) / 86400);
|
||||||
$days = max($days ,0);
|
$days = max($days ,0);
|
||||||
$money = bcmul($this->total_price, $this->rate, 2);
|
$money = bcmul($this->total_price, ($this->rate / 100), 2);
|
||||||
return bcmul($days, $money, 2);
|
return bcmul($days, $money, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ class StoreGroupOrderRepository extends BaseRepository
|
|||||||
public function detail($uid, $id, $flag = true)
|
public function detail($uid, $id, $flag = true)
|
||||||
{
|
{
|
||||||
$where = $this->getAll ? ['uid' => $uid] : ['paid' => 0, 'uid' => $uid];
|
$where = $this->getAll ? ['uid' => $uid] : ['paid' => 0, 'uid' => $uid];
|
||||||
return StoreGroupOrder::where($where)
|
$order = StoreGroupOrder::where($where)
|
||||||
->where('group_order_id', $id)
|
->where('group_order_id', $id)
|
||||||
->where('is_del', 0)
|
->where('is_del', 0)
|
||||||
->with(['orderList' => function (Relation $query) use ($flag) {
|
->with(['orderList' => function (Relation $query) use ($flag) {
|
||||||
@ -93,8 +93,11 @@ class StoreGroupOrderRepository extends BaseRepository
|
|||||||
})->with(['merchant' => function ($query) use ($flag) {
|
})->with(['merchant' => function ($query) use ($flag) {
|
||||||
$flag && $query->field('mer_id,mer_name,settle_cycle,interest_rate');
|
$flag && $query->field('mer_id,mer_name,settle_cycle,interest_rate');
|
||||||
}, 'orderProduct', 'presellOrder']);
|
}, 'orderProduct', 'presellOrder']);
|
||||||
}])
|
}, 'interest'])
|
||||||
->order('create_time DESC')->find();
|
->order('create_time DESC')->find();
|
||||||
|
$interest = $order->interest->calculateInterest();
|
||||||
|
$order['interest']['total_amount'] = bcadd($order->interest->total_price, $interest, 2);
|
||||||
|
return $order;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function status($uid, $id)
|
public function status($uid, $id)
|
||||||
|
@ -1674,7 +1674,7 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
'orderProduct',
|
'orderProduct',
|
||||||
'presellOrder',
|
'presellOrder',
|
||||||
'merchant' => function ($query) {
|
'merchant' => function ($query) {
|
||||||
return $query->field('mer_id,mer_name');
|
return $query->field('mer_id,mer_name,settle_cycle,interest_rate');
|
||||||
},
|
},
|
||||||
'community',
|
'community',
|
||||||
'receipt' => function ($query) {
|
'receipt' => function ($query) {
|
||||||
@ -2497,6 +2497,9 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
$merchantRepo = app()->make(MerchantRepository::class);
|
$merchantRepo = app()->make(MerchantRepository::class);
|
||||||
$merchantRepo->unfreeze($groupOrder->interest->mer_id);
|
$merchantRepo->unfreeze($groupOrder->interest->mer_id);
|
||||||
}
|
}
|
||||||
|
//订单结算之后,修改订单支付方式为真实的支付方式
|
||||||
|
$groupOrder->pay_type = $type;
|
||||||
|
$groupOrder->save();
|
||||||
}
|
}
|
||||||
$groupOrder->interest->save();
|
$groupOrder->interest->save();
|
||||||
Db::commit();
|
Db::commit();
|
||||||
|
@ -46,6 +46,9 @@ class OrderSettlePaySuccessListen implements ListenerInterface
|
|||||||
$merchantRepo = app()->make(MerchantRepository::class);
|
$merchantRepo = app()->make(MerchantRepository::class);
|
||||||
$merchantRepo->unfreeze($groupOrder->interest->mer_id);
|
$merchantRepo->unfreeze($groupOrder->interest->mer_id);
|
||||||
}
|
}
|
||||||
|
//订单结算之后,修改订单支付方式为真实的支付方式
|
||||||
|
$groupOrder->pay_type = 1;
|
||||||
|
$groupOrder->save();
|
||||||
Db::commit();
|
Db::commit();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Db::rollback();
|
Db::rollback();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user