54 lines
1.7 KiB
PHP
54 lines
1.7 KiB
PHP
<?php
|
||
|
||
namespace app\api\controller;
|
||
|
||
use app\admin\logic\operation\OpurchaseclassLogic;
|
||
use app\admin\validate\tools\GenerateTableValidate;
|
||
use app\admin\logic\tools\GeneratorLogic;
|
||
use app\common\service\pay\PayService;
|
||
use app\common\service\PushService;
|
||
use app\common\service\wechat\WeChatMnpService;
|
||
use app\common\service\wechat\WeChatOaService;
|
||
use DateTime;
|
||
use Webman\Config;
|
||
use Webman\RedisQueue\Redis;
|
||
use Yansongda\Pay\Pay;
|
||
use Webman\Push\Api;
|
||
|
||
class IndexController extends BaseApiController
|
||
{
|
||
public $notNeedLogin = ['index'];
|
||
|
||
public function index()
|
||
{
|
||
// PushService::push('store_merchant_502', 502, '支付超时,订单已被取消,请重新提交订单');
|
||
// d(1);
|
||
// $extra=$this->request->post();
|
||
// Redis::send('push-supplier-products', ['order_id'=>11]);
|
||
// createSupplierGoods
|
||
// d(OpurchaseclassLogic::createSupplierGoods(['goods'=>99]));
|
||
$queue = 'send-mail';
|
||
// 数据,可以直接传数组,无需序列化
|
||
$data = ['to' => 'tom@gmail.com', 'content' => 'hello'];
|
||
// 投递消息
|
||
Redis::send($queue, $data);
|
||
// 投递延迟消息,消息会在60秒后处理
|
||
// Redis::send($queue, $data, 5);
|
||
|
||
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');
|
||
}
|
||
}
|