优化同步

This commit is contained in:
邓皓元 2019-01-23 10:43:49 +08:00
parent 85dfd3352e
commit ebf28927a4

View File

@ -88,15 +88,15 @@ 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);
$custom_price = intval($value['order_account'] * 100);
$product = $this->getProduct($package, $value['company'], $unit_price); $product = $this->getProduct($package, $value['company'], $unit_price);
$type = self::$types[$value['type']]; $type = self::$types[$value['type']];
$pay_channel = self::$payChannels[$value['pay_type']]; $pay_channel = self::$payChannels[$value['pay_type']];
// 按规则生成订单编号 (月6+类型1+公司3+套餐4+价格6) // 按规则生成订单编号 (月6+类型1+公司3+套餐4+价格6)
$sn = date('Ym', $value['create_time']) . $type . sprintf('%03d', $company['id']) . sprintf('%04d', $package['id']) . sprintf('%06d', $custom_price); $sn = date('Ym', $value['create_time']) . $type . sprintf('%03d', $company['id']) . sprintf('%04d', $package['id']) . sprintf('%06d', $unit_price);
$counts = isset($orderArray[$sn]) ? $orderArray[$sn]['counts'] + 1 : 1; $counts = isset($orderArray[$sn]) ? $orderArray[$sn]['counts'] + 1 : 1;
$total_price = isset($orderArray[$sn]) ? $orderArray[$sn]['total_price'] + $unit_price : $unit_price;
$orderArray[$sn] = [ $orderArray[$sn] = [
'sn' => $sn, 'sn' => $sn,
@ -108,8 +108,8 @@ class LogSyncJob implements ShouldQueue
'pay_channel' => $pay_channel, 'pay_channel' => $pay_channel,
'unit_price' => $unit_price, 'unit_price' => $unit_price,
'counts' => $counts, 'counts' => $counts,
'total_price' => $unit_price, 'total_price' => $total_price,
'custom_price' => $custom_price, 'custom_price' => $total_price,
'order_at' => date('Y-m-d H:i:s', $value['create_time']), 'order_at' => date('Y-m-d H:i:s', $value['create_time']),
'order_status' => 4, 'order_status' => 4,
'transaction_status' => 1, 'transaction_status' => 1,