|
|
|
@ -16,6 +16,7 @@ use app\api\model\Goods as GoodsModel; |
|
|
|
|
use app\api\model\Setting as SettingModel; |
|
|
|
|
use app\api\model\GoodsSku as GoodsSkuModel; |
|
|
|
|
use app\api\model\Category as CategoryModel; |
|
|
|
|
use app\api\service\User as UserService; |
|
|
|
|
use app\common\model\store\Shop as ShopModel; |
|
|
|
|
use app\api\service\sharp\Active as ActiveService; |
|
|
|
|
use app\common\enum\Setting as SettingEnum; |
|
|
|
@ -23,6 +24,7 @@ use app\common\service\Goods as GoodsService; |
|
|
|
|
use app\api\model\sharp\Active as SharpActiveModel; |
|
|
|
|
use app\api\model\sharp\ActiveTime as ActiveTimeModel; |
|
|
|
|
use app\api\controller\sharp\Goods as miaosha; |
|
|
|
|
use app\store\model\goods\GoodsPrice as GoodsPriceModel; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 商品服务类 |
|
|
|
@ -278,7 +280,7 @@ class Goods extends GoodsService |
|
|
|
|
{ |
|
|
|
|
$data = []; |
|
|
|
|
foreach ($goodsList as $goods) { |
|
|
|
|
$data[] = [ |
|
|
|
|
$temp = [ |
|
|
|
|
'goods_id' => $goods['goods_id'], |
|
|
|
|
'goods_name' => $goods['goods_name'], |
|
|
|
|
'selling_point' => $goods['selling_point'], |
|
|
|
@ -290,6 +292,25 @@ class Goods extends GoodsService |
|
|
|
|
'goods_sales' => $goods['goods_sales'], |
|
|
|
|
'remaizhishu' => $goods['remaizhishu'], |
|
|
|
|
]; |
|
|
|
|
if (UserService::isLogin()) { |
|
|
|
|
$catService = new \app\store\model\GoodsCategoryRel(); |
|
|
|
|
$catIds = $catService->where(['goods_id' => $goods['goods_id']])->column('category_id'); |
|
|
|
|
$price_list_plus = $price_list_dealer = []; |
|
|
|
|
foreach ($catIds as $k => $v) { |
|
|
|
|
$price_list_plus[] = GoodsPriceModel::getDiscountPrice($v, 1, $goods['goods_price_min']); |
|
|
|
|
$price_list_dealer[] = GoodsPriceModel::getDiscountPrice($v, 2, $goods['goods_price_min']); |
|
|
|
|
} |
|
|
|
|
//价格判断 |
|
|
|
|
if (UserService::isstore()) { |
|
|
|
|
$temp['goods_price_min_plus'] = min($price_list_plus); |
|
|
|
|
$temp['goods_price_min_dealer'] = min($price_list_dealer); |
|
|
|
|
} elseif (UserService::isPlusMember()) { |
|
|
|
|
$temp['goods_price_min_plus'] = min($price_list_plus); |
|
|
|
|
} elseif (UserService::isDealerMember()) { |
|
|
|
|
$temp['goods_price_min_dealer'] = min($price_list_dealer); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$data[] = $temp; |
|
|
|
|
} |
|
|
|
|
return $data; |
|
|
|
|
} |
|
|
|
|