Browse Source

新人福利

afa 8 months ago
parent
commit
6213537aa1
2 changed files with 3 additions and 3 deletions
  1. 2 2
      application/api/controller/Airdrop.php
  2. 1 1
      application/api/logic/WelfareLoginc.php

+ 2 - 2
application/api/controller/Airdrop.php

@@ -42,9 +42,9 @@ class Airdrop extends Api
         Db::startTrans();
         try {
             //添加Rwa茶记录
-            $result = WelfareLoginc::setUserWelfareLos($this->auth->id, $row->product_id, $row->num, $this->lan);
+            $result = WelfareLoginc::setUserWelfareLos($this->auth->id, $row->new_product_id, $row->new_num, $this->lan);
             //添加茶数量
-            $userModel::updateForRwaNum($this->auth->id, $this->auth->parent_id, $row->num, '+');
+            $userModel::updateForRwaNum($this->auth->id, $this->auth->parent_id, $row->new_num, '+');
             Db::commit();
         } catch (\Exception $e) {
             Db::rollback();

+ 1 - 1
application/api/logic/WelfareLoginc.php

@@ -37,7 +37,7 @@ class WelfareLoginc
                 ->join('product_list b', "a.product_id = b.id", "left")
                 ->field('a.*,b.is_area,'.$lan.'_name as name')
                 ->where('a.product_id', $productId)->find();
-        if($num > $result->stock) throw new Exception(__('库存不足'));
+        if(!$result || $num > $result->stock) throw new Exception(__('库存不足'));
         if(empty($result->is_area)){
             ProductOrder::setPopularNoAreaOrder($num, $result->id, $result->price, $result->product_id, $uid, ProductOrder::Newbie);
         }else{