|
@@ -24,11 +24,45 @@ Class User extends Core
|
|
|
Dever::db('active/order')->update($w);
|
|
|
Dever::alert('订单已关闭');
|
|
|
}
|
|
|
- $info = Dever::db('active/order')->getNum(array('uid'=>$this->uid,'active_id'=>$order['active_id']));
|
|
|
+ $info = Dever::db('active/order')->getNum(array('uid'=>$this->uid,'active_id'=>$order['active_id'],'status'=>'2,4,5'));
|
|
|
$active = Dever::db('active/info')->find($order['active_id']);
|
|
|
- if ($active['num']>0 && $info['total'] >= $active['num']) {
|
|
|
- Dever::alert('您已超过限购数量');
|
|
|
+ $title = array();
|
|
|
+ if ($active['attr']) {
|
|
|
+ if ($active['attr_input']) {
|
|
|
+ $input['num'] = explode(',',$active['attr_input']);
|
|
|
+ }
|
|
|
+ $active['attr'] = explode(',',$active['attr']);
|
|
|
+ foreach ($active['attr'] as $k => $v) {
|
|
|
+ foreach ($input['num'] as $k1 => $v1) {
|
|
|
+ if($k == $k1){
|
|
|
+ $title[$k]['id'] = $v;
|
|
|
+ $title[$k]['num'] = $v1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $user = Dever::db('active/user')->find($order['uid']);
|
|
|
+ $member = Dever::load('active/lib/user')->agent($user);
|
|
|
+ if ($title && $member && $member['title_id'] && $member['title_id'] > 1) {
|
|
|
+ foreach ($title as $k => $v) {
|
|
|
+ $title_id = explode(',',$member['title_id']);
|
|
|
+ if($title_id && in_array($v['id'],$title_id)) {
|
|
|
+ if ($v['num'] > 0 && $info['total']+$order['num'] > $v['num']) {
|
|
|
+ Dever::alert('您已超过限购数量');
|
|
|
+ }
|
|
|
+ if ($order) {
|
|
|
+ if ($info['total'] && $v['num'] > 0 && ($info['total']+$order['num']) > $v['num']) {
|
|
|
+ Dever::alert('您已超过限购数量');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if ($active['num']>0 && $info['total']+$order['num'] > $active['num']) {
|
|
|
+ Dever::alert('您已超过限购数量');
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
$jump = Dever::input('jump');
|
|
|
if ($jump == 1) {
|
|
|
Dever::location($order['url']);
|