Merge branch 'dev' of https://gitea.lihaink.cn/mkm/shop-new into dev
This commit is contained in:
commit
f0291f4f45
@ -2749,7 +2749,19 @@ class StoreOrderRepository extends BaseRepository
|
||||
|
||||
}
|
||||
|
||||
public function dealVerify(string $img, int $id)
|
||||
{
|
||||
$data = StoreOrder::getDB()->where('order_id',$id)->find();
|
||||
if(empty($data)) return app('json')->fail('没有该订单');
|
||||
if(empty($data['order_extend']) && $data['pay_type'] != Enum::public) return app('json')->fail('该订单不是对公转账订单!');
|
||||
$old = $data['order_extend'];
|
||||
$old['corporate_voucher'] = $img;
|
||||
$new = json_encode($old, JSON_UNESCAPED_UNICODE);
|
||||
$data->order_extend = $new;
|
||||
$data->save();
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
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);
|
||||
}
|
||||
}
|
@ -324,5 +324,13 @@ class StoreOrder extends BaseController
|
||||
|
||||
}
|
||||
|
||||
//更改数据-上传凭证
|
||||
public function upload_verify($id)
|
||||
{
|
||||
$img = $this->request->param('url');
|
||||
$this->repository->dealVerify($img,$id);
|
||||
return app('json')->success('上传凭证成功');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -78,6 +78,7 @@ class WechatService
|
||||
$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\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\wechatTemplate\ServiceProvider);
|
||||
}
|
||||
@ -993,7 +994,13 @@ class WechatService
|
||||
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::any('test', 'api.Auth/test');
|
||||
Route::any('ceshi', 'api.Demo/ceshi');
|
||||
Route::any('promote_writing', 'api.Common/promote_writing');
|
||||
Route::any('applet', 'api.Common/applet');
|
||||
Route::any('promote_writing', 'api.Common/promoteWriting');
|
||||
@ -74,6 +75,7 @@ Route::group('api/', function () {
|
||||
|
||||
//订单
|
||||
Route::any('order_mix', 'api.store.order.StoreOrder/getOrder');//商户获取商品
|
||||
|
||||
Route::group('order', function () {
|
||||
Route::post('check', '/checkOrder');
|
||||
Route::post('create', '/createOrder');
|
||||
@ -92,6 +94,7 @@ Route::group('api/', function () {
|
||||
Route::get('verify_code/:id', '/verifyCode');
|
||||
Route::post('receipt/:id', '/createReceipt');
|
||||
Route::get('delivery/:id', '/getOrderDelivery');
|
||||
Route::post('upload/:id', '/upload_verify');
|
||||
})->prefix('api.store.order.StoreOrder');
|
||||
|
||||
// 预售
|
||||
|
Loading…
x
Reference in New Issue
Block a user