|
|
@@ -1187,7 +1187,7 @@ class StoreOrderRepository extends BaseRepository
|
|
|
@file_put_contents('quanju2.txt', $res . "-结果\r\n", 8);
|
|
|
// }
|
|
|
// 礼包购买数
|
|
|
- $this->pack_count($order['uid'],$order['pay_price']);
|
|
|
+ $this->pack_count($order['uid'],$product_id);
|
|
|
}
|
|
|
|
|
|
$award_integral = $user['award_integral'];
|
|
|
@@ -1247,7 +1247,7 @@ class StoreOrderRepository extends BaseRepository
|
|
|
$UserRepository = app()->make(UserRepository::class);
|
|
|
$UserRepository->checkAward($order['uid']);
|
|
|
// 上级推荐奖励的分红积分
|
|
|
- $this->getSpreadIntegral($order, $type, $user);
|
|
|
+ $this->getSpreadIntegral($order, $type, $user,$product_id);
|
|
|
// 检测节能油或者礼包升级
|
|
|
// $AwardLake = app()->make(AwardLake::class);
|
|
|
$awardLake = app()->make(AwardLake::class);
|
|
|
@@ -1276,18 +1276,18 @@ class StoreOrderRepository extends BaseRepository
|
|
|
}
|
|
|
|
|
|
//礼包购买数
|
|
|
- public function pack_count($uid,$price)
|
|
|
+ public function pack_count($uid,$product_id)
|
|
|
{
|
|
|
// 增加上级礼包购买数
|
|
|
$spread_uid = User::where('uid', $uid)->value('spread_uid');
|
|
|
if ($spread_uid > 0){
|
|
|
- $count = GiftReward::where('uid',$spread_uid)->where('price',$price)->find();
|
|
|
+ $count = GiftReward::where('uid',$spread_uid)->where('product_id',$product_id)->find();
|
|
|
if (!empty($count)){
|
|
|
$spread_count = bcadd($count['count'], 1, 0);
|
|
|
- $res =GiftReward::where('uid',$spread_uid)->where('price',$price)->update(['count' => $spread_count,'update_time'=>time()]);
|
|
|
+ $res =GiftReward::where('uid',$spread_uid)->where('product_id',$product_id)->update(['count' => $spread_count,'update_time'=>time()]);
|
|
|
@file_put_contents('quanju.txt', json_encode($res) . "-礼包数量\r\n", 8);
|
|
|
}else{
|
|
|
- $res = GiftReward::create(['uid' => $spread_uid, 'price' => $price, 'count' => 1,'update_time'=>time()]);
|
|
|
+ $res = GiftReward::create(['uid' => $spread_uid, 'product_id' => $product_id, 'count' => 1,'update_time'=>time()]);
|
|
|
@file_put_contents('quanju.txt', json_encode($res) . "-礼包刷领\r\n", 8);
|
|
|
}
|
|
|
|
|
|
@@ -1300,7 +1300,7 @@ class StoreOrderRepository extends BaseRepository
|
|
|
}
|
|
|
|
|
|
// 上级推荐奖励的分红积分
|
|
|
- public function getSpreadIntegral($order, $type, $user)
|
|
|
+ public function getSpreadIntegral($order, $type, $user,$product_id)
|
|
|
{
|
|
|
$price = app()->make(AwardIntegralPriceRepository::class)->awardIntegralPrice(); //分红积分价格
|
|
|
@file_put_contents('quanju.txt', json_encode($price) . "-积分金额3\r\n", 8);
|
|
|
@@ -1351,7 +1351,7 @@ class StoreOrderRepository extends BaseRepository
|
|
|
break;
|
|
|
case 6: //礼包商品
|
|
|
// $pack_count = User::where('uid', $user['spread_uid'])->value('pack_count'); //上级礼包数量
|
|
|
- $pack_count = GiftReward::where('uid', $user['spread_uid'])->where('price', $order['pay_price'])->value('count'); //上级礼包数量
|
|
|
+ $pack_count = GiftReward::where('uid', $user['spread_uid'])->where('product_id', $product_id)->value('count'); //上级礼包数量
|
|
|
// $pack_count = bcadd($pack_count, 1, 2);
|
|
|
// @file_put_contents('quanju.txt', $pack_count. "-礼包数加一\r\n", 8);
|
|
|
$remainder = bcmod($pack_count, 3); //取余
|