erp_old/app/api/controller/IndexController.php

52 lines
1.3 KiB
PHP
Raw Normal View History

2023-09-20 13:54:09 +08:00
<?php
namespace app\api\controller;
2024-01-20 22:40:47 +08:00
use app\admin\validate\tools\GenerateTableValidate;
use app\admin\logic\tools\GeneratorLogic;
2024-05-08 10:27:06 +08:00
use app\common\service\pay\PayService;
use app\common\service\wechat\WeChatOaService;
2024-05-10 11:31:45 +08:00
use Webman\Config;
use Yansongda\Pay\Pay;
2024-01-20 22:40:47 +08:00
2024-04-26 11:26:12 +08:00
class IndexController extends BaseApiController
2024-01-20 22:40:47 +08:00
{
2024-04-26 11:26:12 +08:00
public $notNeedLogin = ['index'];
2024-01-20 22:40:47 +08:00
public function index()
{
2024-05-10 11:31:45 +08:00
Pay::config(Config::get('payment'));
2024-05-08 10:27:06 +08:00
$order = [
'description' => '测试 - yansongda - 1',
'out_trade_no' => time().'',
'payer' => [
2024-05-10 11:31:45 +08:00
'auth_code' => 'xxxxxxxxxxx'
2024-05-08 10:27:06 +08:00
],
'amount' => [
'total' => 1,
],
'scene_info' => [
2024-05-10 11:31:45 +08:00
'store_info'=>[
'id' => '5678'
2024-05-08 10:27:06 +08:00
]
],
];
2024-05-10 11:31:45 +08:00
$result = Pay::wechat()->pos($order);
2024-03-22 15:59:25 +08:00
return json(['msg' =>create_password(123456, '11d3')]);
2023-09-20 13:54:09 +08:00
}
2024-01-20 22:40:47 +08:00
/**
* @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');
}
}