商户分类修改

This commit is contained in:
liu 2024-06-01 14:24:11 +08:00
parent f74610617b
commit feb7242b4f
3 changed files with 15 additions and 14 deletions

View File

@ -1,17 +1,17 @@
<?php <?php
namespace app\api\controller\goods; namespace app\api\controller\cate;
use app\api\controller\BaseApiController; use app\api\controller\BaseApiController;
use app\api\lists\goods\GoodsclassLists; use app\api\lists\cate\CateLists;
/** /**
* 商品分类控制器 * 商品分类控制器
* Class GoodsclassController * Class CateController
* @package app\admin\controller\goods * @package app\admin\controller\goods
*/ */
class GoodsclassController extends BaseApiController class CateController extends BaseApiController
{ {
public $notNeedLogin = ['lists']; public $notNeedLogin = ['lists'];
/** /**
@ -22,7 +22,7 @@ class GoodsclassController extends BaseApiController
*/ */
public function lists() public function lists()
{ {
return $this->dataLists(new GoodsclassLists()); return $this->dataLists(new CateLists());
} }

View File

@ -1,10 +1,10 @@
<?php <?php
namespace app\api\lists\goods; namespace app\api\lists\cate;
use app\admin\lists\BaseAdminDataLists; use app\admin\lists\BaseAdminDataLists;
use app\common\model\goods\Goodsclass; use app\common\model\cate\Cate;
use app\common\lists\ListsSearchInterface; use app\common\lists\ListsSearchInterface;
use app\Request; use app\Request;
@ -13,7 +13,7 @@ use app\Request;
* Class GoodsclassLists * Class GoodsclassLists
* @package app\admin\listsgoods * @package app\admin\listsgoods
*/ */
class GoodsclassLists extends BaseAdminDataLists implements ListsSearchInterface class CateLists extends BaseAdminDataLists implements ListsSearchInterface
{ {
protected $where; protected $where;
@ -44,7 +44,7 @@ class GoodsclassLists extends BaseAdminDataLists implements ListsSearchInterface
{ {
$pid=Request()->get('pid',0); $pid=Request()->get('pid',0);
if($pid==0){ if($pid==0){
$lists = Goodsclass::where($this->searchWhere) $lists = Cate::where($this->searchWhere)
->where('pid', 0) ->where('pid', 0)
->where('children','<>',null) ->where('children','<>',null)
->field(['id', 'pid', 'name', 'data', 'pic', 'sort']) ->field(['id', 'pid', 'name', 'data', 'pic', 'sort'])
@ -57,7 +57,7 @@ class GoodsclassLists extends BaseAdminDataLists implements ListsSearchInterface
$where[]=['children','<>','']; $where[]=['children','<>',''];
$this->where=$where; $this->where=$where;
} }
$lists = Goodsclass::where($this->searchWhere) $lists = Cate::where($this->searchWhere)
->where($this->where) ->where($this->where)
->field(['id', 'pid', 'name', 'data', 'pic', 'sort']) ->field(['id', 'pid', 'name', 'data', 'pic', 'sort'])
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)
@ -72,6 +72,7 @@ class GoodsclassLists extends BaseAdminDataLists implements ListsSearchInterface
// $v['children'] = $b; // $v['children'] = $b;
// } // }
// })->toArray(); // })->toArray();
return $lists; return $lists;
// return linear_to_tree($lists, 'children'); // return linear_to_tree($lists, 'children');
@ -88,11 +89,11 @@ class GoodsclassLists extends BaseAdminDataLists implements ListsSearchInterface
{ {
$pid=Request()->get('pid',0); $pid=Request()->get('pid',0);
if($pid==0){ if($pid==0){
return Goodsclass::where($this->searchWhere)->where('pid', 0) return Cate::where($this->searchWhere)->where('pid', 0)
->where('children','<>',null) ->where('children','<>',null)
->count(); ->count();
}else{ }else{
return Goodsclass::where($this->searchWhere) return Cate::where($this->searchWhere)
->where($this->where) ->where($this->where)
->count(); ->count();
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace app\common\model\goods; namespace app\common\model\cate;
use app\common\model\BaseModel; use app\common\model\BaseModel;
@ -12,7 +12,7 @@ use think\model\concern\SoftDelete;
* Class Goodsclass * Class Goodsclass
* @package app\common\model\goods * @package app\common\model\goods
*/ */
class Goodsclass extends BaseModel class Cate extends BaseModel
{ {
use SoftDelete; use SoftDelete;
protected $name = 'store_category'; protected $name = 'store_category';