30 changed files with 393 additions and 315 deletions
-
6app/Constants/v3/ErrorCode.php
-
10app/Constants/v3/LogLabel.php
-
149app/Controller/v3/NotifyController.php
-
12app/Controller/v3/OrderOnlineController.php
-
87app/JsonRpc/OrderOnlineService.php
-
8app/JsonRpc/OrderOnlineServiceInterface.php
-
75app/JsonRpc/OrderService.php
-
10app/JsonRpc/SeparateAccountsServiceInterface.php
-
28app/JsonRpc/SeparateaccountsService.php
-
2app/Request/v3/OrderOnlineStateRequest.php
-
10app/Service/v3/Implementations/CouponRebateService.php
-
10app/Service/v3/Implementations/CouponService.php
-
6app/Service/v3/Implementations/DeviceService.php
-
4app/Service/v3/Implementations/FeiePrintService.php
-
10app/Service/v3/Implementations/MiniprogramService.php
-
6app/Service/v3/Implementations/MqttService.php
-
7app/Service/v3/Implementations/OrderOfflineService.php
-
66app/Service/v3/Implementations/OrderOnlineService.php
-
59app/Service/v3/Implementations/PaymentService.php
-
29app/Service/v3/Implementations/SeparateAccountsService.php
-
18app/Service/v3/Implementations/UserService.php
-
8app/Service/v3/Interfaces/CouponServiceInterface.php
-
8app/Service/v3/Interfaces/MiniprogramServiceInterface.php
-
2app/Service/v3/Interfaces/OrderOfflineServiceInterface.php
-
38app/Service/v3/Interfaces/OrderOnlineServiceInterface.php
-
2app/Service/v3/Interfaces/PaymentServiceInterface.php
-
12app/Service/v3/Interfaces/SeparateAccountsServiceInterface.php
-
16app/Service/v3/Interfaces/UserServiceInterface.php
-
1config/autoload/wechat.php
-
1config/routes.php
@ -1,87 +0,0 @@ |
|||||
<?php |
|
||||
|
|
||||
namespace App\JsonRpc; |
|
||||
|
|
||||
use App\Commons\Log; |
|
||||
use App\Constants\v3\ErrorCode; |
|
||||
use App\Exception\ErrorCodeException; |
|
||||
use App\Service\v3\Interfaces\SeparateAccountsServiceInterface; |
|
||||
use Hyperf\DbConnection\Db; |
|
||||
use Hyperf\RpcServer\Annotation\RpcService; |
|
||||
use Hyperf\Di\Annotation\Inject; |
|
||||
use App\Constants\v3\LogLabel; |
|
||||
|
|
||||
/** |
|
||||
* @RpcService(name="OrderOnlineService", protocol="jsonrpc-http", server="jsonrpc-http", publishTo="") |
|
||||
*/ |
|
||||
class OrderOnlineService implements OrderOnlineServiceInterface |
|
||||
{ |
|
||||
|
|
||||
/** |
|
||||
* @Inject |
|
||||
* @var Log |
|
||||
*/ |
|
||||
protected $log; |
|
||||
|
|
||||
/** |
|
||||
* @Inject |
|
||||
* @var \App\Service\v3\Interfaces\OrderOnlineServiceInterface |
|
||||
*/ |
|
||||
protected $orderOnlineService; |
|
||||
|
|
||||
/** |
|
||||
* @Inject |
|
||||
* @var SeparateAccountsServiceInterface |
|
||||
*/ |
|
||||
protected $separateAccountsService; |
|
||||
|
|
||||
public function onlineComplete($orderMainId, $userId) |
|
||||
{ |
|
||||
Db::beginTransaction(); |
|
||||
try { |
|
||||
|
|
||||
$this->orderOnlineService->doComplete($orderMainId, $userId); |
|
||||
$this->separateAccountsService->orderOnlineCompleted($orderMainId, $userId); |
|
||||
|
|
||||
Db::commit(); |
|
||||
return [ |
|
||||
"status" => 200, |
|
||||
"code" => 0, |
|
||||
"result" => [], |
|
||||
"message" => '调用成功' |
|
||||
]; |
|
||||
} catch (\Exception $e) { |
|
||||
|
|
||||
Db::rollBack(); |
|
||||
$this->log->event(LogLabel::ORDER_COMPLETE_LOG, ['exception' => $e->getMessage()]); |
|
||||
throw new ErrorCodeException(ErrorCode::ORDER_COMPLETE_FAIL, $e->getMessage()); |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 线上订单退款 |
|
||||
* 申请退款 state = 8 |
|
||||
* 退款成功 state = 9 |
|
||||
*/ |
|
||||
public function onlineRefund($global_order_id){ |
|
||||
$result = [ |
|
||||
"status" => 200, |
|
||||
"code" => ErrorCode::ORDER_FAILURE, |
|
||||
"result" => [], |
|
||||
"message" => '' |
|
||||
]; |
|
||||
|
|
||||
$res = $this->orderOnlineService->onlineRefund($global_order_id); |
|
||||
if($res['code'] > 0){ |
|
||||
$result['result'] = $res; |
|
||||
$result['message'] = '退款失败'; |
|
||||
}else{ |
|
||||
$result['code'] = 0; |
|
||||
$result['result'] = $res; |
|
||||
$result['message'] = '退款成功'; |
|
||||
}; |
|
||||
|
|
||||
return $result; |
|
||||
} |
|
||||
} |
|
||||
@ -1,8 +0,0 @@ |
|||||
<?php |
|
||||
|
|
||||
namespace App\JsonRpc; |
|
||||
|
|
||||
interface OrderOnlineServiceInterface |
|
||||
{ |
|
||||
public function onlineComplete($orderMainId, $userId); |
|
||||
} |
|
||||
@ -1,10 +0,0 @@ |
|||||
<?php |
|
||||
|
|
||||
|
|
||||
namespace App\JsonRpc; |
|
||||
|
|
||||
|
|
||||
interface SeparateAccountsServiceInterface |
|
||||
{ |
|
||||
public function orderOnlineCompleted($orderMainId, $userId); |
|
||||
} |
|
||||
@ -1,28 +0,0 @@ |
|||||
<?php |
|
||||
|
|
||||
|
|
||||
namespace App\JsonRpc; |
|
||||
|
|
||||
use Hyperf\RpcServer\Annotation\RpcService; |
|
||||
|
|
||||
use Hyperf\Di\Annotation\Inject; |
|
||||
/** |
|
||||
* @RpcService(name="SeparateaccountsService", protocol="jsonrpc-http", server="jsonrpc-http", publishTo="") |
|
||||
* Class SeparateAccountsService |
|
||||
* @package App\JsonRpc |
|
||||
*/ |
|
||||
class SeparateaccountsService implements SeparateAccountsServiceInterface |
|
||||
{ |
|
||||
/** |
|
||||
* @Inject |
|
||||
* @var \App\Service\v3\Interfaces\SeparateAccountsServiceInterface |
|
||||
*/ |
|
||||
private $separateaccountsService; |
|
||||
|
|
||||
public function orderOnlineCompleted($orderMainId, $userId) |
|
||||
{ |
|
||||
// TODO: Implement orderOnlineCompleted() method.
|
|
||||
return $this->separateaccountsService->orderOnlineCompleted($orderMainId, $userId); |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue