扫码调试
This commit is contained in:
parent
a6775a5eb3
commit
0f877ff6b6
15
app/controller/api/Demo.php
Normal file
15
app/controller/api/Demo.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
namespace app\controller\api;
|
||||||
|
use crmeb\basic\BaseController;
|
||||||
|
use crmeb\services\WechatService;
|
||||||
|
|
||||||
|
class Demo extends BaseController
|
||||||
|
{
|
||||||
|
|
||||||
|
public function ceshi($name){
|
||||||
|
|
||||||
|
$order=['auth_code'=>$name];
|
||||||
|
$a=WechatService::create()->micropay()->scanCode($order);
|
||||||
|
halt($a);
|
||||||
|
}
|
||||||
|
}
|
@ -78,6 +78,7 @@ class WechatService
|
|||||||
$this->application->register(new \crmeb\services\easywechat\merchant\ServiceProvider);
|
$this->application->register(new \crmeb\services\easywechat\merchant\ServiceProvider);
|
||||||
$this->application->register(new \crmeb\services\easywechat\combinePay\ServiceProvider);
|
$this->application->register(new \crmeb\services\easywechat\combinePay\ServiceProvider);
|
||||||
$this->application->register(new \crmeb\services\easywechat\pay\ServiceProvider);
|
$this->application->register(new \crmeb\services\easywechat\pay\ServiceProvider);
|
||||||
|
$this->application->register(new \crmeb\services\easywechat\micropay\ServiceProvider);
|
||||||
$this->application->register(new \crmeb\services\easywechat\batches\ServiceProvider);
|
$this->application->register(new \crmeb\services\easywechat\batches\ServiceProvider);
|
||||||
$this->application->register(new \crmeb\services\easywechat\wechatTemplate\ServiceProvider);
|
$this->application->register(new \crmeb\services\easywechat\wechatTemplate\ServiceProvider);
|
||||||
}
|
}
|
||||||
@ -993,7 +994,13 @@ class WechatService
|
|||||||
return $this->application->combinePay;
|
return $this->application->combinePay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return easywechat\micropay\Client
|
||||||
|
*/
|
||||||
|
public function micropay()
|
||||||
|
{
|
||||||
|
return $this->application->micropay;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取模板列表
|
* 获取模板列表
|
||||||
|
41
crmeb/services/easywechat/micropay/Client.php
Normal file
41
crmeb/services/easywechat/micropay/Client.php
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: CRMEB Team <admin@crmeb.com>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
namespace crmeb\services\easywechat\micropay;
|
||||||
|
|
||||||
|
|
||||||
|
use crmeb\services\easywechat\BaseClient;
|
||||||
|
|
||||||
|
class Client extends BaseClient
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
public function scanCode($order)
|
||||||
|
{
|
||||||
|
$content=[
|
||||||
|
'appid'=>$this->app['config']['app_id'],
|
||||||
|
'mch_id'=>2,
|
||||||
|
'device_info'=>3,
|
||||||
|
'body'=>'线下支付',
|
||||||
|
'attach'=>'测试数据',
|
||||||
|
'out_trade_no'=>time(),
|
||||||
|
'total_fee'=>1,
|
||||||
|
'spbill_create_ip'=>request()->ip(),
|
||||||
|
'auth_code'=>$order['auth_code'],
|
||||||
|
];
|
||||||
|
$content = json_encode($content);
|
||||||
|
$res= $this->request('/pay/micropay', 'POST', ['sign_body' => $content]);
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
33
crmeb/services/easywechat/micropay/ServiceProvider.php
Normal file
33
crmeb/services/easywechat/micropay/ServiceProvider.php
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the overtrue/wechat.
|
||||||
|
*
|
||||||
|
* (c) overtrue <i@overtrue.me>
|
||||||
|
*
|
||||||
|
* This source file is subject to the MIT license that is bundled
|
||||||
|
* with this source code in the file LICENSE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace crmeb\services\easywechat\micropay;
|
||||||
|
|
||||||
|
use Pimple\Container;
|
||||||
|
use Pimple\ServiceProviderInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ServiceProvider.
|
||||||
|
*
|
||||||
|
* @author ClouderSky <clouder.flow@gmail.com>
|
||||||
|
*/
|
||||||
|
class ServiceProvider implements ServiceProviderInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}.
|
||||||
|
*/
|
||||||
|
public function register(Container $pimple)
|
||||||
|
{
|
||||||
|
$pimple['micropay'] = function ($pimple) {
|
||||||
|
return new Client($pimple['access_token'], $pimple);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -21,6 +21,7 @@ use think\facade\Route;
|
|||||||
|
|
||||||
Route::group('api/', function () {
|
Route::group('api/', function () {
|
||||||
Route::any('test', 'api.Auth/test');
|
Route::any('test', 'api.Auth/test');
|
||||||
|
Route::any('ceshi', 'api.Demo/ceshi');
|
||||||
Route::any('promote_writing', 'api.Common/promote_writing');
|
Route::any('promote_writing', 'api.Common/promote_writing');
|
||||||
Route::any('applet', 'api.Common/applet');
|
Route::any('applet', 'api.Common/applet');
|
||||||
Route::any('promote_writing', 'api.Common/promoteWriting');
|
Route::any('promote_writing', 'api.Common/promoteWriting');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user