Browse Source

开箱抽奖优化

lizhen_gitee 1 year ago
parent
commit
6f8da7a67b
1 changed files with 11 additions and 11 deletions
  1. 11 11
      application/api/controller/Eggnew.php

+ 11 - 11
application/api/controller/Eggnew.php

@@ -111,18 +111,18 @@ class Eggnew extends Api
 
                 // 更新礼物抽取状态
                 $giftids = array_column($giftArr1,"id");
-                $res1 = \app\common\model\EggGift::update(["is_use"=>1],["id"=>["in",$giftids]]);
+                $res1 = Db::name('egg_gift')->where(["id"=>["in",$giftids]])->update(["is_use"=>1]);
 
 
                 // 更新奖池
-                $res2 = \app\common\model\EggJackpot::update(["status"=>-1],["id"=>$jackpot_id]);
-                $res3 = \app\common\model\EggJackpot::update(["status"=>1,'starttime'=>$nowtime],["id"=>$next_jackpot_id]);//打开,启用时间
+                $res2 = Db::name('egg_jackpot')->where(["id"=>$jackpot_id])->update(["status"=>-1]);
+                $res3 = Db::name('egg_jackpot')->where(["id"=>$next_jackpot_id])->update(["status"=>1,'starttime'=>$nowtime]);//打开,启用时间
 
                 // 下个奖池所有礼物改为未使用
-                $res4 = \app\common\model\EggGift::update(["is_use"=>0,'starttime'=>$nowtime],["Jackpot_id"=>$next_jackpot_id]);//重置礼物,启用时间
+                $res4 = Db::name('egg_gift')->where(["Jackpot_id"=>$next_jackpot_id])->update(["is_use"=>0,'starttime'=>$nowtime]);//重置礼物,启用时间
 
                 // 获取下个奖池礼物
-                $nextjackpotGift = \app\common\model\EggGift::where(["Jackpot_id"=>$next_jackpot_id,"is_use"=>0])->select();
+                $nextjackpotGift = Db::name('egg_gift')->where(["Jackpot_id"=>$next_jackpot_id,"is_use"=>0])->select();
 
                 $newnum = $num-$giftCount;
 
@@ -147,9 +147,9 @@ class Eggnew extends Api
                     $giftids = array_rand($giftArr,$newnum);
 
                     // 更新礼物抽取状态
-                    $res5Info = \app\common\model\EggGift::where(["id"=>["in",$giftids]])->select();
+                    $res5Info = Db::name('egg_gift')->where(["id"=>["in",$giftids]])->select();
 
-                    $res5 = \app\common\model\EggGift::update(["is_use"=>1],["id"=>["in",$giftids]]);
+                    $res5 = Db::name('egg_gift')->where(["id"=>["in",$giftids]])->update(["is_use"=>1]);
 
                     $giftdata = array_merge($giftArr1,$res5Info);
                 }
@@ -164,8 +164,8 @@ class Eggnew extends Api
                 $giftids = array_rand($giftArr,$num);
 
                 // 更新礼物抽取状态
-                $res1 = \app\common\model\EggGift::update(["is_use"=>1],["id"=>["in",$giftids]]);
-                $res1Info = \app\common\model\EggGift::where(["id"=>["in",$giftids]])->select();
+                $res1 = Db::name('egg_gift')->where(["id"=>["in",$giftids]])->update(["is_use"=>1]);
+                $res1Info = Db::name('egg_gift')->where(["id"=>["in",$giftids]])->select();
 
 
                 $res2 = true;
@@ -214,10 +214,10 @@ class Eggnew extends Api
                     "createtime" => time(),
                 ];
             }
-            $data && $res5 = \app\common\model\EggDo::insertAll($data);
+            $data && $res5 = Db::name('egg_do')->insertAll($data);
 
             // 添加到用户背包
-            $backdata && $res7 = \app\common\model\GiftBack::insertAll($backdata);
+            $backdata && $res7 = Db::name('gift_back')->insertAll($backdata);
 
             //扣钻石
             $rs_wallet = model('wallet')->lockChangeAccountRemain($user_id,$total_jewel,'-',0,'开箱子和大转盘',13,'jewel');