69 lines
2.2 KiB
PHP
69 lines
2.2 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;
|
|
|
|
class IndexController extends BaseApiController
|
|
{
|
|
public $notNeedLogin = ['index'];
|
|
|
|
public function index()
|
|
{
|
|
$template=[
|
|
'touser'=>'ocqhF6UfFQXE-SbzbP5YVQJlQAh0',
|
|
'template_id'=>'hfvTch-DcP_UQ83VkD6Z-eMimeRrK8P8zpWC9j2dOKc',
|
|
'miniprogram'=>'data',
|
|
'appid'=>'wxdee751952c8c2027',
|
|
'pagepath'=>'pages/index/index',
|
|
'data'=>[
|
|
'thing2' => ['value'=>'圆珠笔采购订单'],
|
|
'time6' => ['value'=>date('Y-m-d H:i:s')],
|
|
'thing4' =>['value'=>'张三'],
|
|
'phone_number5' =>['value'=>18982406440],
|
|
]
|
|
];
|
|
$token='80_u14-Yey-hmXxx-GPD0Pk8X0l_0OQ0B8U-VWNw8h9cs3RYCefviQMK_idliIZ5qUvBCcfuW7NPUUL3CTCB87gJgTFpwRWULWG-nqq9gTDxtX_Su7EjVcW9QJsjuYENNbAAAQZZ';
|
|
$url="https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=".$token;
|
|
$a=new WeChatOaService();
|
|
d($a->getClient()->post($url,$template));
|
|
$order = [
|
|
'description' => '测试 - yansongda - 1',
|
|
'out_trade_no' => time().'',
|
|
'payer' => [
|
|
'auth_code' => '123456789123456789'
|
|
],
|
|
'amount' => [
|
|
'total' => 1,
|
|
],
|
|
'scene_info' => [
|
|
'device_id' => '013467007045764',
|
|
'device_ip' => '128.0.0.1',
|
|
"store_info"=>[
|
|
"id" => "0001",
|
|
"out_id" => "A1111"
|
|
]
|
|
],
|
|
];
|
|
|
|
d($a->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');
|
|
}
|
|
}
|