49 lines
1.3 KiB
PHP
49 lines
1.3 KiB
PHP
<?php
|
|
/**
|
|
* @copyright Copyright (c) 2023-2024 美天智能科技
|
|
* @link http://www.meteteme.com
|
|
*/
|
|
|
|
namespace app\apiout\controller;
|
|
|
|
use app\apiout\BaseController;
|
|
use app\model\Download as DownloadList;
|
|
use app\model\DownloadCate as DownloadCateList;
|
|
use think\facade\Db;
|
|
use think\facade\View;
|
|
|
|
class Download extends BaseController
|
|
{
|
|
|
|
//获取软件分类
|
|
public function catelist()
|
|
{
|
|
$catelist = DownloadCateList::field('id, name, sort')
|
|
->where('delete_time', null)
|
|
->order('sort', 'desc')
|
|
->select();
|
|
return json(['code' => 0, 'msg' => '', 'data' => $catelist]);
|
|
}
|
|
|
|
//获取分类详情
|
|
public function cateinfo()
|
|
{
|
|
$id = get_params('id'); // 获取分类 ID 参数
|
|
|
|
if (!$id) {
|
|
return json(['code' => 1, 'msg' => '分类 ID 不能为空', 'data' => []]);
|
|
}
|
|
|
|
// 查询对应分类下的所有数据
|
|
$cateinfo = DownloadList::field('id, cid, name, path, download_url, download_code, size ,type')
|
|
->where('cid', $id)
|
|
->select(); // 使用 select() 返回多个数据
|
|
|
|
if ($cateinfo->isEmpty()) {
|
|
return json(['code' => 1, 'msg' => '该分类下没有数据', 'data' => []]);
|
|
}
|
|
|
|
return json(['code' => 0, 'msg' => '', 'data' => $cateinfo]);
|
|
}
|
|
|
|
} |