Your Name 3 年之前
父节点
当前提交
e3ad42a851
共有 2 个文件被更改,包括 18 次插入4 次删除
  1. 14 0
      learn/active/database/code.php
  2. 4 4
      learn/active/src/Home.php

+ 14 - 0
learn/active/database/code.php

@@ -235,6 +235,20 @@ return array
             'order' => array('cdate' => 'desc'),
             'col' => '*',
         ),
+        'getOne' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'join_uid' => 'yes',
+                'active_id' =>'yes',
+                'status' => array('yes','in'),
+                'state' => 1,
+            ),
+            'type' => 'one',
+            // 'order' => array('cdate' => 'desc'),
+            'col' => '*',
+        ),
         'getCode' => array
         (
             # 匹配的正则或函数 选填项

+ 4 - 4
learn/active/src/Home.php

@@ -226,13 +226,13 @@ Class Home extends Core
         if ($data['info']['num'] <= count($code)) {
             Dever::alert('已领完');
         } else {
-            $where['active_id'] = $active_id;
-            $where['join_uid'] = $uid;
-            
-            $code = Dever::db('active/code')->find($where);
+           
+            $code = Dever::db('active/code')->getOne(array('active_id'=>$active_id,'join_uid'=>$uid,'status'=>'1,2'));
             if ($code) {
                 Dever::alert('您已领取过了,不可重复领取');
             }
+            $where['active_id'] = $active_id;
+            $where['join_uid'] = $uid;
             $where['buy_uid'] = $data['info']['uid'];
             $where['order_id'] = $order_id;
             $where['act_status'] = $info['act_status'];