table}` set `lampcount` = `lampcount` + {$count} WHERE `id`={$id}"; $this->db->query($sql); if ($this->db->affected_rows() == 1) { return true; } else { return false; } } // 减少路灯数(复用) public function minus_lamp_count($id,$count){ $sql = "update `{$this->table}` set `lampcount` = `lampcount` - {$count} WHERE `id`={$id} and `lampcount` >= {$count}"; $this->db->query($sql); if ($this->db->affected_rows() == 1) { return true; } else { return false; } } }