feat: place Order

This commit is contained in:
2025-02-05 17:56:32 +08:00
parent fd94db463e
commit fda042da54
14 changed files with 504 additions and 11 deletions

View File

@@ -14,6 +14,7 @@ use App\Cache\Redis\Api\ApiRedisKey;
use App\Cache\Redis\Api\SiteCache;
use App\Cache\Redis\RedisCache;
use App\Constants\ApiCode;
use App\Constants\Common\GoodCode;
use App\Exception\ErrException;
use Hyperf\Di\Annotation\Inject;
use Psr\Container\ContainerExceptionInterface;
@@ -165,19 +166,21 @@ trait OrderTrait
$oneCopiesGoodInfo = [];
foreach ($oneCopies as $oneGood) {
if (empty($oneCopiesGoodInfo[$oneGood]))
{
if (empty($oneCopiesGoodInfo[$oneGood])) {
$oneCopiesGoodInfo[$oneGood] = [
'num' => 1,
'good_name' => '1',
'good_url' => '1',
'unit_price' => $this->skuArr[$oneGood]['price']
'unit_price' => $this->skuArr[$oneGood]['price'],
'type' => $this->skuArr[$oneGood]['type'],
];
} else {
$oneCopiesGoodInfo[$oneGood]['num'] += 1;
}
$oneCopiesTotalPrice = bcadd($oneCopiesTotalPrice, $this->skuArr[$oneGood]['price'],2);
if ($copiesType == 1 && $this->skuArr[$oneGood]['type'] == 2) {
if ($copiesType == 1 && $this->skuArr[$oneGood]['type'] == GoodCode::SPU_TYPE_MEAL) {
$copiesType = 2;
}
}