erp_old/app/api/controller/IndexController.php

102 lines
3.1 KiB
PHP
Raw Normal View History

2023-09-20 13:54:09 +08:00
<?php
namespace app\api\controller;
2024-05-15 14:22:40 +08:00
use app\admin\logic\operation\OpurchaseclassLogic;
2024-01-20 22:40:47 +08:00
use app\admin\validate\tools\GenerateTableValidate;
use app\admin\logic\tools\GeneratorLogic;
use app\common\model\goods\Goods;
use app\common\model\goods\Goodsclass;
2024-05-08 10:27:06 +08:00
use app\common\service\pay\PayService;
2024-05-16 12:00:48 +08:00
use app\common\service\PushService;
2024-05-14 16:11:08 +08:00
use app\common\service\wechat\WeChatMnpService;
2024-05-08 10:27:06 +08:00
use app\common\service\wechat\WeChatOaService;
2024-05-14 17:30:17 +08:00
use DateTime;
2024-05-18 14:01:51 +08:00
use Firebase\JWT\JWT;
use Firebase\JWT\Key;
use stdClass;
2024-05-17 16:18:21 +08:00
use think\facade\Db;
2024-05-10 11:31:45 +08:00
use Webman\Config;
2024-05-10 14:21:10 +08:00
use Webman\RedisQueue\Redis;
2024-05-10 11:31:45 +08:00
use Yansongda\Pay\Pay;
2024-05-10 14:21:10 +08:00
use Webman\Push\Api;
2024-05-18 14:01:51 +08:00
use JPush\Client as JPush;
use support\Log;
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-05-17 16:18:21 +08:00
public $notNeedLogin = ['index','app_update'];
2024-04-26 11:26:12 +08:00
2024-01-20 22:40:47 +08:00
public function index()
{
$auth_code=$this->request->get('auth_code');
$config = Config::get('payment');
Pay::config($config);
$result = Pay::alipay()->pos([
'out_trade_no' => time(),
'auth_code' => $auth_code,
'total_amount' => '0.01',
'subject' => 'yansongda 测试 - 01',
]);
d($result);
// $arr = [];
// foreach ($a as $k => $v) {
// $pid = Goodsclass::where('id', $v)->value('pid');
// $arr[$pid][] = $v;
// }
// foreach ($arr as $k => $v) {
// Goodsclass::where('id', $k)->update(['children' => json_encode($v, true)]);
// }
d(1);
// $a=array_values($a);
2024-05-22 16:05:49 +08:00
// $client = new JPush($app_key, $master_secret);
2024-05-18 14:01:51 +08:00
2024-05-22 16:05:49 +08:00
// $client->push()
// ->setPlatform('all')
// ->addAllAudience()
// ->setNotificationAlert('Hello, JPush')
// ->send();
2024-05-18 14:01:51 +08:00
// var_dump(2323);
2024-05-17 16:18:21 +08:00
return json(['msg' =>create_password(123456, '11d3')]);
2024-05-16 12:00:48 +08:00
// PushService::push('store_merchant_502', 502, '支付超时,订单已被取消,请重新提交订单');
// d(1);
2024-05-15 14:22:40 +08:00
// $extra=$this->request->post();
// Redis::send('push-supplier-products', ['order_id'=>11]);
// createSupplierGoods
2024-05-16 12:00:48 +08:00
// d(OpurchaseclassLogic::createSupplierGoods(['goods'=>99]));
2024-05-10 14:21:10 +08:00
$queue = 'send-mail';
// 数据,可以直接传数组,无需序列化
$data = ['to' => 'tom@gmail.com', 'content' => 'hello'];
// 投递消息
Redis::send($queue, $data);
// 投递延迟消息消息会在60秒后处理
2024-05-10 17:55:36 +08:00
// Redis::send($queue, $data, 5);
2024-05-10 14:21:10 +08:00
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');
}
2024-05-17 16:18:21 +08:00
/**
* @notes 获取app更新信息
*/
public function app_update(){
$find= Db::name('app_update')->where('type',2)->order('id','desc')->findOrEmpty();
return $this->success('ok',$find);
}
2024-01-20 22:40:47 +08:00
}