浏览代码

Rwa兑换

afa 6 月之前
父节点
当前提交
91e4196e82
共有 1 个文件被更改,包括 6 次插入9 次删除
  1. 6 9
      application/api/controller/Exchange.php

+ 6 - 9
application/api/controller/Exchange.php

@@ -67,18 +67,15 @@ class Exchange extends Api
               $this->error(__('Invalid parameters'));
           }
           //福利兑换记录
-          $welfare_config = $productWelfareRede::get($ids);
+          $welfare_config = $productWelfareRede::where('id',$ids)->where('status', $productWelfareRede::Normal)->find();
           if (!$welfare_config) $this->error(__('Invalid parameters'));
-
           //检查是否在开启时间之内
-          if(time() < $welfare_config['start_time'] || time() > $welfare_config['end_time']){
-              $this->error(__('不在兑换时间范围内'));
-          }
-
+          if(time() < $welfare_config['start_time'] || time() > $welfare_config['end_time']) $this->error(__('不在兑换时间范围内'));
+          
+          //检查是否已兑换过
           $check_user = (new RwaExchangeRecordModel())->where('user_id', $this->auth->id)->count();
-          if($check_user >= 2){
-              $this->error('每人限制兑换两套,您已达上限');
-          }
+          if($check_user >= 2) $this->error('每人限制兑换两套,您已达上限');
+          
           $order_no = date('YmdHis') . rand(1000, 9999);
           $inster_data[] = [
               'order_no' => $order_no,