调试购物卡发货
This commit is contained in:
parent
0df0acc5d8
commit
2f34a03800
@ -49,6 +49,9 @@ class StoreConsumptionUserDao extends BaseDao
|
||||
/** @var float $profitRate 商品毛利率 */
|
||||
public $profitRate;
|
||||
|
||||
public $startTime;
|
||||
public $endTime;
|
||||
|
||||
protected function getModel(): string
|
||||
{
|
||||
return StoreConsumptionUser::class;
|
||||
@ -249,8 +252,8 @@ class StoreConsumptionUserDao extends BaseDao
|
||||
$model->balance = $model->coupon_price;
|
||||
$model->order_amount = $amount;
|
||||
$model->create_time = date('Y-m-d H:i:s');
|
||||
$model->start_time = date('Y-m-d H:i:s', time() + 7 * 86400);
|
||||
$model->end_time = '2026-01-15 23:59:59';
|
||||
$model->start_time = $this->startTime ?: date('Y-m-d H:i:s', time() + 7 * 86400);
|
||||
$model->end_time = $this->endTime ?: '2026-01-15 23:59:59';
|
||||
$model->type = $type;
|
||||
$model->status = $status;
|
||||
}
|
||||
|
@ -26,8 +26,31 @@ class OrderDeliveryListen implements ListenerInterface
|
||||
$consumption = StoreConsumption::where('type', StoreConsumption::TYPE_PULL_CONSUMPTION)->find();
|
||||
/** @var StoreConsumptionUserDao $repo */
|
||||
$repo = app()->make(StoreConsumptionUserDao::class);
|
||||
$repo->send($consumption, 100, $order['uid'], $order['group_order_id'], $order->total_price, StoreConsumptionUser::STATUS_UNUSED);
|
||||
$repo->startTime = date('Y-m-d H:i:s');
|
||||
$repo->endTime = '2025-07-01';
|
||||
$repo->send($consumption, 1, $order['uid'], $order['group_order_id'], $order->total_price, StoreConsumptionUser::STATUS_UNUSED);
|
||||
|
||||
//TODO 当商户销售和购买达到指定金额后,激活抵扣补贴
|
||||
$consumption = StoreConsumption::where('type', StoreConsumption::TYPE_OWNER_CONSUMPTION)->find();
|
||||
$repo->startTime = date('Y-m-d H:i:s');
|
||||
$repo->endTime = '2025-07-01';
|
||||
$rate = $this->getRate($order->total_price);
|
||||
$repo->send($consumption, $rate, $order['uid'], $order['group_order_id'], $order->total_price, StoreConsumptionUser::STATUS_REPEAL, StoreConsumptionUser::TYPE_TWO);
|
||||
}
|
||||
}
|
||||
|
||||
public function getRate($orderAmount)
|
||||
{
|
||||
if ($orderAmount >= 1000 && $orderAmount < 5000) {
|
||||
$rate = 0.05;
|
||||
} elseif ($orderAmount >= 5000 && $orderAmount < 10000) {
|
||||
$rate = 0.10;
|
||||
} elseif ($orderAmount >= 10000 && $orderAmount < 50000) {
|
||||
$rate = 0.15;
|
||||
} elseif ($orderAmount >= 50000 && $orderAmount <= 100000) {
|
||||
$rate = 0.20;
|
||||
}
|
||||
return $rate ?? 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user