|
@@ -9,6 +9,7 @@ use App\Modules\Subscribe\Services\OrderParamService;
|
|
|
use App\Modules\Subscribe\Services\SubstituteOrderService;
|
|
|
use App\Modules\User\Services\ReadRecordService;
|
|
|
use App\Modules\User\Services\UserDivisionCpcPropertyService;
|
|
|
+use App\Modules\User\Services\UserGiftService;
|
|
|
use Illuminate\Routing\Controller;
|
|
|
use App\Libs\Pay\WechatPay;
|
|
|
use Illuminate\Http\Request;
|
|
@@ -876,7 +877,7 @@ class OrdersController extends Controller
|
|
|
];
|
|
|
UserService::PushUserActionToQueue($action_type, $distribution_channel_id, $param);
|
|
|
//用户属性
|
|
|
- $this->userProperty($uid);
|
|
|
+ $this->userProperty($uid,$price,$product->type);
|
|
|
return true;
|
|
|
} catch (\Exception $e) {
|
|
|
DB::rollback();
|
|
@@ -1022,7 +1023,7 @@ class OrdersController extends Controller
|
|
|
$this->successPayPushMsg($uid, $product, $order->id);
|
|
|
$this->orderStatistical($order);
|
|
|
DB::commit();
|
|
|
- $this->userProperty($uid);
|
|
|
+ $this->userProperty($uid,$price,$product->type);
|
|
|
$this->huaweiActivity($order->activity_id,$uid,$product_id);
|
|
|
//redis 删除未支付的uid
|
|
|
try {
|
|
@@ -1133,7 +1134,7 @@ class OrdersController extends Controller
|
|
|
$this->successPayPushMsg($uid, $product, $order->id);
|
|
|
$this->orderStatistical($order);
|
|
|
DB::commit();
|
|
|
- $this->userProperty($uid);
|
|
|
+ $this->userProperty($uid,$price,$product->type);
|
|
|
$this->huaweiActivity($order->activity_id,$uid,$product_id);
|
|
|
//redis 删除未支付的uid
|
|
|
$key = 'leyuee:to_send_not_pay_uid:distribution_channel_id' . $distribution_channel_id;
|
|
@@ -1270,7 +1271,7 @@ class OrdersController extends Controller
|
|
|
];
|
|
|
UserService::PushUserActionToQueue($action_type, $distribution_channel_id, $param);
|
|
|
|
|
|
- $this->userProperty($uid);
|
|
|
+ $this->userProperty($uid,$price,$product->type);
|
|
|
$this->huaweiActivity($order->activity_id,$uid,$product_id);
|
|
|
|
|
|
}
|
|
@@ -1710,11 +1711,13 @@ class OrdersController extends Controller
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
- private function userProperty($uid){
|
|
|
+ private function userProperty($uid,$price,$charge_type){
|
|
|
try{
|
|
|
$userproperty = UserDivisionCpcPropertyService::getUserSubscribeAndChargeInfoByUid($uid);
|
|
|
if(!$userproperty) return ;
|
|
|
UserDivisionCpcPropertyService::createorUpdate($userproperty);
|
|
|
+ //chargeGiveGift
|
|
|
+ $this->chargeGiveGift($uid,$userproperty,$price,$charge_type);
|
|
|
}catch (\Exception $e){}
|
|
|
|
|
|
}
|
|
@@ -1789,4 +1792,122 @@ class OrdersController extends Controller
|
|
|
Log::info($e);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private function chargeGiveGift($uid,$property,$price,$charge_type){
|
|
|
+ if(!$property) return ;
|
|
|
+ if($property == 'none' || $property == 'low'){
|
|
|
+ $gift = [];
|
|
|
+ if($price == 2){
|
|
|
+ $gift = [['gift_id'=>6,'num'=>1]];
|
|
|
+ }
|
|
|
+ if($price == 18){
|
|
|
+ $gift = [['gift_id'=>6,'num'=>1],['gift_id'=>7,'num'=>1]];
|
|
|
+ }
|
|
|
+ if($price == 30){
|
|
|
+ $gift = [
|
|
|
+ ['gift_id'=>6,'num'=>1],
|
|
|
+ ['gift_id'=>7,'num'=>1],
|
|
|
+ ['gift_id'=>1,'num'=>1]
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ if($price == 50){
|
|
|
+ $gift = [
|
|
|
+ ['gift_id'=>6,'num'=>1],
|
|
|
+ ['gift_id'=>7,'num'=>1],
|
|
|
+ ['gift_id'=>1,'num'=>1],
|
|
|
+ ['gift_id'=>3,'num'=>1]
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ if($price == 100){
|
|
|
+ $gift = [
|
|
|
+ ['gift_id'=>7,'num'=>1],
|
|
|
+ ['gift_id'=>1,'num'=>1],
|
|
|
+ ['gift_id'=>3,'num'=>1],
|
|
|
+ ['gift_id'=>2,'num'=>1]
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ if($price == 200){
|
|
|
+ $gift = [
|
|
|
+ ['gift_id'=>7,'num'=>1],
|
|
|
+ ['gift_id'=>1,'num'=>1],
|
|
|
+ ['gift_id'=>3,'num'=>1],
|
|
|
+ ['gift_id'=>2,'num'=>1],
|
|
|
+ ['gift_id'=>8,'num'=>1]
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ if($charge_type == 'YEAR_ORDER'){
|
|
|
+ $gift = [
|
|
|
+ ['gift_id'=>1,'num'=>1],
|
|
|
+ ['gift_id'=>2,'num'=>1],
|
|
|
+ ['gift_id'=>3,'num'=>1],
|
|
|
+ ['gift_id'=>6,'num'=>1],
|
|
|
+ ['gift_id'=>7,'num'=>1],
|
|
|
+ ['gift_id'=>8,'num'=>1]
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ if($gift){
|
|
|
+ UserGiftService::addGift($uid,$gift);
|
|
|
+ }
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+
|
|
|
+ if($property == 'high' || $property == 'medium'){
|
|
|
+ $gift = [];
|
|
|
+ if($price == 18){
|
|
|
+ $gift = [
|
|
|
+ ['gift_id'=>6,'num'=>1],
|
|
|
+ ['gift_id'=>1,'num'=>1],
|
|
|
+ ['gift_id'=>7,'num'=>1]
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ if($price == 30){
|
|
|
+ $gift = [
|
|
|
+ ['gift_id'=>6,'num'=>1],
|
|
|
+ ['gift_id'=>7,'num'=>1],
|
|
|
+ ['gift_id'=>1,'num'=>2]
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ if($price == 50){
|
|
|
+ $gift = [
|
|
|
+ ['gift_id'=>6,'num'=>2],
|
|
|
+ ['gift_id'=>7,'num'=>2],
|
|
|
+ ['gift_id'=>1,'num'=>2],
|
|
|
+ ['gift_id'=>3,'num'=>1]
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ if($price == 100){
|
|
|
+ $gift = [
|
|
|
+ ['gift_id'=>7,'num'=>3],
|
|
|
+ ['gift_id'=>1,'num'=>2],
|
|
|
+ ['gift_id'=>3,'num'=>1],
|
|
|
+ ['gift_id'=>2,'num'=>1]
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ if($price == 200){
|
|
|
+ $gift = [
|
|
|
+ ['gift_id'=>7,'num'=>1],
|
|
|
+ ['gift_id'=>1,'num'=>1],
|
|
|
+ ['gift_id'=>3,'num'=>1],
|
|
|
+ ['gift_id'=>2,'num'=>1],
|
|
|
+ ['gift_id'=>8,'num'=>1]
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ if($charge_type == 'YEAR_ORDER'){
|
|
|
+ $gift = [
|
|
|
+ ['gift_id'=>1,'num'=>2],
|
|
|
+ ['gift_id'=>2,'num'=>2],
|
|
|
+ ['gift_id'=>3,'num'=>2],
|
|
|
+ ['gift_id'=>6,'num'=>2],
|
|
|
+ ['gift_id'=>7,'num'=>2],
|
|
|
+ ['gift_id'=>8,'num'=>2]
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ if($gift){
|
|
|
+ UserGiftService::addGift($uid,$gift);
|
|
|
+ }
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+
|
|
|
+ return ;
|
|
|
+ }
|
|
|
}
|