Jelajahi Sumber

开箱子的配置

lizhen_gitee 1 tahun lalu
induk
melakukan
df85c28026
1 mengubah file dengan 6 tambahan dan 29 penghapusan
  1. 6 29
      application/api/controller/Eggnew.php

+ 6 - 29
application/api/controller/Eggnew.php

@@ -56,10 +56,11 @@ class Eggnew extends Api
         if($num <=0) {
             $this->error("参数错误");
         }
-        $total_jewel = $this->times_jewel($num);
-        if($total_jewel == false){
+        $total_jewel = Db::name('egg_timesprice')->where('type',$type)->where('times',$num)->find();
+        if(empty($total_jewel)){
             $this->error('错误的次数');
         }
+        $total_jewel = $total_jewel['price'];
 
         $giftdata = [];
         $user_id = $this->auth->id;
@@ -346,42 +347,18 @@ class Eggnew extends Api
         $this->success("获取成功!",$ranklist);
     }
 
-    private function times_jewel($times = 0){
-        $pay_config = [
-            1 => 20,
-            10 => 200,
-            100 => 2000,
-        ];
-        $jewel = isset($pay_config[$times]) ? $pay_config[$times] : false;
-        return $jewel;
-    }
-
     /**
      * 获取砸蛋基本信息
      */
     public function getBaseInfo() {
-        $user_id = $this->auth->id;
+        $type = input('type',1);
 
         // 构建数据
         $data = [];
         $data["jewel"] = $this->auth->jewel;
         $data["playdetail"] = config("site.playdetail");
-        $data["egggift_content"] = config("site.egggift_content");
-
-        $data['pay_config'] = [
-            [
-                'times'=>1,
-                'price'=>20,
-            ],
-            [
-                'times'=>10,
-                'price'=>200,
-            ],
-            [
-                'times'=>100,
-                'price'=>2000,
-            ],
-        ];
+
+        $data['pay_config'] = Db::name('egg_timesprice')->field('times,price')->where('type',$type)->order('times asc')->select();
         $this->success("获取成功!",$data);
     }
 }