<?php
|
|
namespace app\admin\model;
|
|
use app\common\model\admin\Application_category as Application_categoryModel;
|
use app\admin\model\Application as ApplicationModel;
|
|
/**
|
* 应用分类模型
|
*/
|
class Application_category extends Application_categoryModel
|
{
|
/**
|
* 获取分类数据以及分类下的应用数据
|
*/
|
public static function getAll()
|
{
|
$model = new static;
|
$list = $model->where('is_delete', '=', 0)->select();
|
// 查询分类下的应用
|
foreach ($list as $category){
|
//$category['children'] = $category['id'];
|
$category['children'] = ApplicationModel::getListByPlusCategoryId($category['id']);
|
}
|
return $list;
|
}
|
|
/**
|
* 新增
|
*/
|
public function add($data)
|
{
|
return $this->save($data);
|
}
|
|
|
/**
|
* 删除
|
*/
|
public function setDelete()
|
{
|
return $this->save(['is_delete' => 1]);
|
}
|
|
/**
|
* 更新记录
|
*/
|
public function edit($data)
|
{
|
return $this->save($data);
|
}
|
|
}
|