You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

66 lines
1.6 KiB

<?php
namespace App\JsonRpc;
use App\Commons\Log;
use App\Constants\ErrorCode;
use App\Service\SeparateAccountsServiceInterface;
use Hyperf\DbConnection\Db;
use Hyperf\RpcServer\Annotation\RpcService;
use Hyperf\Di\Annotation\Inject;
use App\Constants\LogLabel;
/**
* @RpcService(name="OrderService", protocol="jsonrpc-http", server="jsonrpc-http", publishTo="")
*/
class OrderService implements OrderServiceInterface
{
/**
* @Inject
* @var Log
*/
protected $log;
/**
* @Inject
* @var \App\Service\OrderServiceInterface
*/
protected $orderService;
/**
* @Inject
* @var SeparateAccountsServiceInterface
*/
protected $separateAccountsService;
public function onlineComplete($global_order_id)
{
Db::beginTransaction();
try {
$this->orderService->onlineCompleted($global_order_id);
$this->separateAccountsService->orderOnlineCompleted($global_order_id);
Db::commit();
return [
"status" => 200,
"code" => 0,
"result" => [],
"message" => '调用成功'
];
} catch (\Exception $e) {
Db::rollBack();
$this->log->event(LogLabel::ONLINE_COMPLETE_LOG, ['exception' => $e->getMessage()]);
return [
"status" => 200,
"code" =>ErrorCode::SEPARATE_ACCOUNTS_ERROR,
"result" => [],
"message" => ErrorCode::getMessage(ErrorCode::SEPARATE_ACCOUNTS_ERROR)
];
}
}
}