1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?php
- // +----------------------------------------------------------------------
- // | Niucloud-admin 企业快速开发的saas管理平台
- // +----------------------------------------------------------------------
- // | 官方网址:https://www.niucloud.com
- // +----------------------------------------------------------------------
- // | niucloud团队 版权所有 开源版本可自由商用
- // +----------------------------------------------------------------------
- // | Author: Niucloud Team
- // +----------------------------------------------------------------------
- namespace app\service\api\weapp;
- use app\model\pay\Pay;
- use app\service\core\weapp\CoreWeappDeliveryService;
- use core\base\BaseApiService;
- /**
- * 小程序发货信息管理服务
- * Class WeappDeliveryService
- * @package app\service\api\weapp
- */
- class WeappDeliveryService extends BaseApiService
- {
- public $core_weapp_deliver_service;
- public function __construct()
- {
- parent::__construct();
- $this->core_weapp_deliver_service = new CoreWeappDeliveryService();
- }
- /**
- * 查询小程序是否已开通发货信息管理服务
- * @return mixed
- * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
- */
- public function getIsTradeManaged()
- {
- $is_trade_managed = $this->core_weapp_deliver_service->getIsTradeManaged()['is_trade_managed'];
- return ['is_trade_managed' => $is_trade_managed];
- }
- /**
- * 通过外部交易号获取消息跳转路径
- * @param $out_trade_no
- * @return string
- */
- public function getMsgJumpPath($out_trade_no)
- {
- $pay_model = new Pay();
- $where = array (
- [ 'out_trade_no', '=', $out_trade_no ]
- );
- $pay_info = $pay_model->where($where)->field('out_trade_no,trade_type,trade_id')->findOrEmpty()->toArray();
- // 未获取到交易信息
- if (empty($pay_info)) {
- return '';
- }
- $order_detail_path = event('WapOrderDetailPath', $pay_info)[ 0 ] ?? '';
- // 未获取到订单详情路径
- if (empty($order_detail_path)) {
- return '';
- }
- return $order_detail_path;
- }
- }
|