|
@@ -11,9 +11,10 @@ use linslin\yii2\curl;
|
|
|
|
|
|
|
|
class CategoryService extends BaseService
|
|
class CategoryService extends BaseService
|
|
|
{
|
|
{
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
public static $baseFile = '\bizHd\goods\classes\CategoryClass';
|
|
public static $baseFile = '\bizHd\goods\classes\CategoryClass';
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//取所有的分类 ssh 2019.12.7
|
|
//取所有的分类 ssh 2019.12.7
|
|
|
public static function getCategoryList($merchantId)
|
|
public static function getCategoryList($merchantId)
|
|
|
{
|
|
{
|
|
@@ -28,7 +29,7 @@ class CategoryService extends BaseService
|
|
|
}
|
|
}
|
|
|
return $cat;
|
|
return $cat;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//取出可用的分类 ssh 2019.12.2
|
|
//取出可用的分类 ssh 2019.12.2
|
|
|
public static function getEnableList($merchantId)
|
|
public static function getEnableList($merchantId)
|
|
|
{
|
|
{
|
|
@@ -43,21 +44,21 @@ class CategoryService extends BaseService
|
|
|
}
|
|
}
|
|
|
return $cat;
|
|
return $cat;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//获取商家所有的分类名称
|
|
//获取商家所有的分类名称
|
|
|
public static function getNameList($merchantId)
|
|
public static function getNameList($merchantId)
|
|
|
{
|
|
{
|
|
|
$cat = CategoryClass::getAllByCondition(['merchantId' => $merchantId, 'delStatus' => 0], 'inTurn DESC', '*');
|
|
$cat = CategoryClass::getAllByCondition(['merchantId' => $merchantId, 'delStatus' => 0], 'inTurn DESC', '*');
|
|
|
return empty($cat) ? [] : array_column($cat, 'categoryName');
|
|
return empty($cat) ? [] : array_column($cat, 'categoryName');
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//取出商家所有的分类ID ssh 2019.12.7
|
|
//取出商家所有的分类ID ssh 2019.12.7
|
|
|
public static function getCategoryIdList($merchantId)
|
|
public static function getCategoryIdList($merchantId)
|
|
|
{
|
|
{
|
|
|
return CategoryClass::getCategoryIdList($merchantId);
|
|
return CategoryClass::getCategoryIdList($merchantId);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
//获取商家最靠前的分类id ssh 2019.12.2
|
|
//获取商家最靠前的分类id ssh 2019.12.2
|
|
|
public static function getTopCategoryId($merchantId)
|
|
public static function getTopCategoryId($merchantId)
|
|
|
{
|
|
{
|
|
@@ -65,7 +66,7 @@ class CategoryService extends BaseService
|
|
|
$id = isset($cat['id']) ? $cat['id'] : 0;
|
|
$id = isset($cat['id']) ? $cat['id'] : 0;
|
|
|
return $id;
|
|
return $id;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//获取前三个分类信息 ssh 2019.12.2
|
|
//获取前三个分类信息 ssh 2019.12.2
|
|
|
public static function getTopThreeCategory($merchantId)
|
|
public static function getTopThreeCategory($merchantId)
|
|
|
{
|
|
{
|
|
@@ -75,7 +76,7 @@ class CategoryService extends BaseService
|
|
|
}
|
|
}
|
|
|
return $cat;
|
|
return $cat;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//验证操作权限 ssh 2019.12.8
|
|
//验证操作权限 ssh 2019.12.8
|
|
|
public static function valid($category, $merchantId)
|
|
public static function valid($category, $merchantId)
|
|
|
{
|
|
{
|
|
@@ -83,24 +84,24 @@ class CategoryService extends BaseService
|
|
|
util::fail('您没有权限操作');
|
|
util::fail('您没有权限操作');
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//获取详情 ssh 2019.12.8
|
|
//获取详情 ssh 2019.12.8
|
|
|
public static function getInfo($id)
|
|
public static function getInfo($id)
|
|
|
{
|
|
{
|
|
|
return CategoryClass::getInfo($id);
|
|
return CategoryClass::getInfo($id);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//添加分类 ssh 2019.12.8
|
|
//添加分类 ssh 2019.12.8
|
|
|
public static function addCategory($data)
|
|
public static function addCategory($data)
|
|
|
{
|
|
{
|
|
|
return CategoryClass::addCategory($data);
|
|
return CategoryClass::addCategory($data);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
public static function changeStatus($categoryId, $status)
|
|
public static function changeStatus($categoryId, $status)
|
|
|
{
|
|
{
|
|
|
return CategoryClass::changeStatus($categoryId, $status);
|
|
return CategoryClass::changeStatus($categoryId, $status);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//更新分类 ssh 2019.12.8
|
|
//更新分类 ssh 2019.12.8
|
|
|
public static function updateCategory($category, $post)
|
|
public static function updateCategory($category, $post)
|
|
|
{
|
|
{
|
|
@@ -115,10 +116,25 @@ class CategoryService extends BaseService
|
|
|
}
|
|
}
|
|
|
CategoryClass::updateById($categoryId, $post);
|
|
CategoryClass::updateById($categoryId, $post);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
public static function deleteCategory($id)
|
|
public static function deleteCategory($id)
|
|
|
{
|
|
{
|
|
|
return CategoryClass::deleteCategory($id);
|
|
return CategoryClass::deleteCategory($id);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-}
|
|
|
|
|
|
|
+
|
|
|
|
|
+ //获取开单页所有的分类:包括、常用
|
|
|
|
|
+ public static function getCategoryClassAll($merchantId)
|
|
|
|
|
+ {
|
|
|
|
|
+ $where = [
|
|
|
|
|
+ 'merchantId'=>$merchantId
|
|
|
|
|
+ ];
|
|
|
|
|
+ $data = self::getAllList('id,categoryName as name',$where,'inTurn desc');
|
|
|
|
|
+ $use = [
|
|
|
|
|
+ 'id'=>-2,
|
|
|
|
|
+ 'name'=>'常用'
|
|
|
|
|
+ ];
|
|
|
|
|
+ array_unshift($data,$use);
|
|
|
|
|
+ return $data;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+}
|