Your Name 3 năm trước cách đây
mục cha
commit
6f6aa30b23
2 tập tin đã thay đổi với 12 bổ sung7 xóa
  1. 9 7
      learn/active/lib/Active.php
  2. 3 0
      learn/active/src/Off.php

+ 9 - 7
learn/active/lib/Active.php

@@ -10,6 +10,9 @@ class Active
     	$user = Dever::db('active/user')->find($uid);
 		// print_R(json_decode('[{"id":"1","value":"文本"},{"id":"2","value":"文本"},{"id":"3","value":"1"}]'));die;
 		$data = Dever::db('active/info')->find($active_id);
+		// if ($data['act_status'] == 1 || (isset($data['act_start']) && $data['act_start'] && time() < $data['sign_start'])) {
+		// 	Dever::alert('活动还未开始报名');
+		// }
 		if ($data['act_status'] >=3 || (isset($data['sign_end']) && $data['sign_end'] && time()>$data['sign_end'])){
 			Dever::alert('活动报名已结束');
 		}
@@ -51,18 +54,17 @@ class Active
 		if ($member) {
 			foreach ($title as $k => $v) {
 				if($v['id'] == $member['role']) {
-					if ($order && $order['total']  && $v['num'] > 0 && $order['total'] > $v['num']) {
+					if (($order && $order['total']  && $v['num'] > 0 && $order['total'] > $v['num']) || ($v['num'] > 0 && $num > $v['num']) ) {
 						Dever::alert('您已超过限购数量');
 					}
 				}
 			}
+		} else {
+			if (($order && $order['total'] && $order['total'] >= $data['num']) || ($num > $data['num'])) {
+				Dever::alert('您已超过限购数量');
+			}
 		}
-		if ($order && $order['total'] && $order['total'] >= $data['num']) {
-			Dever::alert('您已超过限购数量');
-		}
-		if ($num > $data['num'] ) {
-			Dever::alert('您已超过限购数量');
-		}
+		
 		$insert['order_num'] = $this->getOrderId();
 		$ids = Dever::db('active/order')->insert($insert);
 		$url = Dever::url();

+ 3 - 0
learn/active/src/Off.php

@@ -101,6 +101,9 @@ Class Off extends Coreoff
 		$data = Dever::db('active/code')->find($code_id);
 		if ($data) {
 			$active = Dever::db('active/info')->find($data['active_id']);
+			// if (time() < $active['act_start']){
+			// 	Dever::alert('活动未开始');
+			// }
 			if ($active['status'] == 5 || time() >= $active['act_end']) {
 				Dever::alert('活动已结束');
 			}