Update OrderService.php

This commit is contained in:
邹景立 2021-03-25 14:57:19 +08:00
parent 04e87bdb79
commit 6b9a75f4e7

View File

@ -104,10 +104,8 @@ class OrderService extends Service
public function discount(int $disId, int $vipCode): array public function discount(int $disId, int $vipCode): array
{ {
[$map, $rate] = ['id' => $disId, ['status' => 1, 'deleted' => 0], 100.00]; [$map, $rate] = ['id' => $disId, ['status' => 1, 'deleted' => 0], 100.00];
if ($discount = $this->app->db->name('DataUserDiscount')->where($map)->value('items')) { if ($disId > 0 && ($discount = $this->app->db->name('DataUserDiscount')->where($map)->value('items'))) {
foreach (json_decode($discount, true) as $vo) if ($vo['level'] == $vipCode) { foreach (json_decode($discount, true) as $vo) if ($vo['level'] == $vipCode) $rate = round($vo['discount']);
$rate = round($vo['discount']);
}
} }
return [$disId, $rate]; return [$disId, $rate];
} }