Files
im/plugin/admin/app/controller/CardController.php
T
2025-11-21 01:42:54 +08:00

60 lines
1.5 KiB
PHP

<?php
namespace plugin\admin\app\controller;
use plugin\admin\app\controller\Crud;
use support\exception\BusinessException;
use support\Request;
use support\Response;
use Throwable;
/**
* 卡密
*/
class CardController extends Crud
{
/**
* @var \plugin\admin\app\model\Card
*/
protected $model = null;
/**
* 构造函数
* @return void
*/
function __construct()
{
$this->model = new \plugin\admin\app\model\Card();
}
function clearCache(){
//cache('InfomercialIds',null);
}
function detail(){
return view('',[
]);
}
function export(){
$base_dir = rtrim(config('app.public_path', ''), '\\/');
$base_dir = $base_dir ? $base_dir . DIRECTORY_SEPARATOR : base_path() . "/public/";
$base_name = \app\model\Card::where('id',Input('ids'))->value('title').".xlsx";
//return $base_name;
$savePath = $base_dir.$base_name;
var_dump($savePath);
$list = \app\model\Cdkey::where('category_id',Input('ids'))->where('is_used',0)->where('status',1)->order('id asc')->field('account,expires')->select();
$list = collect($list);
(new \Rap2hpoutre\FastExcel\FastExcel($list))->export($savePath);
return response()->download($savePath, $base_name);
}
public function __after_insert__(Request $request){
//cache('InfomercialIds',null);
}
public function __after_delete__(Request $request){
$this->__after_insert__($request);
}
}