car/application/admin/controller/wechat/Api.php
2025-07-01 18:13:26 +08:00

32 lines
734 B
PHP

<?php
namespace app\admin\controller\wechat;
use app\common\controller\Backend;
use think\Db;
/**
*
*
* @icon fa fa-circle-o
*/
class Api extends Backend
{
protected $noNeedRight = ['*'];
protected $noNeedLogin = ['*'];
public function select()
{
$series = Db::query("SELECT a.id,brand_id as pid, a.name FROM series a LEFT JOIN brands b ON a.brand_id = b.id;");
$brands = Db::query("SELECT id, 0 as pid, `name` FROM brands;");
$this->series = $series;
$this->brands = $brands;
$data = array_merge($brands,$series);
$tree = $this->buildTree($data);
$formattedTree = $this->formatTree($tree);
return $this->return_json($formattedTree);
}
}