erp/app/api/controller/IndexController.php
2024-05-10 11:31:45 +08:00

52 lines
1.3 KiB
PHP

<?php
namespace app\api\controller;
use app\admin\validate\tools\GenerateTableValidate;
use app\admin\logic\tools\GeneratorLogic;
use app\common\service\pay\PayService;
use app\common\service\wechat\WeChatOaService;
use Webman\Config;
use Yansongda\Pay\Pay;
class IndexController extends BaseApiController
{
public $notNeedLogin = ['index'];
public function index()
{
Pay::config(Config::get('payment'));
$order = [
'description' => '测试 - yansongda - 1',
'out_trade_no' => time().'',
'payer' => [
'auth_code' => 'xxxxxxxxxxx'
],
'amount' => [
'total' => 1,
],
'scene_info' => [
'store_info'=>[
'id' => '5678'
]
],
];
$result = Pay::wechat()->pos($order);
return json(['msg' =>create_password(123456, '11d3')]);
}
/**
* @notes 下载文件
*/
public function download()
{
$params = (new GenerateTableValidate())->goCheck('download');
$result = GeneratorLogic::download($params['file']);
if (false === $result) {
return $this->fail(GeneratorLogic::getError() ?: '下载失败');
}
return response()->download($result, 'webman-curd.zip');
}
}