|
|
@@ -82,6 +82,24 @@ class OrderServices
|
|
|
]);
|
|
|
}
|
|
|
}
|
|
|
+ }if ($GiftsID == 302) { // 破产礼包
|
|
|
+ // 首次购买首充礼包,走赠送逻辑(立即获得bonus_instantly%)
|
|
|
+ $Gifts = DB::connection('write')->table('agent.dbo.recharge_gift')->where('gift_id', $GiftsID)->where('recommend', $payAmt)->first();
|
|
|
+ if($Gifts){
|
|
|
+ $favorable_price = round($Gifts->bonus_instantly*$payAmt/100,2);
|
|
|
+ $give = $favorable_price-$payAmt;
|
|
|
+ $Recharge = $payAmt;
|
|
|
+ $czReason = 50;
|
|
|
+ $cjReason = 51;
|
|
|
+ }else{
|
|
|
+ $Recharge = $payAmt;
|
|
|
+ $give = 0;
|
|
|
+ $favorable_price = $Recharge + $give;
|
|
|
+ $czReason = 1;
|
|
|
+ $cjReason = 45;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}else if ($GiftsID > 400) {
|
|
|
$Status = 1;
|
|
|
$recharge_gear = DB::connection('write')->table('agent.dbo.recharge_gear')->where('status', $Status)->where('money', $payAmt)->select('favorable_price', 'give')->first();
|
|
|
@@ -198,50 +216,7 @@ class OrderServices
|
|
|
|
|
|
|
|
|
if ($payAmt > 0) {
|
|
|
- try {
|
|
|
- $userInfo = DB::table(TableName::QPAccountsDB() . 'AccountsInfo')
|
|
|
- ->where('UserID', $user_id)
|
|
|
- ->first();
|
|
|
- $channelConfig = DB::table('QPPlatformDB.dbo.ChannelPackageName')->where('Channel', $userInfo->Channel)->first();
|
|
|
-
|
|
|
-
|
|
|
-// Util::WriteLog('xxxxx', [$userInfo->Channel, $channelConfig, $query, $firstScore, $channelConfig->Rate > 0 && $channelConfig->ContrlScore > 0, $channelConfig->MinScore * NumConfig::NUM_VALUE > $firstScore]);
|
|
|
-
|
|
|
- if ($channelConfig && !$query && false) {
|
|
|
- if ($channelConfig->Rate > 0 && $channelConfig->ContrlScore > 0) {
|
|
|
- if ($channelConfig->MinScore * NumConfig::NUM_VALUE >= $firstScore) {
|
|
|
- $openGames = config('games.openKGame');
|
|
|
- $query = DB::table('QPTreasureDB.dbo.UserScoreControl')->where('UserID', $user_id)->first();
|
|
|
- if (!$query) {
|
|
|
- $build_sql = DB::connection('write')->table('QPTreasureDB.dbo.UserScoreControl');
|
|
|
- //Util::WriteLog('control_old_user',$list);
|
|
|
- $data = [
|
|
|
- 'ControlScore' => (int)($channelConfig->ContrlScore * NumConfig::NUM_VALUE),
|
|
|
- 'EffectiveScore' => 0,
|
|
|
- 'ControlKindID' => -1,
|
|
|
- 'Remarks' => '',
|
|
|
- 'InsertDate' => date('Y-m-d H:i:s'),
|
|
|
- 'ControlRadian' => 0
|
|
|
- ];
|
|
|
- $build_sql->updateOrInsert(['UserID' => $user_id], $data);
|
|
|
-
|
|
|
- foreach ($openGames as $GameID) {
|
|
|
- $KindData = [
|
|
|
- 'UserID' => $user_id,
|
|
|
- 'KindID' => $GameID,
|
|
|
- 'ControlRadian' => $channelConfig->Rate,
|
|
|
- 'ControlDate' => date('Y-m-d H:i:s')
|
|
|
- ];
|
|
|
- DB::connection('write')->table('QPTreasureDB.dbo.UserControlKind')->updateOrInsert(['UserID' => $user_id, 'KindID' => $GameID], $KindData);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- } catch (\Exception $exception) {
|
|
|
|
|
|
- }
|
|
|
// 记录订单变化后金币
|
|
|
DB::connection('write')->table('agent.dbo.order')
|
|
|
->where('order_sn', $order_sn)
|
|
|
@@ -264,37 +239,37 @@ class OrderServices
|
|
|
|
|
|
|
|
|
// 周卡 -- 执行存储过程
|
|
|
- if (isset($GiftsID) && $GiftsID > 100 && $GiftsID < 200) {
|
|
|
- $CardID = (int)$GiftsID - 100;
|
|
|
- StoredProcedure::BuyMonthCard($user_id, $CardID, $order_sn);
|
|
|
- // 开始执行时间
|
|
|
- $startTime = Helper::millisecond();
|
|
|
- Log::info('GSP_GP_BuyMonthCard 执行时间:' . ((Helper::millisecond() - $startTime) / 1000));
|
|
|
- }
|
|
|
+// if (isset($GiftsID) && $GiftsID > 100 && $GiftsID < 200) {
|
|
|
+// $CardID = (int)$GiftsID - 100;
|
|
|
+// StoredProcedure::BuyMonthCard($user_id, $CardID, $order_sn);
|
|
|
+// // 开始执行时间
|
|
|
+// $startTime = Helper::millisecond();
|
|
|
+// Log::info('GSP_GP_BuyMonthCard 执行时间:' . ((Helper::millisecond() - $startTime) / 1000));
|
|
|
+// }
|
|
|
|
|
|
|
|
|
//设置第二天要领取
|
|
|
- if (isset($GiftsID) && $GiftsID >= 200 && $GiftsID < 300 ) {
|
|
|
- $first = DB::table('agent.dbo.recharge_gear')->where('gift_id', $GiftsID)->select('gift_id', 'money', 'give', 'favorable_price', 'second_give')->first();
|
|
|
- if ($first && $first->second_give > 0) {
|
|
|
- $fpkey = 'Firstpay_' . $user_id;
|
|
|
- $data = (array)$first;
|
|
|
- $data['buytime'] = time();
|
|
|
- $data['czReason'] = $czReason;
|
|
|
- $data['cjReason'] = $cjReason;
|
|
|
- Redis::set($fpkey, json_encode($data));
|
|
|
- DB::table(TableName::agent() . 'guide_payment')->updateOrInsert([
|
|
|
- 'UserID' => $user_id,
|
|
|
- 'GiftID' => $GiftsID,
|
|
|
- 'CreateTime' => now()
|
|
|
- ], ['UserID' => $user_id]);
|
|
|
- }
|
|
|
- }
|
|
|
+// if (isset($GiftsID) && $GiftsID >= 200 && $GiftsID < 300 ) {
|
|
|
+// $first = DB::table('agent.dbo.recharge_gear')->where('gift_id', $GiftsID)->select('gift_id', 'money', 'give', 'favorable_price', 'second_give')->first();
|
|
|
+// if ($first && $first->second_give > 0) {
|
|
|
+// $fpkey = 'Firstpay_' . $user_id;
|
|
|
+// $data = (array)$first;
|
|
|
+// $data['buytime'] = time();
|
|
|
+// $data['czReason'] = $czReason;
|
|
|
+// $data['cjReason'] = $cjReason;
|
|
|
+// Redis::set($fpkey, json_encode($data));
|
|
|
+// DB::table(TableName::agent() . 'guide_payment')->updateOrInsert([
|
|
|
+// 'UserID' => $user_id,
|
|
|
+// 'GiftID' => $GiftsID,
|
|
|
+// 'CreateTime' => now()
|
|
|
+// ], ['UserID' => $user_id]);
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
//设置第二天要领取
|
|
|
- if (!empty($GiftsID) && $GiftsID >= 300 && $GiftsID < 400 ) {
|
|
|
- Redis::del('repay_temp_'.$user_id);
|
|
|
- }
|
|
|
+// if (!empty($GiftsID) && $GiftsID >= 300 && $GiftsID < 400 ) {
|
|
|
+// Redis::del('repay_temp_'.$user_id);
|
|
|
+// }
|
|
|
|
|
|
// 数据统计后台 -- 充值记录添加
|
|
|
(new RechargeWithDraw())->recharge($user_id, $payAmt);
|