|
@@ -13,6 +13,7 @@ use app\common\model\store\product\Product;
|
|
13
|
use app\common\model\store\product\ProductContent;
|
13
|
use app\common\model\store\product\ProductContent;
|
|
14
|
use app\common\model\user\User;
|
14
|
use app\common\model\user\User;
|
|
15
|
use app\common\repositories\merchant\MerchantRepository;
|
15
|
use app\common\repositories\merchant\MerchantRepository;
|
|
|
|
16
|
+use app\common\repositories\shared\SharedProsperityRecommendConfigRepository;
|
|
16
|
use app\common\repositories\store\coupon\StoreCouponRepository;
|
17
|
use app\common\repositories\store\coupon\StoreCouponRepository;
|
|
17
|
use app\common\repositories\store\order\StoreOrderRepository;
|
18
|
use app\common\repositories\store\order\StoreOrderRepository;
|
|
18
|
use app\common\repositories\store\order\StoreRefundOrderRepository;
|
19
|
use app\common\repositories\store\order\StoreRefundOrderRepository;
|
|
@@ -1065,6 +1066,19 @@ class ProductRepository extends BaseRepository
|
|
1065
|
$res['yanglao'] = bcmul($res['price'], CommonEnum::ORDER_EARNING_ALLOCATION['SharedProsperity']['Self']['YangLaoJin']['Ratio']['code'], 2);
|
1066
|
$res['yanglao'] = bcmul($res['price'], CommonEnum::ORDER_EARNING_ALLOCATION['SharedProsperity']['Self']['YangLaoJin']['Ratio']['code'], 2);
|
|
1066
|
$k['jifen'] = 0;
|
1067
|
$k['jifen'] = 0;
|
|
1067
|
$k['gongxian'] = 0;
|
1068
|
$k['gongxian'] = 0;
|
|
|
|
1069
|
+
|
|
|
|
1070
|
+ // 计算共富区PV
|
|
|
|
1071
|
+ /** @var SharedProsperityRecommendConfigRepository $sharedProsperityRecommendConfigRepository */
|
|
|
|
1072
|
+ $sharedProsperityRecommendConfigRepository = app()->make(SharedProsperityRecommendConfigRepository::class);
|
|
|
|
1073
|
+ $sharedProsperityRecommendConfigEntityByMaxRewardRatio = $sharedProsperityRecommendConfigRepository->getSharedProsperityRecommendConfigEntityByMaxRewardRatio();
|
|
|
|
1074
|
+ // 利润 减去 顶格的直推奖,剩下的是PV值
|
|
|
|
1075
|
+ $pvProportion = bcsub('1', bcdiv($sharedProsperityRecommendConfigEntityByMaxRewardRatio->getRewardRatio(), '100', 4), 2);
|
|
|
|
1076
|
+ // 获取利润
|
|
|
|
1077
|
+ $productSku = Db::name('store_product_attr_value')->where('product_id', $res['product_id'])->order('price asc')->find();
|
|
|
|
1078
|
+ // 计算pv
|
|
|
|
1079
|
+ $pv = bcmul($productSku['plate_mer_profit'], $pvProportion, CommonEnum::DECIMAL_PLACES_OF_THE_AMOUNT);
|
|
|
|
1080
|
+ $k['pv'] = $pv;
|
|
|
|
1081
|
+
|
|
1068
|
}
|
1082
|
}
|
|
1069
|
|
1083
|
|
|
1070
|
$res['pv']=($k['pv']);
|
1084
|
$res['pv']=($k['pv']);
|