فهرست منبع

del usage相关

shish 6 سال پیش
والد
کامیت
aa0b48c3e4

+ 0 - 12
biz/goods/classes/CategoryRelateClass.php

@@ -1,12 +0,0 @@
-<?php
-
-namespace biz\goods\classes;
-use Yii;
-use biz\base\classes\BaseClass;
-
-class CategoryRelateClass extends BaseClass
-{
-
-	public static $baseFile = '\biz\goods\models\CategoryRelate';
-	
-}

+ 0 - 12
biz/goods/classes/GoodsUsageClass.php

@@ -1,12 +0,0 @@
-<?php
-
-namespace biz\goods\classes;
-use Yii;
-use biz\base\classes\BaseClass;
-
-class GoodsUsageClass extends BaseClass
-{
-	
-	public static $baseFile = '\biz\goods\models\GoodsUsage';
-
-}

+ 0 - 12
biz/goods/classes/UsageClass.php

@@ -1,12 +0,0 @@
-<?php
-
-namespace biz\goods\classes;
-use Yii;
-use biz\base\classes\BaseClass;
-
-class UsageClass extends BaseClass
-{
-	
-	public static $baseFile = '\biz\goods\models\Usage';
-
-}

+ 0 - 12
biz/goods/classes/UsageRelationClass.php

@@ -1,12 +0,0 @@
-<?php
-
-namespace biz\goods\classes;
-use Yii;
-use biz\base\classes\BaseClass;
-
-class UsageRelationClass extends BaseClass
-{
-	
-	public static $baseFile = '\biz\goods\models\UsageRelation';
-
-}

+ 0 - 13
biz/goods/models/CategoryRelate.php

@@ -1,13 +0,0 @@
-<?php
-namespace biz\goods\models;
-use biz\base\models\Base;
-
-class CategoryRelate extends Base
-{
-
-	public static function tableName()
-	{
-		return 'xhCategoryRelate';
-	}
-
-}

+ 0 - 13
biz/goods/models/GoodsUsage.php

@@ -1,13 +0,0 @@
-<?php
-namespace biz\goods\models;
-use biz\base\models\Base;
-
-class GoodsUsage extends Base
-{
-	
-	public static function tableName()
-	{
-		return 'xhGoodsUsage';
-	}
-
-}

+ 0 - 13
biz/goods/models/Usage.php

@@ -1,13 +0,0 @@
-<?php
-namespace biz\goods\models;
-use biz\base\models\Base;
-
-class Usage extends Base
-{
-	
-	public static function tableName()
-	{
-		return 'xhUsage';
-	}
-	
-}

+ 0 - 13
biz/goods/models/UsageRelation.php

@@ -1,13 +0,0 @@
-<?php
-namespace biz\goods\models;
-use biz\base\models\Base;
-
-class UsageRelation extends Base
-{
-	
-	public static function tableName()
-	{
-		return 'xhUsageRelation';
-	}
-
-}

+ 0 - 93
biz/goods/services/CategoryRelateService.php

@@ -1,93 +0,0 @@
-<?php
-
-namespace biz\goods\services;
-
-use biz\base\services\BaseService;
-
-use common\components\arrayUtil;
-use Yii;
-use linslin\yii2\curl;
-
-class CategoryRelateService extends BaseService
-{
-	
-	public static $baseFile = '\biz\goods\classes\CategoryRelateClass';
-	
-	//取出商品分类 shish 2019.8.30
-	public static function getCategoryList()
-	{
-		$merchantId = Yii::$app->params['merchantId'];
-		$respond = self::getAllByCondition(['merchantId' => $merchantId, 'enable' => 1], 'inTurn desc', '*');
-		$list = [];
-		if (!empty($respond)) {
-			$platCategory = CategoryService::getAllCategory();
-			foreach ($respond as $val) {
-				$categoryId = $val['categoryId'];
-				$categoryName = isset($platCategory[$categoryId]['categoryName']) ? $platCategory[$categoryId]['categoryName'] : '';
-				$val['categoryName'] = $categoryName;
-				$val['name'] = $categoryName;
-				$list[] = $val;
-			}
-		}
-		return $list;
-	}
-	
-	//取出商品分类,带id键 shish 2019.8.30
-	public static function getCategoryData()
-	{
-		$merchantId = Yii::$app->params['merchantId'];
-		$list = self::getAllByCondition(['merchantId' => $merchantId], null, '*', 'id');
-		if (!empty($list)) {
-			$platCategory = CategoryService::getAllCategory();
-			foreach ($list as $key => $val) {
-				$categoryId = $val['categoryId'];
-				$list[$key]['categoryName'] = isset($platCategory[$categoryId]['categoryName']) ? $platCategory[$categoryId]['categoryName'] : '';
-				$list[$key]['name'] = isset($platCategory[$categoryId]['categoryName']) ? $platCategory[$categoryId]['categoryName'] : '';
-				$list[$key]['showName'] = isset($val['showName']) ? $val['showName'] : '';
-			}
-		}
-		return $list;
-	}
-	
-	//取出菜单 shish 2019.8.31 $num = 0表示取全部
-	public static function getShowList($num = 0)
-	{
-		$data = [];
-		$usageList = UsageRelationService::getShowUsage();
-		if (!empty($usageList)) {
-			foreach ($usageList as $key => $val) {
-				$data[] = ['type' => 'usage', 'showName' => $val['showName'], 'cover' => $val['cover'],
-					'categoryName' => $val['showName'], 'inTurn' => $val['inTurn'], 'id' => $val['id']];
-			}
-		}
-		$categoryLit = self::getShowCategory();
-		if (!empty($categoryLit)) {
-			foreach ($categoryLit as $key => $val) {
-				$data[] = ['type' => 'category', 'showName' => $val['showName'], 'cover' => $val['cover'],
-					'categoryName' => $val['showName'], 'inTurn' => $val['inTurn'], 'id' => $val['id']];
-			}
-		}
-		if (!empty($data)) {
-			$data = arrayUtil::arraySort($data, 'inTurn');
-			if ($num > 0 && count($data) > $num) {
-				$data = array_slice($data, 0, $num);
-			}
-		}
-		return $data;
-	}
-	
-	//取出要显示在前台的分类 shish 2019.8.31
-	public static function getShowCategory()
-	{
-		$category = self::getCategoryList();
-		if (!empty($category)) {
-			foreach ($category as $key => $val) {
-				if (empty($val['isShow'])) {
-					unset($category[$key]);
-				}
-			}
-		}
-		return $category;
-	}
-	
-}

+ 0 - 83
biz/goods/services/GoodsUsageService.php

@@ -1,83 +0,0 @@
-<?php
-
-namespace biz\goods\services;
-
-use biz\base\services\BaseService;
-use common\components\util;
-use Yii;
-
-class GoodsUsageService extends BaseService
-{
-	
-	public static $baseFile = '\biz\goods\classes\GoodsUsageClass';
-	
-	//获取商品的全部用途
-	public static function getGoodsUsageList($id)
-	{
-		return self::getAllByCondition(['goodsId' => $id], null, '*');
-	}
-	
-	//取用途下的全部商品,返回用途信息和商品列表 shish 2019.8.31
-	public static function getGoodsList($id)
-	{
-		$merchantId = Yii::$app->params['merchantId'];
-		$info = UsageRelationService::getById($id);
-		if (empty($info) || $info['merchantId'] != $merchantId) {
-			util::fail('没有找到用途信息,可能没有权限');
-		}
-		$list = self::getAllByCondition(['usageId' => $id,], 'inTurn desc', '*');
-		$goodsList = [];
-		if (!empty($list)) {
-			$goodsIdList = array_column($list, 'goodsId');
-			$goodsIdList = array_unique(array_filter($goodsIdList));
-			$goodsInfoList = GoodsService::getByIds($goodsIdList, null, 'id');
-			//$lazyShow 0 显示默认图 1显示原图
-			$lazyShow = Yii::$app->params['page'] == 1 ? 1 : 0;
-			foreach ($list as $key => $val) {
-				$goodsId = $val['goodsId'];
-				$goodsInfo = isset($goodsInfoList[$goodsId]) ? $goodsInfoList[$goodsId] : [];
-				if (!empty($goodsInfo)) {
-					//取出较小的图片页 shish 2019.8.31
-					$url = $goodsInfo['cover'];
-					$pos = strrpos($url, '.');
-					$pre = substr($url, 0, $pos);
-					$ext = substr($url, ($pos + 1));
-					$goodsInfo['middleCover'] = $pre . '_200.' . $ext;
-					$goodsInfo['lazyShow'] = $lazyShow;
-					$goodsList[] = $goodsInfo;
-				}
-			}
-		}
-		return ['info' => $info, 'goodsList' => $goodsList];
-	}
-	
-	//分页取用途下的全部商品,包括商品信息 shish 2019.9.1
-	public static function getGoodsData($id)
-	{
-		$merchantId = Yii::$app->params['merchantId'];
-		$where = ['merchantId' => $merchantId, 'usageId' => $id];
-		$return = self::getList('*', $where, 'inTurn desc');
-		$list = $return['list'];
-		$ids = array_column($list, 'goodsId');
-		$goodsList = [];
-		if (!empty($ids)) {
-			$goodsList = GoodsService::getByIds($ids);
-			//$lazyShow 0 显示默认图 1显示原图
-			$lazyShow = Yii::$app->params['page'] == 1 ? 1 : 0;
-			foreach ($goodsList as $key => $val) {
-				//图片懒加载参数,看不见的页面显示默认图片
-				$goodsList[$key]['lazyShow'] = $lazyShow;
-				//取出较小的封面图 shish 2019.8.3
-				$url = $val['cover'];
-				$pos = strrpos($url, '.');
-				$pre = substr($url, 0, $pos);
-				$ext = substr($url, ($pos + 1));
-				$middleCover = $pre . '_200.' . $ext;
-				$goodsList[$key]['middleCover'] = $middleCover;
-			}
-		}
-		$return['list'] = $goodsList;
-		return $return;
-	}
-	
-}

+ 0 - 47
biz/goods/services/UsageRelationService.php

@@ -1,47 +0,0 @@
-<?php
-
-namespace biz\goods\services;
-
-use biz\base\services\BaseService;
-use Yii;
-use linslin\yii2\curl;
-
-class UsageRelationService extends BaseService
-{
-
-	public static $baseFile = '\biz\goods\classes\UsageRelationClass';
-
-	//获取我的用途列表 shish 2019.8.17
-	public static function getMyUsage()
-	{
-		$merchantId = Yii::$app->params['merchantId'];
-		$usageList = self::getAllByCondition(['merchantId' => $merchantId], null, '*', 'id');
-		if (!empty($usageList)) {
-			$ids = array_column($usageList, 'usageId');
-			$infoList = UsageService::getAllByCondition(['id' => ['in', $ids]], null, '*', 'id');
-			foreach ($usageList as $key => $val) {
-				$id = $val['usageId'];
-				$usageList[$key]['usageName'] = isset($infoList[$id]['name']) ? $infoList[$id]['name'] : '';
-				$usageList[$key]['name'] = isset($infoList[$id]['name']) ? $infoList[$id]['name'] : '';
-				$usageList[$key]['showName'] = isset($val['showName']) ? $val['showName'] : '';
-			}
-		}
-		return $usageList;
-	}
-
-	//取显示在前台的用途 shish 2019.8.31
-	public static function getShowUsage()
-	{
-		$merchantId = Yii::$app->params['merchantId'];
-		$usageList = self::getAllByCondition(['merchantId' => $merchantId], null, '*');
-		if (!empty($usageList)) {
-			foreach ($usageList as $key => $val) {
-				if (empty($val['isShow'])) {
-					unset($usageList[$key]);
-				}
-			}
-		}
-		return $usageList;
-	}
-	
-}

+ 0 - 14
biz/goods/services/UsageService.php

@@ -1,14 +0,0 @@
-<?php
-
-namespace biz\goods\services;
-
-use biz\base\services\BaseService;
-use Yii;
-use linslin\yii2\curl;
-
-class UsageService extends BaseService
-{
-	
-	public static $baseFile = '\biz\goods\classes\UsageClass';
-	
-}