예제 #1
0
 /**
  * 添加一个楼盘到数据库
  * @param $premises Array(name, type, description, project_id, state, area, structure, lng, lat, zoom)
  * @return bool 是否成功
  */
 public function add($premises)
 {
     $ret = false;
     $point = new Point();
     $point_id = (int) $point->add($premises['lng'], $premises['lat'], $premises['zoom']);
     $mysql = new MysqlAccess();
     if ($point_id > 0) {
         $sql = "insert into premises(`name`, `description`, `point_id`, `project_id`) " . "values('{$premises['name']}', '{$premises['description']}', {$point_id}, " . "{$premises['project_id']})";
         $mysql->runSql($sql);
         $ret = true;
     }
     return $ret;
 }
예제 #2
0
 /**
  * 添加person
  */
 public function add($person)
 {
     $ret = false;
     $point = new Point();
     $now_id = (int) $point->add($person['now']['lng'], $person['now']['lat'], $person['now']['zoom']);
     $want_id = (int) $point->add($person['want']['lng'], $person['want']['lat'], $person['want']['zoom']);
     $mysql = new MysqlAccess();
     if ($now_id > 0 && $want_id > 0) {
         $sql = "insert into person(`name`, `now`, `want`, `state`, `description`) values " . "('{$person['name']}', {$now_id}, {$want_id}, '{$person['state']}', '{$person['description']}')";
         $mysql->runSql($sql);
         $ret = true;
     }
     return $ret;
 }
예제 #3
0
 /**
  * 根据id删除
  * 
  */
 public function delete($id)
 {
     $mysql = new MysqlAccess();
     $sql = "delete from point where id = {$id}";
     $mysql->runSql($sql);
 }