refactor(service): 优化多个服务中的订单处理逻辑

This commit is contained in:
mzeros 2024-12-07 14:18:39 +08:00
parent ab3e0f2416
commit bde35c7360
3 changed files with 10 additions and 2 deletions

View File

@ -290,6 +290,7 @@ class Core
$project_id = false; $project_id = false;
} }
$order = OrderService::instance()->up($this->data['merchant'], $channel['id'], $product['id'], $product['key'], $order_id, $channel_order_id, $merchant_order_id, $cash, $url, $request, $response_data, $status, $account, $parent_order_id, $project_id, $card_id, $this->data['param'], $kou); $order = OrderService::instance()->up($this->data['merchant'], $channel['id'], $product['id'], $product['key'], $order_id, $channel_order_id, $merchant_order_id, $cash, $url, $request, $response_data, $status, $account, $parent_order_id, $project_id, $card_id, $this->data['param'], $kou);
if (!$order) { if (!$order) {

View File

@ -95,7 +95,9 @@ class MerchantService extends Service
$new_cash = $percent*$cash; $new_cash = $percent*$cash;
} }
} }
Log::write('test', 'test', $new_cash);
// Log::write('test', 'test', $new_cash);
# 得到产品分成 # 得到产品分成
if ($pid) { if ($pid) {
$product = ProductService::instance()->get($mid, $pid); $product = ProductService::instance()->get($mid, $pid);
@ -128,6 +130,8 @@ class MerchantService extends Service
} }
} }
return array($cash, $new_cash, $product_cash, $profit); return array($cash, $new_cash, $product_cash, $profit);
} }
@ -135,6 +139,7 @@ class MerchantService extends Service
public function setFrozenAccount($oid, $order_id, $mid, $pid, $product_key, $cash, $project_id = false, $account = '', $isp = -1, $time = false, $fushu = false) public function setFrozenAccount($oid, $order_id, $mid, $pid, $product_key, $cash, $project_id = false, $account = '', $isp = -1, $time = false, $fushu = false)
{ {
$info = $this->getInfo($mid); $info = $this->getInfo($mid);
if ($info) { if ($info) {
list($cash, $new_cash, $product_cash, $profit) = $this->cash($info['percent'], $cash, $mid, $pid, $product_key, $project_id, $account, $isp); list($cash, $new_cash, $product_cash, $profit) = $this->cash($info['percent'], $cash, $mid, $pid, $product_key, $project_id, $account, $isp);
@ -163,6 +168,7 @@ class MerchantService extends Service
//$this->get($info['appid'], false); //$this->get($info['appid'], false);
//$this->get($info['id'], false); //$this->get($info['id'], false);
return array($new_cash, $product_cash, $account_type); return array($new_cash, $product_cash, $account_type);
} }
} }

View File

@ -106,7 +106,8 @@ class OrderService extends Service
} }
} }
} }
if (!$info) { if (!$info) {
$data['error_account_oper'] = 1; $data['error_account_oper'] = 1;
$data['id'] = $this->db()->insertGetId($data); $data['id'] = $this->db()->insertGetId($data);