Browse Source

Merge branch 'phoenix' of http://120.24.33.109:11081/hyzjshwo/lanzu_api_hyperf into phoenix

master
Lemon 5 years ago
parent
commit
94502367b1
  1. 7
      app/JsonRpc/OrdersService.php
  2. 16
      app/Middleware/Auth/ApiMiddleware.php
  3. 1
      app/Service/v3/Implementations/DistributionPriceService.php
  4. 2
      app/Service/v3/Implementations/PaymentService.php

7
app/JsonRpc/OrdersService.php

@ -129,7 +129,7 @@ class OrdersService implements OrdersServiceInterface
* @param $note
* @return array
*/
public function onlineSingleRefund($user_id, $note, $global_order_id, $order_child_id=null, $order_goods_id=null)
public function onlineSingleRefund($user_id, $note, $global_order_id, $order_child_id='', $order_goods_id='')
{
Db::beginTransaction();
@ -168,7 +168,7 @@ class OrdersService implements OrdersServiceInterface
// 子订单
$orderChild = null;
if ($order_child_id) {
$orderChild = Order::query()->with('store:user_id')->where(['order_main_id' => $orderMain->global_order_id, 'id' => $order_child_id])->first();
$orderChild = Order::query()->with('store')->where(['order_main_id' => $orderMain->global_order_id, 'id' => $order_child_id])->first();
}
// 订单商品
@ -222,13 +222,14 @@ class OrdersService implements OrdersServiceInterface
]);
throw new ErrorCodeException(ErrorCode::ORDER_REFUND_FAIL);
}
// 开始退款
$config = config('wxpay');
$app = Factory::payment($config);
$app['guzzle_handler'] = CoroutineHandler::class;
$result = $app->refund->byOutTradeNumber(
$orderMain->global_order_id,
$orderMain->global_order_id,
$orderMain->global_order_id.$order_child_id.$order_goods_id,
bcmul($orderMain->money, 100, 0),
bcmul($refundAmount, 100, 0),
[

16
app/Middleware/Auth/ApiMiddleware.php

@ -9,6 +9,7 @@ use App\TaskWorker\SSDBTask;
use Hashids\Hashids;
use Hyperf\HttpServer\Contract\RequestInterface as HttpRequest;
use Hyperf\HttpServer\Contract\ResponseInterface as HttpResponse;
use Hyperf\HttpServer\Router\Router;
use Hyperf\Utils\ApplicationContext;
use Psr\Container\ContainerInterface;
use Psr\Http\Message\ResponseInterface;
@ -42,6 +43,21 @@ class ApiMiddleware implements MiddlewareInterface
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
// 拦截v1路由
// $routePath = $this->request->getPathInfo();
// $routePath = explode('/', $routePath);
// if ($routePath[1] == 'v1') {
// $content = [
// "status" => 'ok',
// "code" => 99999,
// "result" => [],
// "message" => '服务已停止升级,稍后请升级更新小程序(如不能自动更新,请删除小程序后重新进入小程序)'
// ];
//
// return $this->response->json($content);
// }
// 签名校验
# 获取参数

1
app/Service/v3/Implementations/DistributionPriceService.php

@ -11,6 +11,7 @@ class DistributionPriceService implements DistributionPriceServiceInterface
{
public function do($distance)
{
return 0;
$deliveryDistance = config('distance.delivery_distance');
$deliveryDistance = ceil($deliveryDistance/1000);
$km = ceil($distance/1000);

2
app/Service/v3/Implementations/PaymentService.php

@ -60,7 +60,7 @@ class PaymentService implements PaymentServiceInterface
$payMoney = bcmul((string)$orderMain->money, 100, 0);
if (env('APP_ENV') != 'prod' && $orderMain->type == OrderType::ONLINE) {
$payMoney = 1;
// $payMoney = 1;
}
$user = User::select('openid')->find($userId);

Loading…
Cancel
Save