作者 李宇航

合并分支 'lyh-server' 到 'master'

gx分类查看是否拥有下级



查看合并请求 !1513
@@ -77,12 +77,12 @@ class CategoryController extends BaseController @@ -77,12 +77,12 @@ class CategoryController extends BaseController
77 * @time :2025/3/19 14:38 77 * @time :2025/3/19 14:38
78 */ 78 */
79 public function get3283Lists(&$category,$filed){ 79 public function get3283Lists(&$category,$filed){
80 - $this->map['pid'] = ($this->map['pid'] ?? 0);  
81 $list = $category->list($this->map,['sort','id'],$filed); 80 $list = $category->list($this->map,['sort','id'],$filed);
82 $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST);//获取模版id 81 $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST);//获取模版id
83 foreach ($list as $k =>$v){ 82 foreach ($list as $k =>$v){
84 $v['url'] = $this->user['domain'] . $v['route'].'/'; 83 $v['url'] = $this->user['domain'] . $v['route'].'/';
85 $v['product_num'] = $category->getProductNum($list,$v['id']); 84 $v['product_num'] = $category->getProductNum($list,$v['id']);
  85 + $v['hasChildren'] = $this->getCategoryHasChildren($category,$v['id']);
86 $v['image_link'] = getImageUrl($v['image'],$this->user['storage_type'],$this->user['project_location']); 86 $v['image_link'] = getImageUrl($v['image'],$this->user['storage_type'],$this->user['project_location']);
87 $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST,$template_id,$v['id']); 87 $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST,$template_id,$v['id']);
88 $list[$k] = $v; 88 $list[$k] = $v;
@@ -91,6 +91,21 @@ class CategoryController extends BaseController @@ -91,6 +91,21 @@ class CategoryController extends BaseController
91 } 91 }
92 92
93 /** 93 /**
  94 + * @remark :查看是否拥有子集
  95 + * @name :getCategoryHasChildren
  96 + * @author :lyh
  97 + * @method :post
  98 + * @time :2025/3/20 9:18
  99 + */
  100 + public function getCategoryHasChildren(&$category,$id){
  101 + $count = $category->counts(['pid'=>$id]);
  102 + if($count != 0){
  103 + return true;
  104 + }
  105 + return false;
  106 + }
  107 +
  108 + /**
94 * @remark :搜索参数处理 109 * @remark :搜索参数处理
95 * @name :searchParam 110 * @name :searchParam
96 * @author :lyh 111 * @author :lyh