12345678910111213141516171819202122232425262728293031323334 |
- <?php
- namespace app\common\service;
- use app\common\constant\CommonConstant;
- use app\common\model\GoodsCategory;
- /**
- * 商品分类服务类
- */
- class GoodsCategoryService
- {
- /**
- * 商品分类列表
- **/
- public static function get_list()
- {
- $field = 'id,pid,name,weigh';
- $list = GoodsCategory::field($field)
- ->where('pid', 0)
- ->where('status', CommonConstant::IS_WHO_1)
- ->where('is_deleted', CommonConstant::IS_DELETED_0)
- ->with([
- 'childlist' => function ($query) use ($field) {
- $query->field($field);
- }
- ])
- ->order('weigh desc,id asc')
- ->select();
- return $list;
- }
- }
|