Tree 2 hónapja
szülő
commit
4abee95d98

+ 9 - 7
app/Http/Controllers/Admin/RechargeController.php

@@ -830,6 +830,8 @@ class RechargeController extends Controller
     {
         $res = (new RechargeLogic())->gear_list();
 
+//        dd($res);
+
         return view('admin.recharge.gear_list', $res);
     }
 
@@ -851,11 +853,11 @@ class RechargeController extends Controller
     {
         $list = DB::table('agent.dbo.admin_configs')->where('type', 'pay')->pluck('name', 'id');
         if ($request->method() == 'POST') {
-            $money = (int)$request->money ?: '';
+            $money = (float)$request->money ?: '';
             $status = $request->status;
             $config_ids = $request->config_ids;
-            $favorable_price = (int)$request->favorable_price;
-            $give = (int)$request->give;
+            $favorable_price = (float)$request->favorable_price;
+            $give = (float)$request->give;
             $logic = new RechargeLogic();
             $res = $logic->add($money, $status, $config_ids, $favorable_price, $give);
             return apiReturnSuc();
@@ -866,10 +868,10 @@ class RechargeController extends Controller
     public function update_config(Request $request, $id)
     {
         if ($request->isMethod('post')) {
-            $money = (int)$request->money ?: '';
-            $favorable_price = (int)$request->favorable_price;
-            $give = (int)$request->give;
-            $second_give = (int)$request->second_give;
+            $money = (float)($request->money ?: '');
+            $favorable_price = (float)($request->favorable_price ?: 0);
+            $give = (float)($request->give ?: 0);
+            $second_give = (int)($request->second_give ?: 0);
             $data = [
                 'money' => $money,
                 'favorable_price' => $favorable_price,

+ 43 - 36
app/Http/logic/admin/RechargeLogic.php

@@ -146,42 +146,49 @@ class RechargeLogic extends BaseApiLogic
         }
 
 
-        // 首充档位配置
-        $first_pay = DB::table('agent.dbo.recharge_gear')
-            ->where('first_pay', 1)
-            ->first();
-        $name = [];
-        if (!empty($first_pay->gear)) {
-            $gear = \GuzzleHttp\json_decode($first_pay->gear, true);
-            foreach ($gear as $val) {
-                if ($val['status'] == 1) {
-                    $name[] = isset($names[$val['id']]) ? $names[$val['id']] : '';
-                }
-            }
-        }
+        // dd($list);
+
+        // // 首充档位配置
+        // $first_pay = DB::table('agent.dbo.recharge_gear')
+        //     ->where('first_pay', 1)
+        //     ->first();
+        // $name = [];
+        // if (!empty($first_pay->gear)) {
+        //     $gear = \GuzzleHttp\json_decode($first_pay->gear, true);
+        //     foreach ($gear as $val) {
+        //         if ($val['status'] == 1) {
+        //             $name[] = isset($names[$val['id']]) ? $names[$val['id']] : '';
+        //         }
+        //     }
+        // }
+
+        // $first_pay->gear = implode(',', $name);
+
+        $first_pay = [];
+        $RecomendarRecharge = [];
+        $monthCard = [];
 
-        $first_pay->gear = implode(',', $name);
 
         // 推荐充值档位
-        $RecomendarRecharge = DB::table(TableName::QPAccountsDB() . 'SystemStatusInfo')
-            ->where('StatusName', 'RecomendarRecharge')
-            ->value('StatusValue');
-        // 周卡
-        $channels = DB::table('agent.dbo.admin_configs')->where([
-            'type' => 'pay',
-        ])->pluck('id', 'name')->toArray();
-        $monthCard = MonthCard::query()->where('CardType', 1)->get();
-        foreach ($monthCard as $k => $v) {
-            $monthCard[$k]->FirstReward = $v->FirstReward/100;
-            $monthCard[$k]->DayReward = $v->DayReward/100;
-            $cardChannels = array_filter($v->gear, function ($item) {
-                return $item['status'] == 1;
-            });
-            $ids = array_column($cardChannels, 'id');
-            $v['channels'] = array_filter($channels, function ($item) use ($ids) {
-                return in_array($item, $ids);
-            });
-        }
+        // $RecomendarRecharge = DB::table(TableName::QPAccountsDB() . 'SystemStatusInfo')
+        //     ->where('StatusName', 'RecomendarRecharge')
+        //     ->value('StatusValue');
+        // // 周卡
+        // $channels = DB::table('agent.dbo.admin_configs')->where([
+        //     'type' => 'pay',
+        // ])->pluck('id', 'name')->toArray();
+        // $monthCard = MonthCard::query()->where('CardType', 1)->get();
+        // foreach ($monthCard as $k => $v) {
+        //     $monthCard[$k]->FirstReward = $v->FirstReward/100;
+        //     $monthCard[$k]->DayReward = $v->DayReward/100;
+        //     $cardChannels = array_filter($v->gear, function ($item) {
+        //         return $item['status'] == 1;
+        //     });
+        //     $ids = array_column($cardChannels, 'id');
+        //     $v['channels'] = array_filter($channels, function ($item) use ($ids) {
+        //         return in_array($item, $ids);
+        //     });
+        // }
 
         return compact('list', 'first_pay', 'RecomendarRecharge', 'monthCard');
     }
@@ -256,12 +263,12 @@ class RechargeLogic extends BaseApiLogic
             }
         }
         $add_data = [
-            'money' => $money,
+            'money' => round($money, 2),
             'status' => $status,
             'gear' => \GuzzleHttp\json_encode($data),
             'created_at' => date('Y-m-d H:i:s'),
-            'favorable_price' => $favorable_price,
-            'give' => $give
+            'favorable_price' => round($favorable_price, 2),
+            'give' => round($give, 2)
         ];
 
         DB::table('agent.dbo.recharge_gear')->insert($add_data);

+ 3 - 3
resources/views/admin/recharge/add.blade.php

@@ -13,15 +13,15 @@
 
                                 <div class="form-group">
                                     <label for="nickname">*咖啡金额</label>
-                                    <input type="text"  class="form-control required" name="money" placeholder="{{ __('auto.请输入咖啡金额') }}">
+                                    <input type="number" step="0.01" class="form-control required" name="money" placeholder="{{ __('auto.请输入咖啡金额') }}">
                                 </div>
                                 <div class="form-group">
                                     <label for="nickname">*咖啡档位(优惠价)</label>
-                                    <input type="text"  class="form-control required" name="favorable_price" placeholder="{{ __('auto.请输入咖啡档位') }}">
+                                    <input type="number" step="0.01" class="form-control required" name="favorable_price" placeholder="{{ __('auto.请输入咖啡档位') }}">
                                 </div>
                                 <div class="form-group">
                                     <label for="nickname">*咖啡档位(赠送彩金)</label>
-                                    <input type="text"  class="form-control required" name="give" placeholder="{{ __('auto.请输入咖啡档位') }}" value="0">
+                                    <input type="number" step="0.01" class="form-control required" name="give" placeholder="{{ __('auto.请输入咖啡档位') }}" value="0">
                                 </div>
 
                                 <div class="form-group">

+ 3 - 3
resources/views/admin/recharge/update_config.blade.php

@@ -15,15 +15,15 @@
 
                                 <div class="form-group">
                                     <label for="nickname">*充值金额</label>
-                                    <input type="text"  class="form-control required" name="money" placeholder="{{ __('auto.请输入充值金额') }}" value="{{$info->money}}">
+                                    <input type="number" step="0.01" class="form-control required" name="money" placeholder="{{ __('auto.请输入充值金额') }}" value="{{$info->money}}">
                                 </div>
                                 <div class="form-group">
                                     <label for="nickname">*充值档位(优惠价)</label>
-                                    <input type="text"  class="form-control required" name="favorable_price" placeholder="{{ __('auto.请输入充值档位') }}" value="{{$info->favorable_price}}">
+                                    <input type="number" step="0.01" class="form-control required" name="favorable_price" placeholder="{{ __('auto.请输入充值档位') }}" value="{{$info->favorable_price}}">
                                 </div>
                                 <div class="form-group">
                                     <label for="nickname">*充值档位(赠送彩金)</label>
-                                    <input type="text"  class="form-control required" name="give" placeholder="{{ __('auto.请输入充值档位') }}" value="{{$info->give}}">
+                                    <input type="number" step="0.01" class="form-control required" name="give" placeholder="{{ __('auto.请输入充值档位') }}" value="{{$info->give}}">
                                 </div>
 
                                 <div class="form-group">