Kirin 3 yıl önce
ebeveyn
işleme
eae76c475b
1 değiştirilmiş dosya ile 251 ekleme ve 260 silme
  1. 251 260
      application/api/controller/Index.php

+ 251 - 260
application/api/controller/Index.php

@@ -26,6 +26,7 @@ use think\Exception;
 use think\exception\DbException;
 use app\api\library\Retail;
 use think\Validate;
+
 /**
  * 首页接口
  */
@@ -33,7 +34,7 @@ class Index extends Api
 {
     protected $noNeedLogin = ['baseInfo', 'newestOpen', 'hotBox', 'cheapBox', 'recommend', 'categoryList',
         'boxList', 'boxListByCategory', 'boxDetail', 'boxOpenRecord', 'tryBoxDetail', 'priceRange', 'rechargeList', 'getServiceInfo',
-        'getWechatLoginUrl', "getVirData", "sumUv", "getServiceurl","lunbobox",'boximages'];
+        'getWechatLoginUrl', "getVirData", "sumUv", "getServiceurl", "lunbobox", 'boximages'];
 
     protected $noNeedRight = ['*'];
 
@@ -43,37 +44,38 @@ class Index extends Api
     public function sumUv()
     {
         $ip = request()->ip();
-        $check = db("uv")->where(['ip'=>$ip])->whereTime("createtime", "today")->find();
-        if(empty($check)){
-            db("uv")->insert(['ip'=>$ip,"createtime"=>time()]);
+        $check = db("uv")->where(['ip' => $ip])->whereTime("createtime", "today")->find();
+        if (empty($check)) {
+            db("uv")->insert(['ip' => $ip, "createtime" => time()]);
         }
         $this->success("记录成功");
     }
 
     /**
-    *获取开盒假数据
-    */
+     *获取开盒假数据
+     */
     public function getVirData()
     {
-        $page = request()->param("page")??1;
-        $limit = request()->param("limit")??10;
+        $page = request()->param("page") ?? 1;
+        $limit = request()->param("limit") ?? 10;
         $domain = request()->domain();
-        $list = db("virtuial")->alias("a")->join("goods b","b.id = a.goods_id")->order("a.add_time desc")->field("a.*,FROM_UNIXTIME(a.add_time,'%Y-%m-%d %H:%i') createtime,b.goods_name, b.image,b.coin_price price")->page($page, $limit)->select();
-        foreach($list as $k=>$v){
-            $list[$k]['avatar'] = $domain.$v['avatar'];
-        //$list[$k]['image'] = $domain.$v['image'];
-             $list[$k]['image'] = $v['image'];
+        $list = db("virtuial")->alias("a")->join("goods b", "b.id = a.goods_id")->order("a.add_time desc")->field("a.*,FROM_UNIXTIME(a.add_time,'%Y-%m-%d %H:%i') createtime,b.goods_name, b.image,b.coin_price price")->page($page, $limit)->select();
+        foreach ($list as $k => $v) {
+            $list[$k]['avatar'] = $domain . $v['avatar'];
+            //$list[$k]['image'] = $domain.$v['image'];
+            $list[$k]['image'] = $v['image'];
         }
         $total = db("virtuial")->order("add_time desc")->count();
-        
-      // print_r($list);die;
-        $this->success("获取成功", ["list"=>$list,"total"=>$total]);
+
+        // print_r($list);die;
+        $this->success("获取成功", ["list" => $list, "total" => $total]);
     }
 
-  public function lunbobox(){
-        
-       
-       $status = 1;
+    public function lunbobox()
+    {
+
+
+        $status = 1;
         $pagesize = input('pagesize/d', 10);
         $page = input('page/d', 1);
         $statusList = [1 => 'bag', 2 => 'exchange'];
@@ -97,9 +99,9 @@ class Index extends Api
             ->order($order)
             ->limit(20)
             ->select();
-     
-          $this->success('查询成功', $list);
-      
+
+        $this->success('查询成功', $list);
+
     }
 
     /**
@@ -130,10 +132,7 @@ class Index extends Api
     }
 
 
-
-
-
-  public function sList()
+    public function sList()
     {
         $status = input('status/d');
         $pagesize = input('pagesize/d', 10);
@@ -151,139 +150,121 @@ class Index extends Api
         }
 
 
-  $order= Db::table('box_shai')->where('switch','1') ->order('create_time', 'desc')->limit(($page-1)*$pagesize,$pagesize)->select();
-      
+        $order = Db::table('box_shai')->where('switch', '1')->order('create_time', 'desc')->limit(($page - 1) * $pagesize, $pagesize)->select();
 
 
         $list2 = array(
-            
-            'id'=>1,
-             'stx'=>'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic3.zhimg.com%2F50%2Fv2-6f1c492cbdfe3c24aae44e935a796d5a_hd.jpg&refer=http%3A%2F%2Fpic3.zhimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1632275904&t=20baefb74a9f7b152b601ec58726f1e7',
-            
-            
-          
-             'smc'=>'这个是名称',
-             'ssj'=>'前天',
-             'szw'=>'这个盲盒很好玩,我很喜欢,我也介绍了很多人过来完',
-             'simg'=>array(
-                 
-                 'https://img.alicdn.com/imgextra/i4/0/O1CN01CHW9ak1RdPu9Vg1r6_!!0-rate.jpg_400x400.jpg',
-                 'https://img.alicdn.com/imgextra/i4/0/O1CN01CHW9ak1RdPu9Vg1r6_!!0-rate.jpg_400x400.jpg',
-                 'https://img.alicdn.com/imgextra/i4/0/O1CN01CHW9ak1RdPu9Vg1r6_!!0-rate.jpg_400x400.jpg',
-                 'https://img.alicdn.com/imgextra/i4/0/O1CN01CHW9ak1RdPu9Vg1r6_!!0-rate.jpg_400x400.jpg',
-                 'https://img.alicdn.com/imgextra/i4/0/O1CN01CHW9ak1RdPu9Vg1r6_!!0-rate.jpg_400x400.jpg',
-                 'https://img.alicdn.com/imgextra/i4/0/O1CN01CHW9ak1RdPu9Vg1r6_!!0-rate.jpg_400x400.jpg',
-                 'https://img.alicdn.com/imgextra/i4/0/O1CN01CHW9ak1RdPu9Vg1r6_!!0-rate.jpg_400x400.jpg',
-                 'https://img.alicdn.com/imgextra/i4/0/O1CN01CHW9ak1RdPu9Vg1r6_!!0-rate.jpg_400x400.jpg',
-                 'https://img.alicdn.com/imgextra/i4/0/O1CN01CHW9ak1RdPu9Vg1r6_!!0-rate.jpg_400x400.jpg',
-                
-                 
-                 )
-            );
-          
-            
-          /*  ->each(function ($item) use ($status) {
-                $item->goods_image = $item->goods_image ? cdnurl($item->goods_image, true) : '';
 
-                $item->box_coin_price = intval($item->box_coin_price);
-                $item->box_rmb_price = floatval($item->box_rmb_price);
+            'id' => 1,
+            'stx' => 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic3.zhimg.com%2F50%2Fv2-6f1c492cbdfe3c24aae44e935a796d5a_hd.jpg&refer=http%3A%2F%2Fpic3.zhimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1632275904&t=20baefb74a9f7b152b601ec58726f1e7',
 
-                if ('exchange' == $status) {
-                    $item->time = date('Y-m-d H:i:s', $item->exchange_time);
-                } else {
-                    $item->time = date('Y-m-d H:i:s', $item->create_time);
-                }
-                $item->hidden(['create_time', 'exchange_time']);
-            });
+
+            'smc' => '这个是名称',
+            'ssj' => '前天',
+            'szw' => '这个盲盒很好玩,我很喜欢,我也介绍了很多人过来完',
+            'simg' => array(
+
+                'https://img.alicdn.com/imgextra/i4/0/O1CN01CHW9ak1RdPu9Vg1r6_!!0-rate.jpg_400x400.jpg',
+                'https://img.alicdn.com/imgextra/i4/0/O1CN01CHW9ak1RdPu9Vg1r6_!!0-rate.jpg_400x400.jpg',
+                'https://img.alicdn.com/imgextra/i4/0/O1CN01CHW9ak1RdPu9Vg1r6_!!0-rate.jpg_400x400.jpg',
+                'https://img.alicdn.com/imgextra/i4/0/O1CN01CHW9ak1RdPu9Vg1r6_!!0-rate.jpg_400x400.jpg',
+                'https://img.alicdn.com/imgextra/i4/0/O1CN01CHW9ak1RdPu9Vg1r6_!!0-rate.jpg_400x400.jpg',
+                'https://img.alicdn.com/imgextra/i4/0/O1CN01CHW9ak1RdPu9Vg1r6_!!0-rate.jpg_400x400.jpg',
+                'https://img.alicdn.com/imgextra/i4/0/O1CN01CHW9ak1RdPu9Vg1r6_!!0-rate.jpg_400x400.jpg',
+                'https://img.alicdn.com/imgextra/i4/0/O1CN01CHW9ak1RdPu9Vg1r6_!!0-rate.jpg_400x400.jpg',
+                'https://img.alicdn.com/imgextra/i4/0/O1CN01CHW9ak1RdPu9Vg1r6_!!0-rate.jpg_400x400.jpg',
+
+
+            )
+        );
+
+
+        /*  ->each(function ($item) use ($status) {
+              $item->goods_image = $item->goods_image ? cdnurl($item->goods_image, true) : '';
+
+              $item->box_coin_price = intval($item->box_coin_price);
+              $item->box_rmb_price = floatval($item->box_rmb_price);
+
+              if ('exchange' == $status) {
+                  $item->time = date('Y-m-d H:i:s', $item->exchange_time);
+              } else {
+                  $item->time = date('Y-m-d H:i:s', $item->create_time);
+              }
+              $item->hidden(['create_time', 'exchange_time']);
+          });
 */
 
 //print_r($list);
 //exit;
 
-$ym='https://'. $_SERVER['HTTP_HOST'];
-foreach ($order as $k=>$v){
-    
-    
-   
-    
-    //  $order[$k]['box_tx']=$ym.$v['box_tx'];
-    $order[$k]['box_img']=explode(',',$v['box_img']);
-    
-    // foreach ($order[$k]['box_img'] as $k2=>$v2){
-        
-    //      $order[$k]['box_img'][$k2]=$ym.$v2;
-        
-        
-    // }
-    
-    
-    if(time()-$v['create_time']<60*60){
-        
-        
-        $t=round((time()-$v['create_time'])/60);
-        
-        
-        if($t==0){$t=1;}
-        
-        $order[$k]['box_sj']=$t.'分钟前';
-        
-    }
-    
-      else if (time()-$v['create_time']>60*60&&time()-$v['create_time']<60*60*24){
-        
-      $t=round((time()-$v['create_time'])/60/60);
-        $order[$k]['box_sj']=$t.'小时前';   
-        
-        
-    }
-    
-    
-    else if (time()-$v['create_time']>60*60*24&&time()-$v['create_time']<60*60*24*7){
-        
-      $t=round((time()-$v['create_time'])/60/60/24);
-        $order[$k]['box_sj']=$t.'天前';   
-        
-        
-    }
-    
-     else if (time()-$v['create_time']>60*60*24*7){
-        
-      $t=round((time()-$v['create_time'])/60/60/24/7);
-        $order[$k]['box_sj']=$t.'周前';   
-        
-        
-    }
-    
-    
-}
-//print_r($order);
+        $ym = 'https://' . $_SERVER['HTTP_HOST'];
+        foreach ($order as $k => $v) {
 
-$list=array(
-    
-    
-    'data'=> $order
-   );
 
+            //  $order[$k]['box_tx']=$ym.$v['box_tx'];
+            $order[$k]['box_img'] = explode(',', $v['box_img']);
 
-//$list=$order;
-foreach ($list as $k=>$v){
-    
-    
-  //  print_r($v);
-    
-}
-        $this->success('查询成功', $list);
-    }
+            // foreach ($order[$k]['box_img'] as $k2=>$v2){
+
+            //      $order[$k]['box_img'][$k2]=$ym.$v2;
+
+
+            // }
+
+
+            if (time() - $v['create_time'] < 60 * 60) {
+
+
+                $t = round((time() - $v['create_time']) / 60);
+
+
+                if ($t == 0) {
+                    $t = 1;
+                }
+
+                $order[$k]['box_sj'] = $t . '分钟前';
 
+            } else if (time() - $v['create_time'] > 60 * 60 && time() - $v['create_time'] < 60 * 60 * 24) {
 
+                $t = round((time() - $v['create_time']) / 60 / 60);
+                $order[$k]['box_sj'] = $t . '小时前';
 
 
+            } else if (time() - $v['create_time'] > 60 * 60 * 24 && time() - $v['create_time'] < 60 * 60 * 24 * 7) {
 
+                $t = round((time() - $v['create_time']) / 60 / 60 / 24);
+                $order[$k]['box_sj'] = $t . '天前';
 
 
+            } else if (time() - $v['create_time'] > 60 * 60 * 24 * 7) {
 
+                $t = round((time() - $v['create_time']) / 60 / 60 / 24 / 7);
+                $order[$k]['box_sj'] = $t . '周前';
 
 
+            }
+
+
+        }
+//print_r($order);
+
+        $list = array(
+
+
+            'data' => $order
+        );
+
+
+//$list=$order;
+        foreach ($list as $k => $v) {
+
+
+            //  print_r($v);
+
+        }
+        $this->success('查询成功', $list);
+    }
+
 
     /**
      * 最新开箱的盲盒列表
@@ -293,13 +274,13 @@ foreach ($list as $k=>$v){
     {
         // 查询数量
         $limit = 5;
-        
+
         // 查询用户最新购买的100个盲盒ID
         $boxIds = Order::field('box_id')->order('id', 'desc')->limit(100)->column('box_id');
-       
-      //Array ( [0] => 36 [1] => 37 [2] => 38 [3] => 39 [4] => 40 [5] => 36 [6] => 36 [7] => 36 [8] => 36 [9] => 41 [10] => 39 [11] => 39 [12] => 36 [13] => 37 [14] => 41 [15] => 41 )
-      
-      
+
+        //Array ( [0] => 36 [1] => 37 [2] => 38 [3] => 39 [4] => 40 [5] => 36 [6] => 36 [7] => 36 [8] => 36 [9] => 41 [10] => 39 [11] => 39 [12] => 36 [13] => 37 [14] => 41 [15] => 41 )
+
+
         $boxIds = array_unique($boxIds);
 
         $boxAdd = [];
@@ -309,7 +290,7 @@ foreach ($list as $k=>$v){
         }
 //Array ( [0] => 36 [1] => 37 [2] => 38 [3] => 39 [4] => 40 [5] => 41 )
         $boxIds = array_merge($boxIds, $boxAdd);
- 
+
         // 查询空盲盒
         $existboxid = Detail::field('box_id')->distinct(true)->buildSql();
         $emptyBoxIds = Box::where('id', 'exp', 'not in ' . $existboxid)->column('id');
@@ -344,13 +325,12 @@ foreach ($list as $k=>$v){
 //print_r($list);die;
         $this->success('查询成功', $list);
     }
-        
-        
-        public function boximages()
+
+
+    public function boximages()
     {
         $box_id = input('box_id');
-        
-      
+
 
         $tagName = [
             'normal' => '普通',
@@ -358,12 +338,10 @@ foreach ($list as $k=>$v){
             'supreme' => '史诗',
             'legend' => '传说',
         ];
-              // $firstGoods =  db('box_detail')->where('box_id', 49)->find(); 
+        // $firstGoods =  db('box_detail')->where('box_id', 49)->find();
         // 查询商品id及概率
-      $detail = db('box_detail')->where('box_id', $box_id)->order('weigh', 'desc')->column('goods_id');
-      
-       
-   
+        $detail = db('box_detail')->where('box_id', $box_id)->order('weigh', 'desc')->column('goods_id');
+
 
         // 查询全部商品
         $moreGoods = db('goods')->field('image')
@@ -371,18 +349,17 @@ foreach ($list as $k=>$v){
             ->whereIn('id', $detail)
             ->select();
 
-       
 
         $ret = [
-           
+
             'goodsimagelist' => $moreGoods,
-            
+
         ];
 
 
         $this->success('查询成功', $ret);
     }
-        
+
     /**
      * 热门盲盒
      * @author fuyelk <fuyelk@fuyelk.com>
@@ -500,14 +477,14 @@ foreach ($list as $k=>$v){
             ->field('id box_id,box_name,coin_price,box_banner_images,box_foot_images')
             ->whereNotIn('id', $emptyBoxIds)
             ->order('sort', 'asc')
-            ->where("switch",1)
+            ->where("switch", 1)
             ->paginate($pagesize, false, ['page' => $page])
             ->each(function ($item) {
                 // 查询前6个商品图片
                 // $firstGoods = Detail::where('box_id', $item->box_id)->order('weigh', 'desc')->limit(6)->column('goods_id');
                 // $goods_images = Goods::whereIn('id', $firstGoods)->column('image');
-                $goods_images = Detail::alias('a')->join("goods b","b.id = a.goods_id")->where('a.box_id', $item->box_id)->order('a.weigh', 'desc')->limit(6)->column('b.image');
-               
+                $goods_images = Detail::alias('a')->join("goods b", "b.id = a.goods_id")->where('a.box_id', $item->box_id)->order('a.weigh', 'desc')->limit(6)->column('b.image');
+
                 foreach ($goods_images as &$image) {
                     $image = cdnurl($image, true);
                 }
@@ -523,6 +500,16 @@ foreach ($list as $k=>$v){
                 $item->price_max = round(Setting::getRmbFromCoin($max_coin_price ?: 0), 2);
 
                 $item->goods_images = $goods_images;
+                $box_banner_images = explode(',', $item->box_banner_images);
+                foreach ($box_banner_images as &$v) {
+                    $v = cdnurl($v, true);
+                }
+                $item->box_banner_images = $box_banner_images;
+                $box_foot_images = explode(',', $item->box_foot_images);
+                foreach ($box_foot_images as &$v) {
+                    $v = cdnurl($v, true);
+                }
+                $item->box_foot_images = $box_foot_images;
             });
 
         $this->success('查询成功', $list);
@@ -724,7 +711,7 @@ foreach ($list as $k=>$v){
             ->where($wherePrice)
             ->where($whereCategory)
             ->where($whereSearch)
-            ->where(['switch'=>1])
+            ->where(['switch' => 1])
             ->order($order)
             ->paginate($pagesize, false, ['page' => $page])
             ->each(function ($item) {
@@ -793,23 +780,23 @@ foreach ($list as $k=>$v){
         //     ->where('status', 'online')
         //     ->whereIn('id', array_slice(array_keys($detail), 0, 1000))
         //     ->select();
-            
-        $firstGoods =  Detail::alias("a")->join("goods b","b.id = a.goods_id")->where('a.box_id', $box_id)->field("b.image,b.xiangqing,b.coin_price,b.goods_name,b.tag")->order("a.weigh desc")->select();
-        
+
+        $firstGoods = Detail::alias("a")->join("goods b", "b.id = a.goods_id")->where('a.box_id', $box_id)->field("b.image,b.xiangqing,b.coin_price,b.goods_name,b.tag")->order("a.weigh desc")->select();
+
         foreach ($firstGoods as &$first) {
             $first->image = $first->image ? cdnurl($first->image, true) : $first->image;
             $first->tag = $tagName[$first->tag];
-             // $first->price = round(Setting::getRmbFromCoin($first->coin_price ?: 0), 2);
-          $first->price = $first->coin_price;
-          if (!empty($first->xiangqing)) {
-             if (strstr($first['xiangqing'],',')) {
-                $first['xiangqing'] = explode(',',$first['xiangqing']);
-                // var_dump($first);
-                // exit();
-               
-            }  
-          }
-          
+            // $first->price = round(Setting::getRmbFromCoin($first->coin_price ?: 0), 2);
+            $first->price = $first->coin_price;
+            if (!empty($first->xiangqing)) {
+                if (strstr($first['xiangqing'], ',')) {
+                    $first['xiangqing'] = explode(',', $first['xiangqing']);
+                    // var_dump($first);
+                    // exit();
+
+                }
+            }
+
             $first->hidden(['coin_price']);
         }
         // var_dump($first);exit();
@@ -831,10 +818,10 @@ foreach ($list as $k=>$v){
             $more->image = $more->image ? cdnurl($more->image, true) : $more->image;
             $more->tag = $tagName[$more->tag];
             $more->price = round(Setting::getRmbFromCoin($more->coin_price ?: 0), 2);
-           if (strstr($more->xiangqing,',')) {
-                $more->xiangqing = explode(',',$more->xiangqing);
-                
-            } 
+            if (strstr($more->xiangqing, ',')) {
+                $more->xiangqing = explode(',', $more->xiangqing);
+
+            }
             $more->hidden(['id,coin_price']);
         }
 
@@ -1138,8 +1125,8 @@ foreach ($list as $k=>$v){
         try {
             if (1 == $num) {
                 $goodsIds = [Detail::getOnes($box_id)];
-           
-                
+
+
             } else {
                 $goodsIds = Detail::getMores($box_id, $num);
             }
@@ -1245,7 +1232,8 @@ foreach ($list as $k=>$v){
 
         $this->success('创建订单成功', $ret);
     }
-  /**
+
+    /**
      * 创建充值订单
      * @author fuyelk <fuyelk@fuyelk.com>
      */
@@ -1375,26 +1363,26 @@ foreach ($list as $k=>$v){
                 'order_id' => $order->id,
                 'type' => 'pay_box', // 变更类型:pay_box=支付盲盒,recharge=充值,fromwallet=余额转入
             ]);
-                $users= Db::table('box_user') ->where('id',$this->auth->pid)->find();
-                
-                 $orderadd = Order::where('id', $order_id)->where('user_id', $this->auth->id)->find();
-                 $lou = Db::table('box_setting')->where('id', 1)->find();
-                 $kou = $lou['kou'];
-                    if($users['recharnum'] == 1){
-                        Db::table('box_user') ->where('id',$users['id'])->setInc("recharnum", 1);
-                     Retail::giveMoneys($orderadd);   
-                    
-                   }else{
-                       Db::table('box_user') ->where('id',$users['id'])->setInc("recharnum", 1);
-                       $userarr= Db::table('box_user') ->where('id',$users['id'])->find();
-                       if(bcmod($userarr['recharnum'],$kou) == 0){
-                       }else{
-                          Retail::giveMoneys($orderadd);
-                       };
-                   }
-               
+            $users = Db::table('box_user')->where('id', $this->auth->pid)->find();
+
+            $orderadd = Order::where('id', $order_id)->where('user_id', $this->auth->id)->find();
+            $lou = Db::table('box_setting')->where('id', 1)->find();
+            $kou = $lou['kou'];
+            if ($users['recharnum'] == 1) {
+                Db::table('box_user')->where('id', $users['id'])->setInc("recharnum", 1);
+                Retail::giveMoneys($orderadd);
+
+            } else {
+                Db::table('box_user')->where('id', $users['id'])->setInc("recharnum", 1);
+                $userarr = Db::table('box_user')->where('id', $users['id'])->find();
+                if (bcmod($userarr['recharnum'], $kou) == 0) {
+                } else {
+                    Retail::giveMoneys($orderadd);
+                };
+            }
+
             //      print_r(bcmod($users['recharnum'],$kou);
-                 
+
         } catch (\Exception $e) {
             Db::rollback();
             dta('用户支付失败,订单已回滚到待支付');
@@ -1408,10 +1396,9 @@ foreach ($list as $k=>$v){
 
         $this->success('支付成功', ['prize' => $prize]);
     }
-    
-    
-    
-      /**
+
+
+    /**
      * 余额支付
      * @author fuyelk <fuyelk@fuyelk.com>
      */
@@ -1451,36 +1438,36 @@ foreach ($list as $k=>$v){
             $user = $this->auth->getUser();
             $user->setDec('money', $order->rmb_amount);
 
-            
-             // 创建余额使用记录
+
+            // 创建余额使用记录
             MoneyRecord::create([
                 'user_id' => $this->auth->id,
                 'before' => $this->auth->money,
-                'after' => $this->auth->money-$order->rmb_amount,
+                'after' => $this->auth->money - $order->rmb_amount,
                 'money' => -$order->rmb_amount,
                 'order_id' => $order->id,
                 'type' => 'yezhifu', // 变更类型:box_exchange=盲盒回收,refund=库存不足,支付返回,withdrawal=提现,to_coin=转到钱包,withdrawal_fail=提现失败,yezhifu=余额支付
             ]);
-                // $users= Db::table('box_user') ->where('id',$this->auth->pid)->find();
-                
-                //  $orderadd = Order::where('id', $order_id)->where('user_id', $this->auth->id)->find();
-                //  $lou = Db::table('box_setting')->where('id', 1)->find();
-                //  $kou = $lou['kou'];
-                //     if($users['recharnum'] == 1){
-                //         Db::table('box_user') ->where('id',$users['id'])->setInc("recharnum", 1);
-                //      Retail::giveMoneys($orderadd);   
-                    
-                //   }else{
-                //       Db::table('box_user') ->where('id',$users['id'])->setInc("recharnum", 1);
-                //       $userarr= Db::table('box_user') ->where('id',$users['id'])->find();
-                //     //   if(bcmod($userarr['recharnum'],$kou) == 0){
-                //     //   }else{
-                //     //       Retail::giveMoneys($orderadd);
-                //     //   };
-                //   }
-               
+            // $users= Db::table('box_user') ->where('id',$this->auth->pid)->find();
+
+            //  $orderadd = Order::where('id', $order_id)->where('user_id', $this->auth->id)->find();
+            //  $lou = Db::table('box_setting')->where('id', 1)->find();
+            //  $kou = $lou['kou'];
+            //     if($users['recharnum'] == 1){
+            //         Db::table('box_user') ->where('id',$users['id'])->setInc("recharnum", 1);
+            //      Retail::giveMoneys($orderadd);
+
+            //   }else{
+            //       Db::table('box_user') ->where('id',$users['id'])->setInc("recharnum", 1);
+            //       $userarr= Db::table('box_user') ->where('id',$users['id'])->find();
+            //     //   if(bcmod($userarr['recharnum'],$kou) == 0){
+            //     //   }else{
+            //     //       Retail::giveMoneys($orderadd);
+            //     //   };
+            //   }
+
             //      print_r(bcmod($users['recharnum'],$kou);
-                 
+
         } catch (\Exception $e) {
             Db::rollback();
             dta('用户支付失败,订单已回滚到待支付');
@@ -1561,8 +1548,8 @@ foreach ($list as $k=>$v){
             // 抽奖 begin
             if (1 == $order->num) {
                 $goodsIds = [Detail::getOne($order->box_id)];
-                
-              
+
+
             } else {
                 $goodsIds = Detail::getMore($order->box_id, $order->num);
             }
@@ -1809,22 +1796,24 @@ foreach ($list as $k=>$v){
         ];
         $this->success('查询成功', $ret);
     }
-      /**
+
+    /**
      * 获取落地域名
      * @author fuyelk <fuyelk@fuyelk.com>
      */
     public function getServiceurl()
     {
-       $ret = Setting::where('id',1)->find();
+        $ret = Setting::where('id', 1)->find();
         // $curl = Setting::getSetting('curl');
         // $abs  = explode('|',$curl);
         // $ret = [
         //     'url' => Setting::getSetting('url')
         // ];
-        
-       
+
+
         $this->success('查询成功', $ret['url']);
     }
+
     /**
      * 获取微信登录地址
      * @author fuyelk <fuyelk@fuyelk.com>
@@ -1844,37 +1833,39 @@ foreach ($list as $k=>$v){
 
         $this->success('查询成功', $ret);
     }
+
     /**
      * 添加晒图
      */
-    public function setShai(){
+    public function setShai()
+    {
         $validate = new \think\Validate([
-			'box_zw' => 'require',
-			'box_img' => 'require',
-			'token' => 'require',
-		]);
-		$validate->message([
-			'box_zw.require' => '盲盒详情banner文字不能为空',
-			'box_img.require' => '盲盒详情banner不能为空',
-			'token.require' => 'token不能为空',
-		]);
-		$data = $this->request->param();
-		if (!$validate->check($data)) {
-			$this->error($validate->getError());
-		}
-		
-       
-         $params = [
-                'box_mc'=>$this->auth->nickname,
-                'box_tx'=>$this->auth->avatar ? cdnurl($this->auth->avatar, true) : '',
-                'box_zw'=>$data['box_zw'],
-                'box_img'=>$data['box_img'],
-                'create_time'=>time()
-             ];
-          
-              Db::table('box_shai')->insertGetId($params);
-               $this->success();
+            'box_zw' => 'require',
+            'box_img' => 'require',
+            'token' => 'require',
+        ]);
+        $validate->message([
+            'box_zw.require' => '盲盒详情banner文字不能为空',
+            'box_img.require' => '盲盒详情banner不能为空',
+            'token.require' => 'token不能为空',
+        ]);
+        $data = $this->request->param();
+        if (!$validate->check($data)) {
+            $this->error($validate->getError());
+        }
+
+
+        $params = [
+            'box_mc' => $this->auth->nickname,
+            'box_tx' => $this->auth->avatar ? cdnurl($this->auth->avatar, true) : '',
+            'box_zw' => $data['box_zw'],
+            'box_img' => $data['box_img'],
+            'create_time' => time()
+        ];
+
+        Db::table('box_shai')->insertGetId($params);
+        $this->success();
     }
-  
+
 
 }