| 
					
				 | 
			
			
				@@ -54,7 +54,8 @@ class Act 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     # 获取详情页
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public function getView($field = array())
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        $info = $this->getInfo(array(), $field);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $data['id'] = Dever::input('data_id', 'is_numeric', 'ID');
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $info = $this->getInfo($data, $field);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return Dever::load('order', $this->app)->getView($info);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -120,9 +121,11 @@ class Act 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $info = $this->getTypeInfo($v['type'], $v['type_id']);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if ($info) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $info['status'] = $v['status'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             $info['status_name'] = $this->db->value('status', $v['status']);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             $info['type'] = $v['type'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            $info['type_id'] = $v['id'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $info['type_id'] = $v['type_id'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $info['data_id'] = $v['id'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //$info['cdate'] = $v['cdate'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             $info['cdate_str'] = date('Y-m-d H:i:s', $v['cdate']);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if ($field) {
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -131,6 +134,19 @@ class Act 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if ($this->db->config['load'] == 'place/order') {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if ($v['status'] == 1) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    $m = 3600;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    # 支付倒计时
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    $info['time'] = time() - $v['cdate'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if ($info['time'] >= $m) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        # 已过期,自动取消
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        $info['time'] = -1;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        $this->cancel($info);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        $info['status'] = 10;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } else {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        $info['time'] = $m - $info['time'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 $info['cash'] = Dever::load('price', 'place')->getText($info['cash'], $info['type']);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if ($v['type'] == 3) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     $info['detail'] = Dever::load('order', $this->app)->getDetail($v['id']);
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -150,4 +166,17 @@ class Act 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return $info;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    # 取消订单
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public function cancel($order, $status = 9)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if ($order['status'] == 1) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $state = Dever::db('order', 'place')->update($order['data_id'], array('status' => $status, 'fdate' => time()));
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if ($state) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                # 恢复库存
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return 'ok';
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |