You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
2.2 KiB
72 lines
2.2 KiB
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | 天诚科技 [ 刘海东 17600099397赋能开发者,助力企业发展 ]
|
|
// +----------------------------------------------------------------------
|
|
// | Copyright (c) 2016~2020 https://www.tczxkj.com All rights reserved.
|
|
// +----------------------------------------------------------------------
|
|
// | Licensed 该系统并不是自由软件,未经许可不能去掉相关版权
|
|
// +----------------------------------------------------------------------
|
|
// | Author:甘肃天诚志信电子商务有限公司 刘海东 联系电话维系17600099397
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace app\merchant\model\system;
|
|
|
|
use traits\ModelTrait;
|
|
use basic\ModelBasic;
|
|
use service\UtilService;
|
|
|
|
/**
|
|
* 文件检验model
|
|
* Class SystemAttachmentCategory
|
|
* @package app\merchant\model\system
|
|
*/
|
|
class SystemAttachmentCategory extends ModelBasic
|
|
{
|
|
use ModelTrait;
|
|
|
|
/**
|
|
* 获取分类图
|
|
* */
|
|
public static function getAll($mer_id = 0)
|
|
{
|
|
$model = new self;
|
|
if ($mer_id > 0) $model = $model->where('mer_id', $mer_id);
|
|
return self::tidyMenuTier($model->select(), 0);
|
|
}
|
|
|
|
public static function tidyMenuTier($menusList, $pid = 0, $navList = [])
|
|
{
|
|
|
|
foreach ($menusList as $k => $menu) {
|
|
$menu = $menu->getData();
|
|
if ($menu['pid'] == $pid) {
|
|
unset($menusList[$k]);
|
|
$menu['child'] = self::tidyMenuTier($menusList, $menu['id']);
|
|
$navList[] = $menu;
|
|
}
|
|
}
|
|
return $navList;
|
|
}
|
|
|
|
/**获取分类下拉列表
|
|
* @return array
|
|
*/
|
|
public static function getCateList($id = 10000, $mer_id = 0)
|
|
{
|
|
$model = new self();
|
|
if ($id == 0) $model->where('pid', $id);
|
|
if ($mer_id > 0) $model = $model->where('mer_id', $mer_id);
|
|
return UtilService::sortListTier($model->select()->toArray());
|
|
}
|
|
|
|
/**
|
|
* 获取单条信息
|
|
* */
|
|
public static function getinfo($att_id)
|
|
{
|
|
$model = new self;
|
|
$where['att_id'] = $att_id;
|
|
return $model->where($where)->select()->toArray()[0];
|
|
}
|
|
|
|
}
|
|
|