定价问题

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']);
$company = $this->getCompany(CommonService::stringifyCompanyId($value['company']));
$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']];
$pay_channel = self::$payChannels[$value['pay_type']];
@ -228,17 +228,18 @@ class LogSyncJob implements ShouldQueue
*/
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]) {
$product = app(ProductService::class)->store([
'name' => $package['name'] . '' . $price,
'name' => $package['name'] . ' ' . $price,
'company_id' => $companyId,
'package_id' => $package['id'],
'base_price' => $price,
'renewal_price' => $price,
]);
$this->products[$sn] = $product;
app(ProductRepository::class)->forgetCached();
}
return $product;