|
|
|
@ -13,19 +13,18 @@ declare (strict_types=1); |
|
|
|
|
|
|
|
|
|
namespace app\common\model; |
|
|
|
|
|
|
|
|
|
use app\api\service\User as UserService; |
|
|
|
|
use app\common\enum\goods\Status as GoodsStatusEnum; |
|
|
|
|
use app\common\enum\order\DeliveryType as DeliveryTypeEnum; |
|
|
|
|
use app\common\library\helper; |
|
|
|
|
use app\store\model\GoodsCategoryRel as GoodsCategoryRelModel; |
|
|
|
|
use cores\BaseModel; |
|
|
|
|
use think\db\BaseQuery; |
|
|
|
|
use think\db\exception\DbException; |
|
|
|
|
use think\model\Collection; |
|
|
|
|
use think\model\relation\BelongsTo; |
|
|
|
|
use think\model\relation\HasMany; |
|
|
|
|
use think\Paginator; |
|
|
|
|
use think\model\Collection; |
|
|
|
|
use think\model\relation\HasOne; |
|
|
|
|
use app\store\model\GoodsCategoryRel as GoodsCategoryRelModel; |
|
|
|
|
use app\common\library\helper; |
|
|
|
|
use app\common\enum\goods\Status as GoodsStatusEnum; |
|
|
|
|
use app\common\enum\order\DeliveryType as DeliveryTypeEnum; |
|
|
|
|
use think\Paginator; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 商品模型 |
|
|
|
@ -357,25 +356,23 @@ class Goods extends BaseModel |
|
|
|
|
$goodsInfo['goods_image'] = current($goodsInfo['goods_images'])['preview_url']; |
|
|
|
|
// 商品销量(实际显示=初始虚拟销量+实际销量) |
|
|
|
|
$goodsInfo['goods_sales'] = $goodsInfo['sales_initial'] + $goodsInfo['sales_actual']; |
|
|
|
|
//商品价格判断 |
|
|
|
|
if (UserService::isLogin()) { |
|
|
|
|
if (UserService::isStore()) {//店主 |
|
|
|
|
$goodsInfo['goods_price_min_plus'] = 0; |
|
|
|
|
$goodsInfo['goods_price_min_dealer'] = 0; |
|
|
|
|
} elseif (UserService::isDealerMember()) { //分销商 |
|
|
|
|
$goodsInfo['goods_price_min_dealer'] = 0; |
|
|
|
|
} elseif (UserService::isPlusMember()) {//升级会员 |
|
|
|
|
$goodsInfo['goods_price_min_plus'] = 0; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// //商品价格判断 |
|
|
|
|
// if (UserService::isLogin()) { |
|
|
|
|
// if (UserService::isStore()) {//店主 |
|
|
|
|
// $goodsInfo['goods_price_min_plus'] = 0; |
|
|
|
|
// $goodsInfo['goods_price_min_dealer'] = 0; |
|
|
|
|
// } elseif (UserService::isDealerMember()) { //分销商 |
|
|
|
|
// $goodsInfo['goods_price_min_dealer'] = 0; |
|
|
|
|
// } elseif (UserService::isPlusMember()) {//升级会员 |
|
|
|
|
// $goodsInfo['goods_price_min_plus'] = 0; |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// 回调函数 |
|
|
|
|
is_callable($callback) && call_user_func($callback, $goodsInfo); |
|
|
|
|
return $goodsInfo; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 根据商品id集获取商品列表 |
|
|
|
|
* @param array $goodsIds |
|
|
|
|