Quellcode durchsuchen

送礼物,减少字段查询

lizhen_gitee vor 1 Jahr
Ursprung
Commit
0fd1d79229
1 geänderte Dateien mit 4 neuen und 4 gelöschten Zeilen
  1. 4 4
      application/api/controller/Party.php

+ 4 - 4
application/api/controller/Party.php

@@ -1643,15 +1643,15 @@ class Party extends Common
 
         if($is_back == 1) {
             // 获取背包礼物信息
-            $giftInfo = \app\common\model\GiftBack::get($gift_id);
+            $giftInfo = Db::name('gift_back')->field('gift_id')->where('id',$gift_id)->find();
             if(!$giftInfo){
                 $this->error("背包礼物获取失败");
             }
-            $backGiftId = $giftInfo->gift_id;
+            $backGiftId = $giftInfo['gift_id'];
 
             // 随机获取一个礼物
             $allCount = $number*$userCount;
-            $giftbackList = \app\common\model\GiftBack::where(["gift_id"=>$backGiftId,"user_id"=>$userauthid,'is_use'=>0])->limit($allCount)->select();
+            $giftbackList = Db::name('gift_back')->field('id,value,name,image,gif_image,number')->where(["gift_id"=>$backGiftId,"user_id"=>$userauthid,'is_use'=>0])->limit($allCount)->select();
             $giftInfo = isset($giftbackList[0]) ? $giftbackList[0] : [];
             $giftcount = 0;
             $giftList = [];
@@ -1678,7 +1678,7 @@ class Party extends Common
 
             // 获取礼物信息
 
-            $giftInfo = Db::name('gift')->where('id',$gift_id)->find();
+            $giftInfo = Db::name('gift')->field('id,value,box_type,name,image,special')->where('id',$gift_id)->find();
             if (!$giftInfo) {
                 $this->error("请选择礼物!");
             }