Ejemplo n.º 1
0
 public function DanhSachGameServices()
 {
     $gname = null;
     if (isset($_POST["gname"]) && $_POST["gname"] != "") {
         $gname = "game_name like '%" . $_POST["gname"] . "%'";
     }
     $this->registry->db->connect();
     $sqlselect = "game_id,game_name,game_content,game_url,game_difficulty,game_physical,game_number_min,game_number_max,\n            image_url,game_time,DATE_FORMAT(created_time, '%d/%m/%Y'),DATE_FORMAT(updated_time, '%d/%m/%Y'),\n            game_price,ticket_code,game_seq,game_promotions,game_name_vn,game_content_vn,game_promotions_vn";
     $order = "game_seq";
     $this->registry->db->select('tbl_game_info', $sqlselect, $gname, $order);
     $result = $this->registry->db->getResult();
     $numRow = $this->registry->db->getNumRow();
     $this->registry->db->disconnect();
     $lResult = array();
     $lList = array();
     $appUtil = new AppUtils();
     if ($numRow == 1) {
         $o = array();
         $o["gid"] = $result["game_id"];
         $o["gname"] = $result["game_name"];
         $o["gprice"] = $result["game_price"];
         $o["gcontent"] = $result["game_content"];
         $o["gdiff"] = $appUtil->cDoKhoGame($result["game_difficulty"]);
         $o["gnumber"] = $appUtil->cSoNguoiChoi($result['game_number_min'], $result['game_number_max']);
         $o["gtime"] = $appUtil->cThoiGianChoiGame($result['game_time']);
         $o["gcode"] = $result["ticket_code"];
         $o["gurl"] = $result["game_url"];
         $o["gimageurl"] = $result["image_url"];
         $o["gpromotions"] = $result["game_promotions"];
         $o["gnamevn"] = $result["game_name_vn"];
         $o["gcontentvn"] = $result["game_content_vn"];
         $o["gpromotionsvn"] = $result["game_promotions_vn"];
         array_push($lResult, $o);
     } else {
         foreach ($result as $value) {
             $o = array();
             $o["gid"] = $value["game_id"];
             $o["gname"] = $value["game_name"];
             $o["gprice"] = $value["game_price"];
             $o["gcontent"] = $value["game_content"];
             $o["gdiff"] = $appUtil->cDoKhoGame($value["game_difficulty"]);
             $o["gnumber"] = $appUtil->cSoNguoiChoi($value['game_number_min'], $value['game_number_max']);
             $o["gtime"] = $appUtil->cThoiGianChoiGame($value['game_time']);
             $o["gcode"] = $value["ticket_code"];
             $o["gurl"] = $value["game_url"];
             $o["gimageurl"] = $value["image_url"];
             $o["gpromotions"] = $value["game_promotions"];
             $o["gnamevn"] = $value["game_name_vn"];
             $o["gcontentvn"] = $value["game_content_vn"];
             $o["gpromotionsvn"] = $value["game_promotions_vn"];
             array_push($lResult, $o);
         }
     }
     $lList["total"] = count($lList);
     $lList["rows"] = $lResult;
     echo json_encode($lList);
 }