定价问题

This commit is contained in:
邓皓元 2019-01-24 15:56:27 +08:00
parent 20db40c362
commit 510d23ceaf

View File

@ -96,7 +96,7 @@ class LogSyncJob implements ShouldQueue
$package = $this->getPackage($value['content']); $package = $this->getPackage($value['content']);
$company = $this->getCompany(CommonService::stringifyCompanyId($value['company'])); $company = $this->getCompany(CommonService::stringifyCompanyId($value['company']));
$unit_price = intval($value['order_account'] * 100); $unit_price = intval($value['order_account'] * 100);
$product = $this->getProduct($package, $value['company'], $unit_price); $product = $this->getProduct($package, $value['company'], $value['order_account']);
$type = self::$types[$value['type']]; $type = self::$types[$value['type']];
$pay_channel = self::$payChannels[$value['pay_type']]; $pay_channel = self::$payChannels[$value['pay_type']];
@ -228,17 +228,18 @@ class LogSyncJob implements ShouldQueue
*/ */
protected function getProduct($package, $companyId, $price) protected function getProduct($package, $companyId, $price)
{ {
$sn = strtoupper($package['sn'] . '_' . $companyId . '_' . $price); $sn = strtoupper($package['sn'] . '_' . $companyId . '_' . intval($price * 100));
if (!$product = $this->products[$sn]) { if (!$product = $this->products[$sn]) {
$product = app(ProductService::class)->store([ $product = app(ProductService::class)->store([
'name' => $package['name'] . '' . $price, 'name' => $package['name'] . ' ' . $price,
'company_id' => $companyId, 'company_id' => $companyId,
'package_id' => $package['id'], 'package_id' => $package['id'],
'base_price' => $price, 'base_price' => $price,
'renewal_price' => $price, 'renewal_price' => $price,
]); ]);
$this->products[$sn] = $product; $this->products[$sn] = $product;
app(ProductRepository::class)->forgetCached();
} }
return $product; return $product;