Exemplo n.º 1
0
 public function ajax_demand(Request $request)
 {
     header("Content-Type:text/html;charset=utf-8");
     if (!isset($_GET['id']) || empty($_GET['id'])) {
         echo $this->ecm_json_encode(false);
         return;
     }
     $id = $_GET['id'];
     $bids = isset($_GET['bid']) ? $_GET['bid'] : '';
     $key = isset($_GET['key']) ? $_GET['key'] : '';
     $demandmode = new Demand();
     $demands = $demandmode->getDemands($id, $bids, $key);
     //取得当前正在进行的竞购
     $data = array();
     foreach ($demands as $key => $val) {
         $onedata = array();
         $onedata['sn'] = $val['sn'];
         $onedata['id'] = $val['id'];
         $onedata['title'] = $val['title'];
         $onedata['price'] = $val['price'];
         $onedata['paytime'] = $val['paytime'];
         $onedata['thumb'] = $val['thumb'];
         $onedata['url'] = $val['url'];
         $onede = Demand::find($val['id']);
         $onedata['exptime'] = $onede->getexptime();
         //当前竞购的状态
         $onedata['bidnum'] = count($onede->bids);
         $data[] = $onedata;
     }
     echo $this->ecm_json_encode(array_values($data));
     return;
 }